summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwminit.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/pwmanager/pwmanager/pwminit.cpp b/pwmanager/pwmanager/pwminit.cpp
index b0a78c2..2f1aa4e 100644
--- a/pwmanager/pwmanager/pwminit.cpp
+++ b/pwmanager/pwmanager/pwminit.cpp
@@ -88,194 +88,192 @@ PwMInit::~PwMInit()
88 QValueList<PwM *>::iterator i = _mainWndList.begin(), 88 QValueList<PwM *>::iterator i = _mainWndList.begin(),
89 end = _mainWndList.end(); 89 end = _mainWndList.end();
90 90
91#else 91#else
92 // close all open mainwnds 92 // close all open mainwnds
93 QValueList<PwM *>::Iterator i = _mainWndList.begin(), 93 QValueList<PwM *>::Iterator i = _mainWndList.begin(),
94 end = _mainWndList.end(); 94 end = _mainWndList.end();
95#endif 95#endif
96 while (i != end) { 96 while (i != end) {
97 disconnect(*i, SIGNAL(closed(PwM *)), 97 disconnect(*i, SIGNAL(closed(PwM *)),
98 this, SLOT(mainWndClosed(PwM *))); 98 this, SLOT(mainWndClosed(PwM *)));
99 delete *i; 99 delete *i;
100 ++i; 100 ++i;
101 } 101 }
102 _mainWndList.clear(); 102 _mainWndList.clear();
103 // close all remaining open documents 103 // close all remaining open documents
104 PwMDocList *_dl = PwMDoc::getOpenDocList(); 104 PwMDocList *_dl = PwMDoc::getOpenDocList();
105 vector<PwMDocList::listItem> dl = *(_dl->getList()); 105 vector<PwMDocList::listItem> dl = *(_dl->getList());
106 vector<PwMDocList::listItem>::iterator i2 = dl.begin(), 106 vector<PwMDocList::listItem>::iterator i2 = dl.begin(),
107 end2 = dl.end(); 107 end2 = dl.end();
108 while (i2 != end2) { 108 while (i2 != end2) {
109 delete (*i2).doc; 109 delete (*i2).doc;
110 ++i2; 110 ++i2;
111 } 111 }
112 112
113#ifdef CONFIG_KWALLETIF 113#ifdef CONFIG_KWALLETIF
114 delete_ifnot_null(_kwalletEmu); 114 delete_ifnot_null(_kwalletEmu);
115#endif // CONFIG_KWALLETIF 115#endif // CONFIG_KWALLETIF
116#ifdef CONFIG_KEYCARD 116#ifdef CONFIG_KEYCARD
117 delete_ifnot_null(_keycard); 117 delete_ifnot_null(_keycard);
118#endif // CONFIG_KEYCARD 118#endif // CONFIG_KEYCARD
119 delete_ifnot_null(_tray); 119 delete_ifnot_null(_tray);
120 120
121 Randomizer::cleanup(); 121 Randomizer::cleanup();
122 Configuration::cleanup(); 122 Configuration::cleanup();
123} 123}
124 124
125void PwMInit::initializeApp() 125void PwMInit::initializeApp()
126{ 126{
127 PWM_ASSERT(runStatus == unknown); 127 PWM_ASSERT(runStatus == unknown);
128 runStatus = init; 128 runStatus = init;
129 initPosixSignalHandler(); 129 initPosixSignalHandler();
130 Randomizer::init(); 130 Randomizer::init();
131 Configuration::init(); 131 Configuration::init();
132 initDCOP(); 132 initDCOP();
133 initKWalletEmu(); 133 initKWalletEmu();
134 initKeycard(); 134 initKeycard();
135 initTray(); 135 initTray();
136 handleCmdLineArgs(); 136 handleCmdLineArgs();
137 137
138 bool openDeeplocked = false; 138 bool openDeeplocked = false;
139 if (conf()->confGlobAutostartDeepLocked() || 139 if (conf()->confGlobAutostartDeepLocked() ||
140 savedCmd.open_deeplocked) 140 savedCmd.open_deeplocked)
141 openDeeplocked = true; 141 openDeeplocked = true;
142 if (conf()->confWndAutoMinimizeOnStart() || 142 if (conf()->confWndAutoMinimizeOnStart() ||
143 savedCmd.minToTray) { 143 savedCmd.minToTray) {
144 PwMDoc *newDoc = createDoc(); 144 PwMDoc *newDoc = createDoc();
145 if (!newDoc->openDocUi(newDoc, 145 if (!newDoc->openDocUi(newDoc,
146 conf()->confGlobAutoStart(), 146 conf()->confGlobAutoStart(),
147 openDeeplocked)) { 147 openDeeplocked)) {
148 delete newDoc; 148 delete newDoc;
149 } 149 }
150 } else { 150 } else {
151 createMainWnd(conf()->confGlobAutoStart(), 151 createMainWnd(conf()->confGlobAutoStart(),
152 openDeeplocked, 152 openDeeplocked,
153 true, 153 true,
154 0, 154 0,
155 savedCmd.minimized); 155 savedCmd.minimized);
156 } 156 }
157 157
158 runStatus = running; 158 runStatus = running;
159} 159}
160 160
161void PwMInit::shutdownApp(int exitStatus) 161void PwMInit::shutdownApp(int exitStatus)
162{ 162{
163 printDebug(string("PwMInit::shutdownApp(") 163 printDebug(string("PwMInit::shutdownApp(")
164 + tostr(exitStatus) + ") called."); 164 + tostr(exitStatus) + ") called.");
165 PWM_ASSERT((runStatus == running) || (runStatus == init)); 165 PWM_ASSERT((runStatus == running) || (runStatus == init));
166 runStatus = shutdown; 166 runStatus = shutdown;
167 QApplication::exit(exitStatus); 167 QApplication::exit(exitStatus);
168 /* The destructor of PwMInit is called when control 168 /* The destructor of PwMInit is called when control
169 * leaves main() 169 * leaves main()
170 */ 170 */
171} 171}
172 172
173void PwMInit::initPosixSignalHandler() 173void PwMInit::initPosixSignalHandler()
174{ 174{
175 signal(SIGINT, sig_handler); 175 signal(SIGINT, sig_handler);
176 signal(SIGTERM, sig_handler); 176 signal(SIGTERM, sig_handler);
177} 177}
178 178
179void PwMInit::initDCOP() 179void PwMInit::initDCOP()
180{ 180{
181#ifndef PWM_EMBEDDED 181#ifndef PWM_EMBEDDED
182 _dcopClient = app->dcopClient(); 182 _dcopClient = app->dcopClient();
183 _dcopClient->setNotifications(true); 183 _dcopClient->setNotifications(true);
184#else
185 qDebug("PwMInit::initDCOP() has to be implemented");
186#endif 184#endif
187 185
188} 186}
189 187
190void PwMInit::initKWalletEmu(bool forceDisable, bool forceReload) 188void PwMInit::initKWalletEmu(bool forceDisable, bool forceReload)
191{ 189{
192#ifdef CONFIG_KWALLETIF 190#ifdef CONFIG_KWALLETIF
193 if (!conf()->confGlobKwalletEmu() || 191 if (!conf()->confGlobKwalletEmu() ||
194 forceDisable) { 192 forceDisable) {
195 delete_ifnot_null(_kwalletEmu); 193 delete_ifnot_null(_kwalletEmu);
196 return; 194 return;
197 } 195 }
198 try { 196 try {
199 if (_kwalletEmu && forceReload) 197 if (_kwalletEmu && forceReload)
200 delete_and_null(_kwalletEmu); 198 delete_and_null(_kwalletEmu);
201 if (!_kwalletEmu) 199 if (!_kwalletEmu)
202 _kwalletEmu = new KWalletEmu(this); 200 _kwalletEmu = new KWalletEmu(this);
203 } catch (PwMException e) { 201 } catch (PwMException e) {
204 string errMsg("initializing KWallet emulation failed. ID: "); 202 string errMsg("initializing KWallet emulation failed. ID: ");
205 errMsg += tostr(static_cast<int>(e.getId())); 203 errMsg += tostr(static_cast<int>(e.getId()));
206 errMsg += " err-message: "; 204 errMsg += " err-message: ";
207 errMsg += e.getMessage(); 205 errMsg += e.getMessage();
208 printWarn(errMsg); 206 printWarn(errMsg);
209 return; 207 return;
210 } 208 }
211#else // CONFIG_KWALLETIF 209#else // CONFIG_KWALLETIF
212 PARAM_UNUSED(forceDisable); 210 PARAM_UNUSED(forceDisable);
213 PARAM_UNUSED(forceReload); 211 PARAM_UNUSED(forceReload);
214#endif // CONFIG_KWALLETIF 212#endif // CONFIG_KWALLETIF
215} 213}
216 214
217void PwMInit::initKeycard() 215void PwMInit::initKeycard()
218{ 216{
219#ifdef CONFIG_KEYCARD 217#ifdef CONFIG_KEYCARD
220 PWM_ASSERT(!_keycard); 218 PWM_ASSERT(!_keycard);
221 _keycard = new PwMKeyCard(this); 219 _keycard = new PwMKeyCard(this);
222#endif // CONFIG_KEYCARD 220#endif // CONFIG_KEYCARD
223} 221}
224 222
225void PwMInit::initTray() 223void PwMInit::initTray()
226{ 224{
227#ifdef PWM_EMBEDDED 225#ifdef PWM_EMBEDDED
228 //US ENH : embedded version does not support a tray 226 //US ENH : embedded version does not support a tray
229 return; 227 return;
230#endif 228#endif
231 229
232 if (!conf()->confGlobTray()) { 230 if (!conf()->confGlobTray()) {
233 if (!_tray) 231 if (!_tray)
234 return; 232 return;
235 _tray->hide(); 233 _tray->hide();
236 delete_and_null(_tray); 234 delete_and_null(_tray);
237 return; 235 return;
238 } 236 }
239 if (_tray) 237 if (_tray)
240 return; 238 return;
241 _tray = new PwMTray(this); 239 _tray = new PwMTray(this);
242 connect(_tray, SIGNAL(quitSelected()), 240 connect(_tray, SIGNAL(quitSelected()),
243 this, SLOT(removeTrayAndQuit())); 241 this, SLOT(removeTrayAndQuit()));
244 connect(_tray, SIGNAL(closed(PwMTray *)), 242 connect(_tray, SIGNAL(closed(PwMTray *)),
245 this, SLOT(trayIconClosed(PwMTray *))); 243 this, SLOT(trayIconClosed(PwMTray *)));
246 KIconLoader icons; 244 KIconLoader icons;
247#ifndef PWM_EMBEDDED 245#ifndef PWM_EMBEDDED
248 _tray->setPixmap(icons.loadIcon(PACKAGE_NAME, KIcon::Small)); 246 _tray->setPixmap(icons.loadIcon(PACKAGE_NAME, KIcon::Small));
249#endif 247#endif
250 _tray->show(); 248 _tray->show();
251 // connect the signals of all open documents. 249 // connect the signals of all open documents.
252 const vector<PwMDocList::listItem> *dl = PwMDoc::getOpenDocList()->getList(); 250 const vector<PwMDocList::listItem> *dl = PwMDoc::getOpenDocList()->getList();
253 vector<PwMDocList::listItem>::const_iterator i = dl->begin(), 251 vector<PwMDocList::listItem>::const_iterator i = dl->begin(),
254 end = dl->end(); 252 end = dl->end();
255 while (i != end) { 253 while (i != end) {
256 _tray->connectDocToTray((*i).doc); 254 _tray->connectDocToTray((*i).doc);
257 ++i; 255 ++i;
258 } 256 }
259} 257}
260 258
261void PwMInit::removeTrayAndQuit() 259void PwMInit::removeTrayAndQuit()
262{ 260{
263 PWM_ASSERT(_tray); 261 PWM_ASSERT(_tray);
264 // _tray is deleted in ~PwMInit 262 // _tray is deleted in ~PwMInit
265 shutdownApp(0); 263 shutdownApp(0);
266} 264}
267 265
268PwM * PwMInit::createMainWnd(const QString &loadFile, 266PwM * PwMInit::createMainWnd(const QString &loadFile,
269 bool loadFileDeepLocked, 267 bool loadFileDeepLocked,
270 bool virginity, 268 bool virginity,
271 PwMDoc *doc, 269 PwMDoc *doc,
272 bool minimized) 270 bool minimized)
273{ 271{
274 PwM *newWnd; 272 PwM *newWnd;
275 if (!doc) 273 if (!doc)
276 doc = createDoc(); 274 doc = createDoc();
277 newWnd = new PwM(this, doc, virginity); 275 newWnd = new PwM(this, doc, virginity);
278#ifndef PWM_EMBEDDED 276#ifndef PWM_EMBEDDED
279 _mainWndList.push_back(newWnd); 277 _mainWndList.push_back(newWnd);
280#else 278#else
281 _mainWndList.append(newWnd); 279 _mainWndList.append(newWnd);