summaryrefslogtreecommitdiffabout
path: root/pwmanager
Unidiff
Diffstat (limited to 'pwmanager') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/getmasterpwwnd_emb.cpp2
-rw-r--r--pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp4
-rw-r--r--pwmanager/pwmanager/libgcryptif.cpp5
-rw-r--r--pwmanager/pwmanager/main.cpp1
-rw-r--r--pwmanager/pwmanager/pwm.cpp10
-rw-r--r--pwmanager/pwmanager/pwmdoc.cpp1
-rw-r--r--pwmanager/pwmanager/pwmdocui.cpp15
-rw-r--r--pwmanager/pwmanager/pwminit.cpp17
8 files changed, 40 insertions, 15 deletions
diff --git a/pwmanager/pwmanager/getmasterpwwnd_emb.cpp b/pwmanager/pwmanager/getmasterpwwnd_emb.cpp
index 8404c3e..678f05f 100644
--- a/pwmanager/pwmanager/getmasterpwwnd_emb.cpp
+++ b/pwmanager/pwmanager/getmasterpwwnd_emb.cpp
@@ -117,25 +117,25 @@ getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name)
117 connect( p1, SIGNAL( clicked() ), this, SLOT( add1() ) ); 117 connect( p1, SIGNAL( clicked() ), this, SLOT( add1() ) );
118 connect( p2, SIGNAL( clicked() ), this, SLOT( add2() ) ); 118 connect( p2, SIGNAL( clicked() ), this, SLOT( add2() ) );
119 connect( p3, SIGNAL( clicked() ), this, SLOT( add3() ) ); 119 connect( p3, SIGNAL( clicked() ), this, SLOT( add3() ) );
120 connect( p4, SIGNAL( clicked() ), this, SLOT( add4() ) ); 120 connect( p4, SIGNAL( clicked() ), this, SLOT( add4() ) );
121 connect( p5, SIGNAL( clicked() ), this, SLOT( add5() ) ); 121 connect( p5, SIGNAL( clicked() ), this, SLOT( add5() ) );
122 connect( p6, SIGNAL( clicked() ), this, SLOT( add6() ) ); 122 connect( p6, SIGNAL( clicked() ), this, SLOT( add6() ) );
123 connect( p7, SIGNAL( clicked() ), this, SLOT( add7() ) ); 123 connect( p7, SIGNAL( clicked() ), this, SLOT( add7() ) );
124 connect( p8, SIGNAL( clicked() ), this, SLOT( add8() ) ); 124 connect( p8, SIGNAL( clicked() ), this, SLOT( add8() ) );
125 connect( p9, SIGNAL( clicked() ), this, SLOT( add9() ) ); 125 connect( p9, SIGNAL( clicked() ), this, SLOT( add9() ) );
126 connect( backspace, SIGNAL( clicked() ), this, SLOT( backspace() ) ); 126 connect( backspace, SIGNAL( clicked() ), this, SLOT( backspace() ) );
127 connect( clear, SIGNAL( clicked() ), this, SLOT( clear() ) ); 127 connect( clear, SIGNAL( clicked() ), this, SLOT( clear() ) );
128 128
129 129 pwLineEdit->setFocus();
130 130
131} 131}
132 132
133/* 133/*
134 * Destroys the object and frees any allocated resources 134 * Destroys the object and frees any allocated resources
135 */ 135 */
136getMasterPwWnd::~getMasterPwWnd() 136getMasterPwWnd::~getMasterPwWnd()
137{ 137{
138 // no need to delete child widgets, Qt does it all for us 138 // no need to delete child widgets, Qt does it all for us
139} 139}
140 140
141void getMasterPwWnd::okButton_slot() 141void getMasterPwWnd::okButton_slot()
diff --git a/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp b/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp
index 26b9708..a8696ea 100644
--- a/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp
+++ b/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp
@@ -139,31 +139,31 @@ PWMConfigWidget::PWMConfigWidget(PWMPrefs *prefs, QWidget *parent, const char *n
139 139
140 KPrefsWidBool *sb = addWidBool(i18n("Make backup before saving"), 140 KPrefsWidBool *sb = addWidBool(i18n("Make backup before saving"),
141 &(prefs->mMakeFileBackup),filePage); 141 &(prefs->mMakeFileBackup),filePage);
142 fileLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); 142 fileLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1);
143 ++i; 143 ++i;
144 144
145 // Timeout page 145 // Timeout page
146 ////////////////////////////////////////////////////// 146 //////////////////////////////////////////////////////
147 QWidget *timeoutPage = new QWidget( this ); 147 QWidget *timeoutPage = new QWidget( this );
148 QGridLayout *timeoutLayout = new QGridLayout( timeoutPage, 3, 2); 148 QGridLayout *timeoutLayout = new QGridLayout( timeoutPage, 3, 2);
149 149
150 i = 0; 150 i = 0;
151 pwTimeoutSpinBox = new QSpinBox( timeoutPage, "pwTimeoutSpinBox" ); 151 pwTimeoutSpinBox = new QSpinBox( 0,600,10,timeoutPage, "pwTimeoutSpinBox" );
152 QLabel* timeoutLabel = new QLabel(pwTimeoutSpinBox, i18n("Password timeout\n(timeout to hold password in\nmemory,so you don't have to\nre-enter it,if you\nalready have entered it)\n[set to 0 to disable]:"), timeoutPage); 152 QLabel* timeoutLabel = new QLabel(pwTimeoutSpinBox, i18n("Password timeout\n(timeout to hold password in\nmemory,so you don't have to\nre-enter it,if you\nalready have entered it)\n[set to 0 to disable]:"), timeoutPage);
153 timeoutLayout->addMultiCellWidget(timeoutLabel,i, i, 0 ,0); 153 timeoutLayout->addMultiCellWidget(timeoutLabel,i, i, 0 ,0);
154 timeoutLayout->addWidget(pwTimeoutSpinBox,i,1); 154 timeoutLayout->addWidget(pwTimeoutSpinBox,i,1);
155 ++i; 155 ++i;
156 156
157 lockTimeoutSpinBox = new QSpinBox( timeoutPage, "lockTimeoutSpinBox" ); 157 lockTimeoutSpinBox = new QSpinBox( 0,600,10,timeoutPage, "lockTimeoutSpinBox" );
158 QLabel* lockTimeoutLabel = new QLabel(lockTimeoutSpinBox, i18n("Auto-lock timeout\n(auto lock document after this\namount of seconds)\n[set to 0 to disable]:"), timeoutPage); 158 QLabel* lockTimeoutLabel = new QLabel(lockTimeoutSpinBox, i18n("Auto-lock timeout\n(auto lock document after this\namount of seconds)\n[set to 0 to disable]:"), timeoutPage);
159 timeoutLayout->addMultiCellWidget(lockTimeoutLabel,i, i, 0 ,0); 159 timeoutLayout->addMultiCellWidget(lockTimeoutLabel,i, i, 0 ,0);
160 timeoutLayout->addWidget(lockTimeoutSpinBox,i,1); 160 timeoutLayout->addWidget(lockTimeoutSpinBox,i,1);
161 ++i; 161 ++i;
162 162
163 sb = addWidBool(i18n("deep-lock on autolock"), 163 sb = addWidBool(i18n("deep-lock on autolock"),
164 &(prefs->mAutoDeeplock),timeoutPage); 164 &(prefs->mAutoDeeplock),timeoutPage);
165 timeoutLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); 165 timeoutLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1);
166 ++i; 166 ++i;
167 167
168 168
169 // Autostart page 169 // Autostart page
diff --git a/pwmanager/pwmanager/libgcryptif.cpp b/pwmanager/pwmanager/libgcryptif.cpp
index eafd318..ff94bf6 100644
--- a/pwmanager/pwmanager/libgcryptif.cpp
+++ b/pwmanager/pwmanager/libgcryptif.cpp
@@ -430,20 +430,25 @@ void LibGCryptIf::padData(unsigned char *buf,
430 *b = c; 430 *b = c;
431 ++i; 431 ++i;
432 } 432 }
433} 433}
434 434
435void LibGCryptIf::unpadData(const unsigned char *buf, 435void LibGCryptIf::unpadData(const unsigned char *buf,
436 size_t *bufLen) 436 size_t *bufLen)
437{ 437{
438 size_t pos; 438 size_t pos;
439 BUG_ON(*bufLen % 8); 439 BUG_ON(*bufLen % 8);
440 pos = *bufLen - 1; 440 pos = *bufLen - 1;
441 while (buf[pos] != static_cast<char>(0x01)) { 441 while (buf[pos] != static_cast<char>(0x01)) {
442 qDebug("pos %d %d %d", pos, buf[pos], static_cast<char>(0x01) );
442 BUG_ON(!pos); 443 BUG_ON(!pos);
444 //LR BUG we should terminte the loop if p == 0
445 if ( pos == 0 )
446 break;
443 --pos; 447 --pos;
444 } 448 }
445 *bufLen = pos; 449 *bufLen = pos;
450 qDebug("ente ");
446} 451}
447 452
448#endif // CONFIG_PWMANAGER_GCRY 453#endif // CONFIG_PWMANAGER_GCRY
449 454
diff --git a/pwmanager/pwmanager/main.cpp b/pwmanager/pwmanager/main.cpp
index 1ca7ba8..70df15d 100644
--- a/pwmanager/pwmanager/main.cpp
+++ b/pwmanager/pwmanager/main.cpp
@@ -200,20 +200,21 @@ int main(int argc, char *argv[])
200 //US KAddressBookMain m ; 200 //US KAddressBookMain m ;
201 201
202 //US QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 202 //US QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
203 /*US 203 /*US
204#ifndef DESKTOP_VERSION 204#ifndef DESKTOP_VERSION
205 a.showMainWidget( &m ); 205 a.showMainWidget( &m );
206#else 206#else
207 a.setMainWidget( &m ); 207 a.setMainWidget( &m );
208 m.resize (640, 480 ); 208 m.resize (640, 480 );
209 m.show(); 209 m.show();
210#endif 210#endif
211 */ 211 */
212 QObject::connect( &a, SIGNAL( lastWindowClosed()), &a, SLOT (quit()));
212 a.exec(); 213 a.exec();
213 KPimGlobalPrefs::instance()->writeConfig(); 214 KPimGlobalPrefs::instance()->writeConfig();
214 } 215 }
215 qDebug("PWMPI: Bye! "); 216 qDebug("PWMPI: Bye! ");
216 217
217#endif 218#endif
218 219
219} 220}
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp
index 1ab2b71..2b8f2fa 100644
--- a/pwmanager/pwmanager/pwm.cpp
+++ b/pwmanager/pwmanager/pwm.cpp
@@ -184,29 +184,31 @@ PwM::PwM(PwMInit *_init, PwMDoc *doc,
184 setFocusPolicy(QWidget::WheelFocus); 184 setFocusPolicy(QWidget::WheelFocus);
185#ifndef PWM_EMBEDDED 185#ifndef PWM_EMBEDDED
186 statusBar()->show(); 186 statusBar()->show();
187#endif 187#endif
188 view = makeNewListView(doc); 188 view = makeNewListView(doc);
189 setCentralWidget(view); 189 setCentralWidget(view);
190 updateCaption(); 190 updateCaption();
191 showStatMsg(i18n("Ready.")); 191 showStatMsg(i18n("Ready."));
192} 192}
193 193
194PwM::~PwM() 194PwM::~PwM()
195{ 195{
196 //qDebug("PwM::~PwM()"); 196 qDebug("PwM::~PwM() %x", this);
197 disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)), 197 disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)),
198 this, SLOT(docClosed(PwMDoc *))); 198 this, SLOT(docClosed(PwMDoc *)));
199 conf()->confWndMainWndSize(size()); 199 conf()->confWndMainWndSize(size());
200 emit closed(this); 200 //LR closing of windows changed
201 //needed for fastload option on PDA
202 //emit closed(this);
201 //qDebug("PwM::~PwM() emited closed(this)"); 203 //qDebug("PwM::~PwM() emited closed(this)");
202 delete view; 204 delete view;
203 delete syncManager; 205 delete syncManager;
204} 206}
205 207
206void PwM::initMenubar() 208void PwM::initMenubar()
207{ 209{
208 KIconLoader* picons; 210 KIconLoader* picons;
209#ifndef PWM_EMBEDDED 211#ifndef PWM_EMBEDDED
210 KIconLoader icons; 212 KIconLoader icons;
211 picons = &icons; 213 picons = &icons;
212#else 214#else
@@ -878,29 +880,33 @@ void PwM::config_slot()
878 pwm->curView()->setFont(conf()->confGlobEntryFont()); 880 pwm->curView()->setFont(conf()->confGlobEntryFont());
879 ++i2; 881 ++i2;
880 } 882 }
881} 883}
882 884
883void PwM::activateMpButton(bool activate) 885void PwM::activateMpButton(bool activate)
884{ 886{
885 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, activate); 887 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, activate);
886} 888}
887 889
888void PwM::closeEvent(QCloseEvent *e) 890void PwM::closeEvent(QCloseEvent *e)
889{ 891{
892 qDebug("PwM::closeEvent ");
893 emit closed( this );
894 return;
890 e->accept(); 895 e->accept();
891} 896}
892 897
893void PwM::docClosed(PwMDoc *doc) 898void PwM::docClosed(PwMDoc *doc)
894{ 899{
900 qDebug("PwM::docClosed ");
895 PARAM_UNUSED(doc); 901 PARAM_UNUSED(doc);
896 PWM_ASSERT(doc == curDoc()); 902 PWM_ASSERT(doc == curDoc());
897 close(); 903 close();
898} 904}
899 905
900void PwM::find_slot() 906void PwM::find_slot()
901{ 907{
902 PWM_ASSERT(curDoc()); 908 PWM_ASSERT(curDoc());
903 if (curDoc()->isDocEmpty()) 909 if (curDoc()->isDocEmpty())
904 return; 910 return;
905 if (curDoc()->isDeepLocked()) 911 if (curDoc()->isDeepLocked())
906 return; 912 return;
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp
index 129bf7b..cf8690f 100644
--- a/pwmanager/pwmanager/pwmdoc.cpp
+++ b/pwmanager/pwmanager/pwmdoc.cpp
@@ -2968,24 +2968,25 @@ QString PwMDoc::getTitle()
2968 unnamedNum = PwMDocList::getNewUnnamedNumber(); 2968 unnamedNum = PwMDocList::getNewUnnamedNumber();
2969 PWM_ASSERT(unnamedNum != 0); 2969 PWM_ASSERT(unnamedNum != 0);
2970 } 2970 }
2971 title = DEFAULT_TITLE; 2971 title = DEFAULT_TITLE;
2972 title += " "; 2972 title += " ";
2973 title += tostr(unnamedNum).c_str(); 2973 title += tostr(unnamedNum).c_str();
2974 } 2974 }
2975 return title; 2975 return title;
2976} 2976}
2977 2977
2978bool PwMDoc::tryDelete() 2978bool PwMDoc::tryDelete()
2979{ 2979{
2980
2980 if (deleted) 2981 if (deleted)
2981 return true; 2982 return true;
2982 int ret; 2983 int ret;
2983 if (isDirty()) { 2984 if (isDirty()) {
2984 ret = dirtyAskSave(getTitle()); 2985 ret = dirtyAskSave(getTitle());
2985 if (ret == 0) { // save to disk 2986 if (ret == 0) { // save to disk
2986 if (!saveDocUi(this)) 2987 if (!saveDocUi(this))
2987 goto out_ignore; 2988 goto out_ignore;
2988 } else if (ret == 1) { // don't save and delete 2989 } else if (ret == 1) { // don't save and delete
2989 goto out_accept; 2990 goto out_accept;
2990 } else { // cancel operation 2991 } else { // cancel operation
2991 goto out_ignore; 2992 goto out_ignore;
diff --git a/pwmanager/pwmanager/pwmdocui.cpp b/pwmanager/pwmanager/pwmdocui.cpp
index 71b4a8d..a9916c2 100644
--- a/pwmanager/pwmanager/pwmdocui.cpp
+++ b/pwmanager/pwmanager/pwmdocui.cpp
@@ -195,51 +195,54 @@ void PwMDocUi::cantDeeplock_notSavedMsgBox()
195 i18n("Can't deep-lock, because the document\n" 195 i18n("Can't deep-lock, because the document\n"
196 "hasn't been saved, yet. Please save\n" 196 "hasn't been saved, yet. Please save\n"
197 "to a file and try again."), 197 "to a file and try again."),
198 i18n("not saved, yet")); 198 i18n("not saved, yet"));
199} 199}
200 200
201void PwMDocUi::gpmPwLenErrMsgBox() 201void PwMDocUi::gpmPwLenErrMsgBox()
202{ 202{
203 KMessageBox::error(currentView, 203 KMessageBox::error(currentView,
204 i18n("GPasman does not support passwords\n" 204 i18n("GPasman does not support passwords\n"
205 "shorter than 4 characters! Please try\n" 205 "shorter than 4 characters! Please try\n"
206 "again with a longer password."), 206 "again with a longer password."),
207 i18n("password too short")); 207 i18n("Password too short"));
208} 208}
209 209
210int PwMDocUi::dirtyAskSave(const QString &docTitle) 210int PwMDocUi::dirtyAskSave(const QString &docTitle)
211{ 211{
212 int ret; 212 int ret;
213#ifndef PWM_EMBEDDED 213#ifndef PWM_EMBEDDED
214 ret = KMessageBox::questionYesNoCancel(currentView, 214 ret = KMessageBox::questionYesNoCancel(currentView,
215 i18n("The list \"") + 215 i18n("The list\n\"") +
216 docTitle + 216 docTitle +
217 i18n 217 i18n
218 ("\" has been modified.\n" 218 ("\" has been modified.\n"
219 "Do you want to save it?"), 219 "Do you want to save it?"),
220 i18n("save?")); 220 i18n("Save?"));
221 if (ret == KMessageBox::Yes) { 221 if (ret == KMessageBox::Yes) {
222 return 0; 222 return 0;
223 } else if (ret == KMessageBox::No) { 223 } else if (ret == KMessageBox::No) {
224 return 1; 224 return 1;
225 } 225 }
226#else 226#else
227 QString doc = docTitle;
228 if ( doc.length() > 33 )
229 doc = "..." + doc.right(30);
227 ret = KMessageBox::warningYesNoCancel(currentView, 230 ret = KMessageBox::warningYesNoCancel(currentView,
228 i18n("The list \"") + 231 i18n("The list\n \"") +
229 docTitle + 232 doc +
230 i18n 233 i18n
231 ("\"\nhas been modified.\n" 234 ("\"\nhas been modified.\n"
232 "Do you want to save it?"), 235 "Do you want to save it?"),
233 i18n("save?")); 236 i18n("Save?"));
234 if (ret == KMessageBox::Yes) { 237 if (ret == KMessageBox::Yes) {
235 return 0; 238 return 0;
236 } else if (ret == KMessageBox::No) { 239 } else if (ret == KMessageBox::No) {
237 return 1; 240 return 1;
238 } 241 }
239 242
240#endif 243#endif
241 244
242 // cancel 245 // cancel
243 return -1; 246 return -1;
244} 247}
245 248
diff --git a/pwmanager/pwmanager/pwminit.cpp b/pwmanager/pwmanager/pwminit.cpp
index d775aa9..fbd17a7 100644
--- a/pwmanager/pwmanager/pwminit.cpp
+++ b/pwmanager/pwmanager/pwminit.cpp
@@ -79,24 +79,25 @@ PwMInit::PwMInit(PwMApplication *_app)
79 , _curWidget (0) 79 , _curWidget (0)
80 , _dcopClient (0) 80 , _dcopClient (0)
81 , _kwalletEmu (0) 81 , _kwalletEmu (0)
82 , _keycard (0) 82 , _keycard (0)
83 , _tray (0) 83 , _tray (0)
84{ 84{
85 sig_init_pointer = this; 85 sig_init_pointer = this;
86 app = _app; 86 app = _app;
87} 87}
88 88
89PwMInit::~PwMInit() 89PwMInit::~PwMInit()
90{ 90{
91 qDebug("PwMInit::~PwMInit() ");
91#ifndef PWM_EMBEDDED 92#ifndef PWM_EMBEDDED
92 SelfTest::cancel(); 93 SelfTest::cancel();
93 // close all open mainwnds 94 // close all open mainwnds
94 QValueList<PwM *>::iterator i = _mainWndList.begin(), 95 QValueList<PwM *>::iterator i = _mainWndList.begin(),
95 end = _mainWndList.end(); 96 end = _mainWndList.end();
96 97
97#else 98#else
98 // close all open mainwnds 99 // close all open mainwnds
99 QValueList<PwM *>::Iterator i = _mainWndList.begin(), 100 QValueList<PwM *>::Iterator i = _mainWndList.begin(),
100 end = _mainWndList.end(); 101 end = _mainWndList.end();
101#endif 102#endif
102 while (i != end) { 103 while (i != end) {
@@ -170,25 +171,24 @@ void PwMInit::initializeApp()
170 171
171 172
172 173
173 174
174 //} 175 //}
175 } else { 176 } else {
176 createMainWnd(conf()->confGlobAutoStart(), 177 createMainWnd(conf()->confGlobAutoStart(),
177 openDeeplocked, 178 openDeeplocked,
178 true, 179 true,
179 0, 180 0,
180 savedCmd.minimized); 181 savedCmd.minimized);
181 } 182 }
182
183 runStatus = running; 183 runStatus = running;
184} 184}
185 185
186void PwMInit::shutdownApp(int exitStatus) 186void PwMInit::shutdownApp(int exitStatus)
187{ 187{
188 printDebug(string("PwMInit::shutdownApp(") 188 printDebug(string("PwMInit::shutdownApp(")
189 + tostr(exitStatus) + ") called."); 189 + tostr(exitStatus) + ") called.");
190 PWM_ASSERT((runStatus == running) || (runStatus == init)); 190 PWM_ASSERT((runStatus == running) || (runStatus == init));
191 runStatus = shutdown; 191 runStatus = shutdown;
192 QApplication::exit(exitStatus); 192 QApplication::exit(exitStatus);
193 /* The destructor of PwMInit is called when control 193 /* The destructor of PwMInit is called when control
194 * leaves main() 194 * leaves main()
@@ -313,28 +313,26 @@ PwM * PwMInit::createMainWnd(const QString &loadFile,
313 //US ENH 313 //US ENH
314#ifndef PWM_EMBEDDED 314#ifndef PWM_EMBEDDED
315 if (minimized) 315 if (minimized)
316 newWnd->showMinimized(); 316 newWnd->showMinimized();
317 else 317 else
318 newWnd->show(); 318 newWnd->show();
319 319
320#else //PWM_EMBEDDED 320#else //PWM_EMBEDDED
321 321
322#ifndef DESKTOP_VERSION 322#ifndef DESKTOP_VERSION
323 app->showMainWidget( newWnd ); 323 app->showMainWidget( newWnd );
324#else //DESKTOP_VERSION 324#else //DESKTOP_VERSION
325 app->setMainWidget( newWnd );
326 newWnd->resize (640, 480 ); 325 newWnd->resize (640, 480 );
327 newWnd->show(); 326 newWnd->show();
328 qDebug("show ");
329#endif //DESKTOP_VERSION 327#endif //DESKTOP_VERSION
330 328
331#endif //PWM_EMBEDDED 329#endif //PWM_EMBEDDED
332 330
333 if (loadFile != QString::null && 331 if (loadFile != QString::null &&
334 loadFile != "") { 332 loadFile != "") {
335 newWnd->openDoc(loadFile, loadFileDeepLocked); 333 newWnd->openDoc(loadFile, loadFileDeepLocked);
336 } 334 }
337 return newWnd; 335 return newWnd;
338} 336}
339 337
340PwMDoc * PwMInit::createDoc() 338PwMDoc * PwMInit::createDoc()
@@ -382,64 +380,75 @@ again:
382 !wnd->isForceQuit() && 380 !wnd->isForceQuit() &&
383 !wnd->curDoc()->isDeleted()) { 381 !wnd->curDoc()->isDeleted()) {
384 if (conf()->confWndClose()) 382 if (conf()->confWndClose())
385 doDeleteDoc = true; 383 doDeleteDoc = true;
386 else 384 else
387 doMinimizeToTray = true; 385 doMinimizeToTray = true;
388 } else { 386 } else {
389 doDeleteDoc = true; 387 doDeleteDoc = true;
390 } 388 }
391 } 389 }
392 390
393 if (doMinimizeToTray) { 391 if (doMinimizeToTray) {
394 392 qDebug("doMinimizeToTray ");
395 PWM_ASSERT(_tray); 393 PWM_ASSERT(_tray);
396 int mmlock = conf()->confGlobMinimizeLock(); 394 int mmlock = conf()->confGlobMinimizeLock();
397 switch (mmlock) { 395 switch (mmlock) {
398 case 0: // don't lock anything 396 case 0: // don't lock anything
399 break; 397 break;
400 case 1: // normal lock 398 case 1: // normal lock
401 wnd->curDoc()->lockAll(true); 399 wnd->curDoc()->lockAll(true);
402 break; 400 break;
403 case 2: // deep-lock 401 case 2: // deep-lock
404 wnd->curDoc()->deepLock(); 402 wnd->curDoc()->deepLock();
405 break; 403 break;
406 default: 404 default:
407 WARN(); 405 WARN();
408 } 406 }
409 } else if (doDeleteDoc) { 407 } else if (doDeleteDoc) {
408 qDebug("doDeleteDoc ");
410 if (!wnd->curDoc()->tryDelete()) { 409 if (!wnd->curDoc()->tryDelete()) {
411 /* We failed deleting the doc, 410 /* We failed deleting the doc,
412 * so open a new window with it, again. 411 * so open a new window with it, again.
413 */ 412 */
414 createMainWnd(QString::null, false, 413 createMainWnd(QString::null, false,
415 false, wnd->curDoc()); 414 false, wnd->curDoc());
416 } 415 }
417 } 416 }
418#ifndef PWM_EMBEDDED 417#ifndef PWM_EMBEDDED
419 // find the closed window in the "mainWndList" and delete it. 418 // find the closed window in the "mainWndList" and delete it.
420 QValueList<PwM *>::iterator i = _mainWndList.begin(), 419 QValueList<PwM *>::iterator i = _mainWndList.begin(),
421 end = _mainWndList.end(); 420 end = _mainWndList.end();
422#else 421#else
423 // find the closed window in the "mainWndList" and delete it. 422 // find the closed window in the "mainWndList" and delete it.
424 QValueList<PwM *>::Iterator i = _mainWndList.begin(), 423 QValueList<PwM *>::Iterator i = _mainWndList.begin(),
425 end = _mainWndList.end(); 424 end = _mainWndList.end();
426#endif 425#endif
427 while (i != end) { 426 while (i != end) {
428 if (*i == wnd) { 427 if (*i == wnd) {
429#ifndef PWM_EMBEDDED 428#ifndef PWM_EMBEDDED
430 _mainWndList.erase(i); 429 _mainWndList.erase(i);
431#else 430#else
432 _mainWndList.remove(i); 431 _mainWndList.remove(i);
433#endif 432#endif
433
434 if ( app->mainWidget() == wnd ) {
435 if ( _mainWndList.count() ) {
436#ifndef DESKTOP_VERSION
437 app->showMainWidget(_mainWndList.first() );
438#endif //DESKTOP_VERSION
439
440 }
441 }
442 delete wnd;
434 goto out_success; 443 goto out_success;
435 } 444 }
436 ++i; 445 ++i;
437 } 446 }
438 BUG(); 447 BUG();
439out_success: 448out_success:
440#ifndef PWM_EMBEDDED 449#ifndef PWM_EMBEDDED
441 if (!_mainWndList.size()) 450 if (!_mainWndList.size())
442#else 451#else
443 if (!_mainWndList.count()) 452 if (!_mainWndList.count())
444#endif 453#endif
445 454