author | zautrix <zautrix> | 2005-01-19 11:41:45 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-19 11:41:45 (UTC) |
commit | 0d878a0144644499ead17b2532cc94abb545bcdb (patch) (unidiff) | |
tree | 241010225cf2b26847750c5f511ff15a9ebef9e1 /pwmanager | |
parent | af56077eeeab7b46b98ad5159c6653114abf6602 (diff) | |
download | kdepimpi-0d878a0144644499ead17b2532cc94abb545bcdb.zip kdepimpi-0d878a0144644499ead17b2532cc94abb545bcdb.tar.gz kdepimpi-0d878a0144644499ead17b2532cc94abb545bcdb.tar.bz2 |
translation added
-rw-r--r-- | pwmanager/pwmanager/main.cpp | 2 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwminit.cpp | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/pwmanager/pwmanager/main.cpp b/pwmanager/pwmanager/main.cpp index 70df15d..6e449c6 100644 --- a/pwmanager/pwmanager/main.cpp +++ b/pwmanager/pwmanager/main.cpp | |||
@@ -1,220 +1,222 @@ | |||
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 PWM_EMBEDDED | 20 | #ifndef PWM_EMBEDDED |
21 | #include <kcmdlineargs.h> | 21 | #include <kcmdlineargs.h> |
22 | #include <kaboutdata.h> | 22 | #include <kaboutdata.h> |
23 | #else | 23 | #else |
24 | #include <qdir.h> | 24 | #include <qdir.h> |
25 | #include <kpimglobalprefs.h> | 25 | #include <kpimglobalprefs.h> |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #include <klocale.h> | 28 | #include <klocale.h> |
29 | #include <kstandarddirs.h> | 29 | #include <kstandarddirs.h> |
30 | 30 | ||
31 | #include "pwmexception.h" | 31 | #include "pwmexception.h" |
32 | #include "pwminit.h" | 32 | #include "pwminit.h" |
33 | void dumpMissing(); | ||
33 | 34 | ||
34 | #define LICENSE_FILE(::locate("data", "pwmanager/pwmanager_license_text")) | 35 | #define LICENSE_FILE(::locate("data", "pwmanager/pwmanager_license_text")) |
35 | 36 | ||
36 | int PwMApplication::newInstance() | 37 | int PwMApplication::newInstance() |
37 | { | 38 | { |
38 | static bool initial = true; | 39 | static bool initial = true; |
39 | if (initial) { | 40 | if (initial) { |
40 | initial = false; | 41 | initial = false; |
41 | init = new PwMInit(this); | 42 | init = new PwMInit(this); |
42 | init->initializeApp(); | 43 | init->initializeApp(); |
43 | } else { | 44 | } else { |
44 | BUG_ON(!init); | 45 | BUG_ON(!init); |
45 | printInfo("passing parameters to old instance."); | 46 | printInfo("passing parameters to old instance."); |
46 | init->handleCmdLineArgs(false); | 47 | init->handleCmdLineArgs(false); |
47 | } | 48 | } |
48 | return EXIT_SUCCESS; | 49 | return EXIT_SUCCESS; |
49 | } | 50 | } |
50 | 51 | ||
51 | 52 | ||
52 | static const char *description = I18N_NOOP("PwManager\n" | 53 | static const char *description = I18N_NOOP("PwManager\n" |
53 | "The convenient way of managing passwords"); | 54 | "The convenient way of managing passwords"); |
54 | 55 | ||
55 | #ifndef PWM_EMBEDDED | 56 | #ifndef PWM_EMBEDDED |
56 | static KCmdLineOptions options[] = | 57 | static KCmdLineOptions options[] = |
57 | { | 58 | { |
58 | { "minimized", I18N_NOOP("Windows minimized"), 0 }, | 59 | { "minimized", I18N_NOOP("Windows minimized"), 0 }, |
59 | { "mintray", I18N_NOOP("Windows minimized to tray"),0 }, | 60 | { "mintray", I18N_NOOP("Windows minimized to tray"),0 }, |
60 | { "open-deeplocked", I18N_NOOP("Open all \"files\" deeplocked"),0 }, | 61 | { "open-deeplocked", I18N_NOOP("Open all \"files\" deeplocked"),0 }, |
61 | { "skip-self-test", I18N_NOOP("Don't run a self-test on startup"),0 }, | 62 | { "skip-self-test", I18N_NOOP("Don't run a self-test on startup"),0 }, |
62 | { "+[files...]", I18N_NOOP("Files to open on startup"), 0 }, | 63 | { "+[files...]", I18N_NOOP("Files to open on startup"), 0 }, |
63 | { 0, 0, 0 } | 64 | { 0, 0, 0 } |
64 | }; | 65 | }; |
65 | #endif | 66 | #endif |
66 | 67 | ||
67 | #ifdef PWM_DEBUG | 68 | #ifdef PWM_DEBUG |
68 | static void printDebugConfigureInfo() | 69 | static void printDebugConfigureInfo() |
69 | { | 70 | { |
70 | cout << "================================" << endl; | 71 | cout << "================================" << endl; |
71 | cout << PROG_NAME " version " PACKAGE_VER << endl; | 72 | cout << PROG_NAME " version " PACKAGE_VER << endl; |
72 | #ifdef CONFIG_KEYCARD | 73 | #ifdef CONFIG_KEYCARD |
73 | cout << "CONFIG_KEYCARD: enabled" << endl; | 74 | cout << "CONFIG_KEYCARD: enabled" << endl; |
74 | #else | 75 | #else |
75 | cout << "CONFIG_KEYCARD: disabled" << endl; | 76 | cout << "CONFIG_KEYCARD: disabled" << endl; |
76 | #endif | 77 | #endif |
77 | #ifdef CONFIG_KWALLETIF | 78 | #ifdef CONFIG_KWALLETIF |
78 | cout << "CONFIG_KWALLETIF: enabled" << endl; | 79 | cout << "CONFIG_KWALLETIF: enabled" << endl; |
79 | #else | 80 | #else |
80 | cout << "CONFIG_KWALLETIF: disabled" << endl; | 81 | cout << "CONFIG_KWALLETIF: disabled" << endl; |
81 | #endif | 82 | #endif |
82 | #ifdef BIG_ENDIAN_HOST | 83 | #ifdef BIG_ENDIAN_HOST |
83 | cout << "Endianess: big-endian" << endl; | 84 | cout << "Endianess: big-endian" << endl; |
84 | #else | 85 | #else |
85 | cout << "Endianess: little-endian" << endl; | 86 | cout << "Endianess: little-endian" << endl; |
86 | #endif | 87 | #endif |
87 | #ifdef WORDS_BIGENDIAN | 88 | #ifdef WORDS_BIGENDIAN |
88 | cout << "Endianess 2: big-endian" << endl; | 89 | cout << "Endianess 2: big-endian" << endl; |
89 | #else | 90 | #else |
90 | cout << "Endianess 2: little-endian" << endl; | 91 | cout << "Endianess 2: little-endian" << endl; |
91 | #endif | 92 | #endif |
92 | 93 | ||
93 | cout << "sizeof(long): " << sizeof(long) << endl; | 94 | cout << "sizeof(long): " << sizeof(long) << endl; |
94 | cout << "================================" << endl; | 95 | cout << "================================" << endl; |
95 | } | 96 | } |
96 | #else // PWM_DEBUG | 97 | #else // PWM_DEBUG |
97 | static inline void printDebugConfigureInfo() { /* nothing */ } | 98 | static inline void printDebugConfigureInfo() { /* nothing */ } |
98 | #endif // PWM_DEBUG | 99 | #endif // PWM_DEBUG |
99 | 100 | ||
100 | #ifndef PWM_EMBEDDED | 101 | #ifndef PWM_EMBEDDED |
101 | static void addAuthors(KAboutData *aboutData) | 102 | static void addAuthors(KAboutData *aboutData) |
102 | { | 103 | { |
103 | aboutData->addAuthor("Michael Buesch", | 104 | aboutData->addAuthor("Michael Buesch", |
104 | I18N_NOOP( | 105 | I18N_NOOP( |
105 | "main programming and current maintainer"), | 106 | "main programming and current maintainer"), |
106 | "mbuesch@freenet.de"); | 107 | "mbuesch@freenet.de"); |
107 | aboutData->addAuthor("Matt Scifo", | 108 | aboutData->addAuthor("Matt Scifo", |
108 | I18N_NOOP( | 109 | I18N_NOOP( |
109 | "original implementaion of \n" | 110 | "original implementaion of \n" |
110 | "\"categories\" and the password-tree \n" | 111 | "\"categories\" and the password-tree \n" |
111 | "in the system-tray. Original implementations of \n" | 112 | "in the system-tray. Original implementations of \n" |
112 | "numerous view-improvements."), | 113 | "numerous view-improvements."), |
113 | "mscifo@o1.com"); | 114 | "mscifo@o1.com"); |
114 | aboutData->addCredit("Elias Probst", | 115 | aboutData->addCredit("Elias Probst", |
115 | I18N_NOOP( | 116 | I18N_NOOP( |
116 | "Gentoo ebuild maintainer."), | 117 | "Gentoo ebuild maintainer."), |
117 | "elias.probst@gmx.de"); | 118 | "elias.probst@gmx.de"); |
118 | aboutData->addCredit("George Staikos", | 119 | aboutData->addCredit("George Staikos", |
119 | I18N_NOOP("KWallet"), | 120 | I18N_NOOP("KWallet"), |
120 | "staikos@kde.org"); | 121 | "staikos@kde.org"); |
121 | aboutData->addCredit("Matthew Palmer", | 122 | aboutData->addCredit("Matthew Palmer", |
122 | I18N_NOOP("rc2 code"), | 123 | I18N_NOOP("rc2 code"), |
123 | "mjp16@uow.edu.au"); | 124 | "mjp16@uow.edu.au"); |
124 | aboutData->addCredit("Olivier Sessink", | 125 | aboutData->addCredit("Olivier Sessink", |
125 | I18N_NOOP("gpasman"), | 126 | I18N_NOOP("gpasman"), |
126 | "gpasman@nl.linux.org"); | 127 | "gpasman@nl.linux.org"); |
127 | aboutData->addCredit("The libgcrypt developers", | 128 | aboutData->addCredit("The libgcrypt developers", |
128 | I18N_NOOP("Blowfish and SHA1 algorithms"), | 129 | I18N_NOOP("Blowfish and SHA1 algorithms"), |
129 | 0, "ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/"); | 130 | 0, "ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/"); |
130 | aboutData->addCredit("Troy Engel", | 131 | aboutData->addCredit("Troy Engel", |
131 | I18N_NOOP("kpasman"), | 132 | I18N_NOOP("kpasman"), |
132 | "tengel@sonic.net"); | 133 | "tengel@sonic.net"); |
133 | aboutData->addCredit("Wickey", | 134 | aboutData->addCredit("Wickey", |
134 | I18N_NOOP("graphics-design in older versions."), | 135 | I18N_NOOP("graphics-design in older versions."), |
135 | "wickey@gmx.at"); | 136 | "wickey@gmx.at"); |
136 | aboutData->addCredit("Ian MacGregor", | 137 | aboutData->addCredit("Ian MacGregor", |
137 | I18N_NOOP( | 138 | I18N_NOOP( |
138 | "original documentation author.")); | 139 | "original documentation author.")); |
139 | } | 140 | } |
140 | #endif | 141 | #endif |
141 | 142 | ||
142 | int main(int argc, char *argv[]) | 143 | int main(int argc, char *argv[]) |
143 | { | 144 | { |
144 | printDebugConfigureInfo(); | 145 | printDebugConfigureInfo(); |
145 | #ifndef PWM_EMBEDDED | 146 | #ifndef PWM_EMBEDDED |
146 | KAboutData aboutData(PACKAGE_NAME, PROG_NAME, | 147 | KAboutData aboutData(PACKAGE_NAME, PROG_NAME, |
147 | PACKAGE_VER, description, KAboutData::License_File, | 148 | PACKAGE_VER, description, KAboutData::License_File, |
148 | "(c) 2003, 2004 Michael Buesch and the PwManager Team", 0, | 149 | "(c) 2003, 2004 Michael Buesch and the PwManager Team", 0, |
149 | "http://passwordmanager.sourceforge.net/", | 150 | "http://passwordmanager.sourceforge.net/", |
150 | "mbuesch@freenet.de"); | 151 | "mbuesch@freenet.de"); |
151 | addAuthors(&aboutData); | 152 | addAuthors(&aboutData); |
152 | 153 | ||
153 | KCmdLineArgs::init(argc, argv, &aboutData); | 154 | KCmdLineArgs::init(argc, argv, &aboutData); |
154 | KCmdLineArgs::addCmdLineOptions(options); | 155 | KCmdLineArgs::addCmdLineOptions(options); |
155 | 156 | ||
156 | KUniqueApplication::addCmdLineOptions(); | 157 | KUniqueApplication::addCmdLineOptions(); |
157 | if (!KUniqueApplication::start()) { | 158 | if (!KUniqueApplication::start()) { |
158 | printInfo("already running."); | 159 | printInfo("already running."); |
159 | return EXIT_SUCCESS; | 160 | return EXIT_SUCCESS; |
160 | } | 161 | } |
161 | PwMApplication a; | 162 | PwMApplication a; |
162 | aboutData.setLicenseTextFile(LICENSE_FILE); | 163 | aboutData.setLicenseTextFile(LICENSE_FILE); |
163 | return a.exec(); | 164 | return a.exec(); |
164 | #else | 165 | #else |
165 | 166 | ||
166 | bool exitHelp = false; | 167 | bool exitHelp = false; |
167 | if ( argc > 1 ) { | 168 | if ( argc > 1 ) { |
168 | QString command = argv[1]; | 169 | QString command = argv[1]; |
169 | if ( command == "-help" ){ | 170 | if ( command == "-help" ){ |
170 | printf("PWM/PI command line commands:\n"); | 171 | printf("PWM/PI command line commands:\n"); |
171 | printf(" no command: Start PWM/PI in usual way\n"); | 172 | printf(" no command: Start PWM/PI in usual way\n"); |
172 | printf(" -help: This output\n"); | 173 | printf(" -help: This output\n"); |
173 | printf(" PWM/PI is exiting now. Bye!\n"); | 174 | printf(" PWM/PI is exiting now. Bye!\n"); |
174 | exitHelp = true; | 175 | exitHelp = true; |
175 | } | 176 | } |
176 | } | 177 | } |
177 | if ( ! exitHelp ) { | 178 | if ( ! exitHelp ) { |
178 | 179 | ||
179 | PwMApplication a(argc, argv); | 180 | PwMApplication a(argc, argv); |
180 | 181 | ||
181 | KGlobal::setAppName( "pwmanager" ); | 182 | KGlobal::setAppName( "pwmanager" ); |
182 | #ifndef DESKTOP_VERSION | 183 | #ifndef DESKTOP_VERSION |
183 | //qDebug("width %d ",QApplication::desktop()->width() ); | 184 | //qDebug("width %d ",QApplication::desktop()->width() ); |
184 | if ( QApplication::desktop()->width() > 320 ) | 185 | if ( QApplication::desktop()->width() > 320 ) |
185 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons22/"); | 186 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons22/"); |
186 | else | 187 | else |
187 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons16/"); | 188 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons16/"); |
188 | #else | 189 | #else |
189 | QString fileName ; | 190 | QString fileName ; |
190 | fileName = qApp->applicationDirPath () + "/kdepim/pwmanager/icons22/"; | 191 | fileName = qApp->applicationDirPath () + "/kdepim/pwmanager/icons22/"; |
191 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 192 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
192 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); | 193 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); |
193 | 194 | ||
194 | #endif | 195 | #endif |
195 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "pwmanager"))); | 196 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "pwmanager"))); |
196 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 197 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
197 | 198 | ||
198 | a.newInstance(); | 199 | a.newInstance(); |
199 | 200 | ||
200 | //US KAddressBookMain m ; | 201 | //US KAddressBookMain m ; |
201 | 202 | ||
202 | //US QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 203 | //US QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
203 | /*US | 204 | /*US |
204 | #ifndef DESKTOP_VERSION | 205 | #ifndef DESKTOP_VERSION |
205 | a.showMainWidget( &m ); | 206 | a.showMainWidget( &m ); |
206 | #else | 207 | #else |
207 | a.setMainWidget( &m ); | 208 | a.setMainWidget( &m ); |
208 | m.resize (640, 480 ); | 209 | m.resize (640, 480 ); |
209 | m.show(); | 210 | m.show(); |
210 | #endif | 211 | #endif |
211 | */ | 212 | */ |
212 | QObject::connect( &a, SIGNAL( lastWindowClosed()), &a, SLOT (quit())); | 213 | QObject::connect( &a, SIGNAL( lastWindowClosed()), &a, SLOT (quit())); |
213 | a.exec(); | 214 | a.exec(); |
215 | dumpMissing(); | ||
214 | KPimGlobalPrefs::instance()->writeConfig(); | 216 | KPimGlobalPrefs::instance()->writeConfig(); |
215 | } | 217 | } |
216 | qDebug("PWMPI: Bye! "); | 218 | qDebug("PWMPI: Bye! "); |
217 | 219 | ||
218 | #endif | 220 | #endif |
219 | 221 | ||
220 | } | 222 | } |
diff --git a/pwmanager/pwmanager/pwminit.cpp b/pwmanager/pwmanager/pwminit.cpp index 68f3637..0cf248c 100644 --- a/pwmanager/pwmanager/pwminit.cpp +++ b/pwmanager/pwmanager/pwminit.cpp | |||
@@ -94,194 +94,195 @@ PwMInit::~PwMInit() | |||
94 | // close all open mainwnds | 94 | // close all open mainwnds |
95 | QValueList<PwM *>::iterator i = _mainWndList.begin(), | 95 | QValueList<PwM *>::iterator i = _mainWndList.begin(), |
96 | end = _mainWndList.end(); | 96 | end = _mainWndList.end(); |
97 | 97 | ||
98 | #else | 98 | #else |
99 | // close all open mainwnds | 99 | // close all open mainwnds |
100 | QValueList<PwM *>::Iterator i = _mainWndList.begin(), | 100 | QValueList<PwM *>::Iterator i = _mainWndList.begin(), |
101 | end = _mainWndList.end(); | 101 | end = _mainWndList.end(); |
102 | #endif | 102 | #endif |
103 | while (i != end) { | 103 | while (i != end) { |
104 | disconnect(*i, SIGNAL(closed(PwM *)), | 104 | disconnect(*i, SIGNAL(closed(PwM *)), |
105 | this, SLOT(mainWndClosed(PwM *))); | 105 | this, SLOT(mainWndClosed(PwM *))); |
106 | delete *i; | 106 | delete *i; |
107 | ++i; | 107 | ++i; |
108 | } | 108 | } |
109 | _mainWndList.clear(); | 109 | _mainWndList.clear(); |
110 | // close all remaining open documents | 110 | // close all remaining open documents |
111 | PwMDocList *_dl = PwMDoc::getOpenDocList(); | 111 | PwMDocList *_dl = PwMDoc::getOpenDocList(); |
112 | vector<PwMDocList::listItem> dl = *(_dl->getList()); | 112 | vector<PwMDocList::listItem> dl = *(_dl->getList()); |
113 | vector<PwMDocList::listItem>::iterator i2 = dl.begin(), | 113 | vector<PwMDocList::listItem>::iterator i2 = dl.begin(), |
114 | end2 = dl.end(); | 114 | end2 = dl.end(); |
115 | while (i2 != end2) { | 115 | while (i2 != end2) { |
116 | delete (*i2).doc; | 116 | delete (*i2).doc; |
117 | ++i2; | 117 | ++i2; |
118 | } | 118 | } |
119 | 119 | ||
120 | #ifdef CONFIG_KWALLETIF | 120 | #ifdef CONFIG_KWALLETIF |
121 | delete_ifnot_null(_kwalletEmu); | 121 | delete_ifnot_null(_kwalletEmu); |
122 | #endif // CONFIG_KWALLETIF | 122 | #endif // CONFIG_KWALLETIF |
123 | #ifdef CONFIG_KEYCARD | 123 | #ifdef CONFIG_KEYCARD |
124 | delete_ifnot_null(_keycard); | 124 | delete_ifnot_null(_keycard); |
125 | #endif // CONFIG_KEYCARD | 125 | #endif // CONFIG_KEYCARD |
126 | delete_ifnot_null(_tray); | 126 | delete_ifnot_null(_tray); |
127 | 127 | ||
128 | Randomizer::cleanup(); | 128 | Randomizer::cleanup(); |
129 | #ifndef PWM_EMBEDDED | 129 | #ifndef PWM_EMBEDDED |
130 | Configuration::cleanup(); | 130 | Configuration::cleanup(); |
131 | #endif | 131 | #endif |
132 | } | 132 | } |
133 | 133 | ||
134 | void PwMInit::initializeApp() | 134 | void PwMInit::initializeApp() |
135 | { | 135 | { |
136 | //qDebug("PwMInit::initializeApp() "); | 136 | //qDebug("PwMInit::initializeApp() "); |
137 | PWM_ASSERT(runStatus == unknown); | 137 | PWM_ASSERT(runStatus == unknown); |
138 | runStatus = init; | 138 | runStatus = init; |
139 | initPosixSignalHandler(); | 139 | initPosixSignalHandler(); |
140 | Randomizer::init(); | 140 | Randomizer::init(); |
141 | #ifndef PWM_EMBEDDED | 141 | #ifndef PWM_EMBEDDED |
142 | Configuration::init(); | 142 | Configuration::init(); |
143 | #endif | 143 | #endif |
144 | initDCOP(); | 144 | initDCOP(); |
145 | initKWalletEmu(); | 145 | initKWalletEmu(); |
146 | initKeycard(); | 146 | initKeycard(); |
147 | initTray(); | 147 | initTray(); |
148 | handleCmdLineArgs(); | 148 | handleCmdLineArgs(); |
149 | bool openDeeplocked = false; | 149 | bool openDeeplocked = false; |
150 | if (conf()->confGlobAutostartDeepLocked() || | 150 | if (conf()->confGlobAutostartDeepLocked() || |
151 | savedCmd.open_deeplocked) | 151 | savedCmd.open_deeplocked) |
152 | openDeeplocked = true; | 152 | openDeeplocked = true; |
153 | if ( false ){ | 153 | if ( false ){ |
154 | // LR is not working | 154 | // LR is not working |
155 | //if (conf()->confWndAutoMinimizeOnStart() || | 155 | //if (conf()->confWndAutoMinimizeOnStart() || |
156 | // savedCmd.minToTray) { | 156 | // savedCmd.minToTray) { |
157 | PwMDoc *newDoc = createDoc(); | 157 | PwMDoc *newDoc = createDoc(); |
158 | qDebug(" createDoc()"); | 158 | qDebug(" createDoc()"); |
159 | if (!newDoc->openDocUi(newDoc, | 159 | if (!newDoc->openDocUi(newDoc, |
160 | conf()->confGlobAutoStart(), | 160 | conf()->confGlobAutoStart(), |
161 | openDeeplocked)) { | 161 | openDeeplocked)) { |
162 | delete newDoc; | 162 | delete newDoc; |
163 | } | 163 | } |
164 | 164 | ||
165 | //US ENH for embedded devices: in the case of failure, open a document the default way | 165 | //US ENH for embedded devices: in the case of failure, open a document the default way |
166 | createMainWnd(conf()->confGlobAutoStart(), | 166 | createMainWnd(conf()->confGlobAutoStart(), |
167 | openDeeplocked, | 167 | openDeeplocked, |
168 | true, | 168 | true, |
169 | 0, | 169 | 0, |
170 | savedCmd.minimized); | 170 | savedCmd.minimized); |
171 | 171 | ||
172 | 172 | ||
173 | 173 | ||
174 | 174 | ||
175 | //} | 175 | //} |
176 | } else { | 176 | } else { |
177 | createMainWnd(conf()->confGlobAutoStart(), | 177 | createMainWnd(conf()->confGlobAutoStart(), |
178 | openDeeplocked, | 178 | openDeeplocked, |
179 | true, | 179 | true, |
180 | 0, | 180 | 0, |
181 | savedCmd.minimized); | 181 | savedCmd.minimized); |
182 | } | 182 | } |
183 | runStatus = running; | 183 | runStatus = running; |
184 | } | 184 | } |
185 | 185 | ||
186 | void PwMInit::shutdownApp(int exitStatus) | 186 | void PwMInit::shutdownApp(int exitStatus) |
187 | { | 187 | { |
188 | 188 | ||
189 | 189 | ||
190 | PwM * iii; | 190 | PwM * iii;; |
191 | while ( iii = _mainWndList.first() ) { | 191 | while ( _mainWndList.count() ) { |
192 | iii = _mainWndList.first(); | ||
192 | disconnect(iii, SIGNAL(closed(PwM *)), | 193 | disconnect(iii, SIGNAL(closed(PwM *)), |
193 | this, SLOT(mainWndClosed(PwM *))); | 194 | this, SLOT(mainWndClosed(PwM *))); |
194 | mainWndClosed((iii)); | 195 | mainWndClosed((iii)); |
195 | } | 196 | } |
196 | 197 | ||
197 | printDebug(string("PwMInit::shutdownApp(") | 198 | printDebug(string("PwMInit::shutdownApp(") |
198 | + tostr(exitStatus) + ") called."); | 199 | + tostr(exitStatus) + ") called."); |
199 | PWM_ASSERT((runStatus == running) || (runStatus == init)); | 200 | PWM_ASSERT((runStatus == running) || (runStatus == init)); |
200 | runStatus = shutdown; | 201 | runStatus = shutdown; |
201 | QApplication::exit(exitStatus); | 202 | QApplication::exit(exitStatus); |
202 | /* The destructor of PwMInit is called when control | 203 | /* The destructor of PwMInit is called when control |
203 | * leaves main() | 204 | * leaves main() |
204 | */ | 205 | */ |
205 | } | 206 | } |
206 | 207 | ||
207 | void PwMInit::initPosixSignalHandler() | 208 | void PwMInit::initPosixSignalHandler() |
208 | { | 209 | { |
209 | signal(SIGINT, sig_handler); | 210 | signal(SIGINT, sig_handler); |
210 | signal(SIGTERM, sig_handler); | 211 | signal(SIGTERM, sig_handler); |
211 | } | 212 | } |
212 | 213 | ||
213 | void PwMInit::initDCOP() | 214 | void PwMInit::initDCOP() |
214 | { | 215 | { |
215 | #ifndef PWM_EMBEDDED | 216 | #ifndef PWM_EMBEDDED |
216 | _dcopClient = app->dcopClient(); | 217 | _dcopClient = app->dcopClient(); |
217 | _dcopClient->setNotifications(true); | 218 | _dcopClient->setNotifications(true); |
218 | #endif | 219 | #endif |
219 | 220 | ||
220 | } | 221 | } |
221 | 222 | ||
222 | void PwMInit::initKWalletEmu(bool forceDisable, bool forceReload) | 223 | void PwMInit::initKWalletEmu(bool forceDisable, bool forceReload) |
223 | { | 224 | { |
224 | #ifdef CONFIG_KWALLETIF | 225 | #ifdef CONFIG_KWALLETIF |
225 | if (!conf()->confGlobKwalletEmu() || | 226 | if (!conf()->confGlobKwalletEmu() || |
226 | forceDisable) { | 227 | forceDisable) { |
227 | delete_ifnot_null(_kwalletEmu); | 228 | delete_ifnot_null(_kwalletEmu); |
228 | return; | 229 | return; |
229 | } | 230 | } |
230 | try { | 231 | try { |
231 | if (_kwalletEmu && forceReload) | 232 | if (_kwalletEmu && forceReload) |
232 | delete_and_null(_kwalletEmu); | 233 | delete_and_null(_kwalletEmu); |
233 | if (!_kwalletEmu) | 234 | if (!_kwalletEmu) |
234 | _kwalletEmu = new KWalletEmu(this); | 235 | _kwalletEmu = new KWalletEmu(this); |
235 | } catch (PwMException e) { | 236 | } catch (PwMException e) { |
236 | string errMsg("initializing KWallet emulation failed. ID: "); | 237 | string errMsg("initializing KWallet emulation failed. ID: "); |
237 | errMsg += tostr(static_cast<int>(e.getId())); | 238 | errMsg += tostr(static_cast<int>(e.getId())); |
238 | errMsg += " err-message: "; | 239 | errMsg += " err-message: "; |
239 | errMsg += e.getMessage(); | 240 | errMsg += e.getMessage(); |
240 | printWarn(errMsg); | 241 | printWarn(errMsg); |
241 | return; | 242 | return; |
242 | } | 243 | } |
243 | #else // CONFIG_KWALLETIF | 244 | #else // CONFIG_KWALLETIF |
244 | PARAM_UNUSED(forceDisable); | 245 | PARAM_UNUSED(forceDisable); |
245 | PARAM_UNUSED(forceReload); | 246 | PARAM_UNUSED(forceReload); |
246 | #endif // CONFIG_KWALLETIF | 247 | #endif // CONFIG_KWALLETIF |
247 | } | 248 | } |
248 | 249 | ||
249 | void PwMInit::initKeycard() | 250 | void PwMInit::initKeycard() |
250 | { | 251 | { |
251 | #ifdef CONFIG_KEYCARD | 252 | #ifdef CONFIG_KEYCARD |
252 | PWM_ASSERT(!_keycard); | 253 | PWM_ASSERT(!_keycard); |
253 | _keycard = new PwMKeyCard(this); | 254 | _keycard = new PwMKeyCard(this); |
254 | #endif // CONFIG_KEYCARD | 255 | #endif // CONFIG_KEYCARD |
255 | } | 256 | } |
256 | 257 | ||
257 | void PwMInit::initTray() | 258 | void PwMInit::initTray() |
258 | { | 259 | { |
259 | #ifdef PWM_EMBEDDED | 260 | #ifdef PWM_EMBEDDED |
260 | //US ENH : embedded version does not support a tray | 261 | //US ENH : embedded version does not support a tray |
261 | return; | 262 | return; |
262 | #endif | 263 | #endif |
263 | 264 | ||
264 | if (!conf()->confGlobTray()) { | 265 | if (!conf()->confGlobTray()) { |
265 | if (!_tray) | 266 | if (!_tray) |
266 | return; | 267 | return; |
267 | _tray->hide(); | 268 | _tray->hide(); |
268 | delete_and_null(_tray); | 269 | delete_and_null(_tray); |
269 | return; | 270 | return; |
270 | } | 271 | } |
271 | if (_tray) | 272 | if (_tray) |
272 | return; | 273 | return; |
273 | _tray = new PwMTray(this); | 274 | _tray = new PwMTray(this); |
274 | connect(_tray, SIGNAL(quitSelected()), | 275 | connect(_tray, SIGNAL(quitSelected()), |
275 | this, SLOT(removeTrayAndQuit())); | 276 | this, SLOT(removeTrayAndQuit())); |
276 | connect(_tray, SIGNAL(closed(PwMTray *)), | 277 | connect(_tray, SIGNAL(closed(PwMTray *)), |
277 | this, SLOT(trayIconClosed(PwMTray *))); | 278 | this, SLOT(trayIconClosed(PwMTray *))); |
278 | KIconLoader icons; | 279 | KIconLoader icons; |
279 | #ifndef PWM_EMBEDDED | 280 | #ifndef PWM_EMBEDDED |
280 | _tray->setPixmap(icons.loadIcon(PACKAGE_NAME, KIcon::Small)); | 281 | _tray->setPixmap(icons.loadIcon(PACKAGE_NAME, KIcon::Small)); |
281 | #endif | 282 | #endif |
282 | _tray->show(); | 283 | _tray->show(); |
283 | // connect the signals of all open documents. | 284 | // connect the signals of all open documents. |
284 | const vector<PwMDocList::listItem> *dl = PwMDoc::getOpenDocList()->getList(); | 285 | const vector<PwMDocList::listItem> *dl = PwMDoc::getOpenDocList()->getList(); |
285 | vector<PwMDocList::listItem>::const_iterator i = dl->begin(), | 286 | vector<PwMDocList::listItem>::const_iterator i = dl->begin(), |
286 | end = dl->end(); | 287 | end = dl->end(); |
287 | while (i != end) { | 288 | while (i != end) { |