-rw-r--r-- | pwmanager/pwmanager/getmasterpwwnd_emb.cpp | 2 | ||||
-rw-r--r-- | pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp | 4 | ||||
-rw-r--r-- | pwmanager/pwmanager/libgcryptif.cpp | 5 | ||||
-rw-r--r-- | pwmanager/pwmanager/main.cpp | 1 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwm.cpp | 10 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmdoc.cpp | 1 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmdocui.cpp | 15 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwminit.cpp | 17 |
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 | |||
@@ -105,49 +105,49 @@ getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name) | |||
105 | QPushButton* backspace = new QPushButton( i18n("-"), numberBox ); | 105 | QPushButton* backspace = new QPushButton( i18n("-"), numberBox ); |
106 | numberLayout->addWidget( backspace, 3, 2 ); | 106 | numberLayout->addWidget( backspace, 3, 2 ); |
107 | 107 | ||
108 | 108 | ||
109 | pageLayout->addWidget(numberBox); | 109 | pageLayout->addWidget(numberBox); |
110 | #ifdef DESKTOP_VERSION | 110 | #ifdef DESKTOP_VERSION |
111 | resize( sizeHint() ); | 111 | resize( sizeHint() ); |
112 | #else | 112 | #else |
113 | resize( 200,sizeHint().height() ); | 113 | resize( 200,sizeHint().height() ); |
114 | #endif | 114 | #endif |
115 | 115 | ||
116 | connect( p0, SIGNAL( clicked() ), this, SLOT( add0() ) ); | 116 | connect( p0, SIGNAL( clicked() ), this, SLOT( add0() ) ); |
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 | */ |
136 | getMasterPwWnd::~getMasterPwWnd() | 136 | getMasterPwWnd::~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 | ||
141 | void getMasterPwWnd::okButton_slot() | 141 | void getMasterPwWnd::okButton_slot() |
142 | { | 142 | { |
143 | qWarning( "getMasterPwWnd::okButton_slot(): Not implemented yet" ); | 143 | qWarning( "getMasterPwWnd::okButton_slot(): Not implemented yet" ); |
144 | } | 144 | } |
145 | 145 | ||
146 | void getMasterPwWnd::cancelButton_slot() | 146 | void getMasterPwWnd::cancelButton_slot() |
147 | { | 147 | { |
148 | qWarning( "getMasterPwWnd::cancelButton_slot(): Not implemented yet" ); | 148 | qWarning( "getMasterPwWnd::cancelButton_slot(): Not implemented yet" ); |
149 | } | 149 | } |
150 | 150 | ||
151 | void getMasterPwWnd::add0() | 151 | void getMasterPwWnd::add0() |
152 | { | 152 | { |
153 | addCharacter("0"); | 153 | addCharacter("0"); |
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 | |||
@@ -127,55 +127,55 @@ PWMConfigWidget::PWMConfigWidget(PWMPrefs *prefs, QWidget *parent, const char *n | |||
127 | kcfg_hashAlgo->insertItem(i18n("MD5 (128 bit)")); | 127 | kcfg_hashAlgo->insertItem(i18n("MD5 (128 bit)")); |
128 | kcfg_hashAlgo->insertItem(i18n("RIPE-MD-160 (160 bit)")); | 128 | kcfg_hashAlgo->insertItem(i18n("RIPE-MD-160 (160 bit)")); |
129 | kcfg_hashAlgo->insertItem(i18n("Tiger (192 bit)")); | 129 | kcfg_hashAlgo->insertItem(i18n("Tiger (192 bit)")); |
130 | #endif // CONFIG_PWMANAGER_GCRY | 130 | #endif // CONFIG_PWMANAGER_GCRY |
131 | fileLayout->addWidget( kcfg_hashAlgo,i,1); | 131 | fileLayout->addWidget( kcfg_hashAlgo,i,1); |
132 | ++i; | 132 | ++i; |
133 | 133 | ||
134 | permissionLineEdit = new QLineEdit(filePage); | 134 | permissionLineEdit = new QLineEdit(filePage); |
135 | QLabel* permissionLineLabel = new QLabel(permissionLineEdit, i18n("Permissions:"), filePage); | 135 | QLabel* permissionLineLabel = new QLabel(permissionLineEdit, i18n("Permissions:"), filePage); |
136 | fileLayout->addWidget(permissionLineLabel,i,0); | 136 | fileLayout->addWidget(permissionLineLabel,i,0); |
137 | fileLayout->addWidget(permissionLineEdit,i,1); | 137 | fileLayout->addWidget(permissionLineEdit,i,1); |
138 | ++i; | 138 | ++i; |
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 |
170 | ////////////////////////////////////////////////////// | 170 | ////////////////////////////////////////////////////// |
171 | QWidget *autostartPage = new QWidget( this ); | 171 | QWidget *autostartPage = new QWidget( this ); |
172 | QGridLayout *autostartLayout = new QGridLayout( autostartPage, 3, 2); | 172 | QGridLayout *autostartLayout = new QGridLayout( autostartPage, 3, 2); |
173 | 173 | ||
174 | i = 0; | 174 | i = 0; |
175 | 175 | ||
176 | autostartLineEdit = new KURLRequester(autostartPage, "autoStartLineEdit"); | 176 | autostartLineEdit = new KURLRequester(autostartPage, "autoStartLineEdit"); |
177 | QLabel* autostartLineLabel = new QLabel(autostartLineEdit, "Open this file automatically on startup:",autostartPage); | 177 | QLabel* autostartLineLabel = new QLabel(autostartLineEdit, "Open this file automatically on startup:",autostartPage); |
178 | autostartLayout->addMultiCellWidget(autostartLineLabel,i,i,0,1); | 178 | autostartLayout->addMultiCellWidget(autostartLineLabel,i,i,0,1); |
179 | ++i; | 179 | ++i; |
180 | autostartLayout->addMultiCellWidget(autostartLineEdit,i,i,0,1); | 180 | autostartLayout->addMultiCellWidget(autostartLineEdit,i,i,0,1); |
181 | ++i; | 181 | ++i; |
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 | |||
@@ -418,32 +418,37 @@ void LibGCryptIf::padData(unsigned char *buf, | |||
418 | { | 418 | { |
419 | size_t numPadBytes = boundary - ((bufLen + 1) % boundary); | 419 | size_t numPadBytes = boundary - ((bufLen + 1) % boundary); |
420 | buf[bufLen] = static_cast<char>(0x01); | 420 | buf[bufLen] = static_cast<char>(0x01); |
421 | size_t i = 0; | 421 | size_t i = 0; |
422 | Randomizer *rnd = Randomizer::obj(); | 422 | Randomizer *rnd = Randomizer::obj(); |
423 | char c; | 423 | char c; |
424 | unsigned char *b; | 424 | unsigned char *b; |
425 | while (i < numPadBytes) { | 425 | while (i < numPadBytes) { |
426 | c = rnd->genRndChar(); | 426 | c = rnd->genRndChar(); |
427 | if (c == static_cast<char>(0x01)) | 427 | if (c == static_cast<char>(0x01)) |
428 | continue; | 428 | continue; |
429 | b = buf + bufLen + 1 + i; | 429 | b = buf + bufLen + 1 + i; |
430 | *b = c; | 430 | *b = c; |
431 | ++i; | 431 | ++i; |
432 | } | 432 | } |
433 | } | 433 | } |
434 | 434 | ||
435 | void LibGCryptIf::unpadData(const unsigned char *buf, | 435 | void 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 | |||
@@ -188,32 +188,33 @@ int main(int argc, char *argv[]) | |||
188 | #else | 188 | #else |
189 | QString fileName ; | 189 | QString fileName ; |
190 | fileName = qApp->applicationDirPath () + "/kdepim/pwmanager/icons22/"; | 190 | fileName = qApp->applicationDirPath () + "/kdepim/pwmanager/icons22/"; |
191 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 191 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
192 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); | 192 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); |
193 | 193 | ||
194 | #endif | 194 | #endif |
195 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "pwmanager"))); | 195 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "pwmanager"))); |
196 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 196 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
197 | 197 | ||
198 | a.newInstance(); | 198 | a.newInstance(); |
199 | 199 | ||
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 | |||
@@ -172,53 +172,55 @@ PwM::PwM(PwMInit *_init, PwMDoc *doc, | |||
172 | , forceQuit (false) | 172 | , forceQuit (false) |
173 | , forceMinimizeToTray (false) | 173 | , forceMinimizeToTray (false) |
174 | { | 174 | { |
175 | syncManager = 0; | 175 | syncManager = 0; |
176 | virgin = !virginity; | 176 | virgin = !virginity; |
177 | init = _init; | 177 | init = _init; |
178 | connect(doc, SIGNAL(docClosed(PwMDoc *)), | 178 | connect(doc, SIGNAL(docClosed(PwMDoc *)), |
179 | this, SLOT(docClosed(PwMDoc *))); | 179 | this, SLOT(docClosed(PwMDoc *))); |
180 | initMenubar(); | 180 | initMenubar(); |
181 | initToolbar(); | 181 | initToolbar(); |
182 | initMetrics(); | 182 | initMetrics(); |
183 | setVirgin(virginity); | 183 | setVirgin(virginity); |
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 | ||
194 | PwM::~PwM() | 194 | PwM::~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 | ||
206 | void PwM::initMenubar() | 208 | void 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 |
213 | picons = KGlobal::iconLoader(); | 215 | picons = KGlobal::iconLoader(); |
214 | 216 | ||
215 | 217 | ||
216 | syncPopup = new KPopupMenu(this); | 218 | syncPopup = new KPopupMenu(this); |
217 | 219 | ||
218 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::PWMPI, PWMPrefs::instance(), syncPopup); | 220 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::PWMPI, PWMPrefs::instance(), syncPopup); |
219 | syncManager->setBlockSave(false); | 221 | syncManager->setBlockSave(false); |
220 | 222 | ||
221 | connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 223 | connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
222 | syncManager->fillSyncMenu(); | 224 | syncManager->fillSyncMenu(); |
223 | 225 | ||
224 | #endif | 226 | #endif |
@@ -866,53 +868,57 @@ void PwM::config_slot() | |||
866 | end2 = ml->end(); | 868 | end2 = ml->end(); |
867 | #else | 869 | #else |
868 | QValueList<PwM *>::ConstIterator i2 = ml->begin(), | 870 | QValueList<PwM *>::ConstIterator i2 = ml->begin(), |
869 | end2 = ml->end(); | 871 | end2 = ml->end(); |
870 | #endif | 872 | #endif |
871 | PwM *pwm; | 873 | PwM *pwm; |
872 | while (i2 != end2) { | 874 | while (i2 != end2) { |
873 | pwm = *i2; | 875 | pwm = *i2; |
874 | // reinitialize the window style. | 876 | // reinitialize the window style. |
875 | if (oldStyle != newStyle) | 877 | if (oldStyle != newStyle) |
876 | pwm->curView()->initStyle(newStyle); | 878 | pwm->curView()->initStyle(newStyle); |
877 | // set the new font | 879 | // set the new font |
878 | pwm->curView()->setFont(conf()->confGlobEntryFont()); | 880 | pwm->curView()->setFont(conf()->confGlobEntryFont()); |
879 | ++i2; | 881 | ++i2; |
880 | } | 882 | } |
881 | } | 883 | } |
882 | 884 | ||
883 | void PwM::activateMpButton(bool activate) | 885 | void 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 | ||
888 | void PwM::closeEvent(QCloseEvent *e) | 890 | void 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 | ||
893 | void PwM::docClosed(PwMDoc *doc) | 898 | void 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 | ||
900 | void PwM::find_slot() | 906 | void 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; |
907 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 913 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
908 | FindWndImpl findWnd(view); | 914 | FindWndImpl findWnd(view); |
909 | findWnd.exec(); | 915 | findWnd.exec(); |
910 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 916 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
911 | } | 917 | } |
912 | 918 | ||
913 | void PwM::exportToText() | 919 | void PwM::exportToText() |
914 | { | 920 | { |
915 | PWM_ASSERT(curDoc()); | 921 | PWM_ASSERT(curDoc()); |
916 | if (curDoc()->isDocEmpty()) { | 922 | if (curDoc()->isDocEmpty()) { |
917 | KMessageBox::information(this, | 923 | KMessageBox::information(this, |
918 | i18n | 924 | i18n |
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 | |||
@@ -2956,48 +2956,49 @@ QString PwMDoc::getTitle() | |||
2956 | 2956 | ||
2957 | //US ENH: The whole filename on PDAs is too long. So use only the last characters | 2957 | //US ENH: The whole filename on PDAs is too long. So use only the last characters |
2958 | if (QApplication::desktop()->width() < 640) | 2958 | if (QApplication::desktop()->width() < 640) |
2959 | { | 2959 | { |
2960 | if (title.length() > 30) | 2960 | if (title.length() > 30) |
2961 | title = "..." + title.right(30); | 2961 | title = "..." + title.right(30); |
2962 | 2962 | ||
2963 | } | 2963 | } |
2964 | 2964 | ||
2965 | 2965 | ||
2966 | if (title.isEmpty()) { | 2966 | if (title.isEmpty()) { |
2967 | if (unnamedNum == 0) { | 2967 | if (unnamedNum == 0) { |
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 | ||
2978 | bool PwMDoc::tryDelete() | 2978 | bool 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; |
2992 | } | 2993 | } |
2993 | } | 2994 | } |
2994 | out_accept: | 2995 | out_accept: |
2995 | deleted = true; | 2996 | deleted = true; |
2996 | delete this; | 2997 | delete this; |
2997 | return true; | 2998 | return true; |
2998 | out_ignore: | 2999 | out_ignore: |
2999 | return false; | 3000 | return false; |
3000 | } | 3001 | } |
3001 | 3002 | ||
3002 | 3003 | ||
3003 | 3004 | ||
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 | |||
@@ -183,75 +183,78 @@ void PwMDocUi::noMpwMsgBox(bool chipcard, QString prefix, QString postfix) | |||
183 | void PwMDocUi::rootAlertMsgBox() | 183 | void PwMDocUi::rootAlertMsgBox() |
184 | { | 184 | { |
185 | KMessageBox::error(currentView, | 185 | KMessageBox::error(currentView, |
186 | i18n("This feature is not available,n" | 186 | i18n("This feature is not available,n" |
187 | "if you execute PwM with \"root\" \n" | 187 | "if you execute PwM with \"root\" \n" |
188 | "UID 0 privileges, for security reasons!"), | 188 | "UID 0 privileges, for security reasons!"), |
189 | i18n("not allowed as root!")); | 189 | i18n("not allowed as root!")); |
190 | } | 190 | } |
191 | 191 | ||
192 | void PwMDocUi::cantDeeplock_notSavedMsgBox() | 192 | void PwMDocUi::cantDeeplock_notSavedMsgBox() |
193 | { | 193 | { |
194 | KMessageBox::error(currentView, | 194 | KMessageBox::error(currentView, |
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 | ||
201 | void PwMDocUi::gpmPwLenErrMsgBox() | 201 | void 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 | ||
210 | int PwMDocUi::dirtyAskSave(const QString &docTitle) | 210 | int 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 | ||
246 | bool PwMDocUi::saveDocUi(PwMDoc *doc) | 249 | bool PwMDocUi::saveDocUi(PwMDoc *doc) |
247 | { | 250 | { |
248 | PWM_ASSERT(doc); | 251 | PWM_ASSERT(doc); |
249 | doc->timer()->getLock(DocTimer::id_autoLockTimer); | 252 | doc->timer()->getLock(DocTimer::id_autoLockTimer); |
250 | if (doc->isDocEmpty()) { | 253 | if (doc->isDocEmpty()) { |
251 | KMessageBox::information(currentView, | 254 | KMessageBox::information(currentView, |
252 | i18n | 255 | i18n |
253 | ("Sorry, there's nothing to save.\n" | 256 | ("Sorry, there's nothing to save.\n" |
254 | "Please first add some passwords."), | 257 | "Please first add some passwords."), |
255 | i18n("nothing to do")); | 258 | i18n("nothing to do")); |
256 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 259 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
257 | return true; | 260 | return true; |
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 | |||
@@ -67,48 +67,49 @@ static NOREGPARM void sig_handler(int signum) | |||
67 | sig_init_pointer->shutdownApp(20 + signum); | 67 | sig_init_pointer->shutdownApp(20 + signum); |
68 | break; | 68 | break; |
69 | default: | 69 | default: |
70 | printDebug(string("unhandled signal ") | 70 | printDebug(string("unhandled signal ") |
71 | + tostr(signum)); | 71 | + tostr(signum)); |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | 75 | ||
76 | 76 | ||
77 | PwMInit::PwMInit(PwMApplication *_app) | 77 | PwMInit::PwMInit(PwMApplication *_app) |
78 | : runStatus (unknown) | 78 | : runStatus (unknown) |
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 | ||
89 | PwMInit::~PwMInit() | 89 | PwMInit::~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) { |
103 | disconnect(*i, SIGNAL(closed(PwM *)), | 104 | disconnect(*i, SIGNAL(closed(PwM *)), |
104 | this, SLOT(mainWndClosed(PwM *))); | 105 | this, SLOT(mainWndClosed(PwM *))); |
105 | delete *i; | 106 | delete *i; |
106 | ++i; | 107 | ++i; |
107 | } | 108 | } |
108 | _mainWndList.clear(); | 109 | _mainWndList.clear(); |
109 | // close all remaining open documents | 110 | // close all remaining open documents |
110 | PwMDocList *_dl = PwMDoc::getOpenDocList(); | 111 | PwMDocList *_dl = PwMDoc::getOpenDocList(); |
111 | vector<PwMDocList::listItem> dl = *(_dl->getList()); | 112 | vector<PwMDocList::listItem> dl = *(_dl->getList()); |
112 | vector<PwMDocList::listItem>::iterator i2 = dl.begin(), | 113 | vector<PwMDocList::listItem>::iterator i2 = dl.begin(), |
113 | end2 = dl.end(); | 114 | end2 = dl.end(); |
114 | while (i2 != end2) { | 115 | while (i2 != end2) { |
@@ -158,49 +159,48 @@ void PwMInit::initializeApp() | |||
158 | if (!newDoc->openDocUi(newDoc, | 159 | if (!newDoc->openDocUi(newDoc, |
159 | conf()->confGlobAutoStart(), | 160 | conf()->confGlobAutoStart(), |
160 | openDeeplocked)) { | 161 | openDeeplocked)) { |
161 | delete newDoc; | 162 | delete newDoc; |
162 | } | 163 | } |
163 | 164 | ||
164 | //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 |
165 | createMainWnd(conf()->confGlobAutoStart(), | 166 | createMainWnd(conf()->confGlobAutoStart(), |
166 | openDeeplocked, | 167 | openDeeplocked, |
167 | true, | 168 | true, |
168 | 0, | 169 | 0, |
169 | savedCmd.minimized); | 170 | savedCmd.minimized); |
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 | ||
186 | void PwMInit::shutdownApp(int exitStatus) | 186 | void 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() |
195 | */ | 195 | */ |
196 | } | 196 | } |
197 | 197 | ||
198 | void PwMInit::initPosixSignalHandler() | 198 | void PwMInit::initPosixSignalHandler() |
199 | { | 199 | { |
200 | signal(SIGINT, sig_handler); | 200 | signal(SIGINT, sig_handler); |
201 | signal(SIGTERM, sig_handler); | 201 | signal(SIGTERM, sig_handler); |
202 | } | 202 | } |
203 | 203 | ||
204 | void PwMInit::initDCOP() | 204 | void PwMInit::initDCOP() |
205 | { | 205 | { |
206 | #ifndef PWM_EMBEDDED | 206 | #ifndef PWM_EMBEDDED |
@@ -301,52 +301,50 @@ PwM * PwMInit::createMainWnd(const QString &loadFile, | |||
301 | #ifndef PWM_EMBEDDED | 301 | #ifndef PWM_EMBEDDED |
302 | _mainWndList.push_back(newWnd); | 302 | _mainWndList.push_back(newWnd); |
303 | #else | 303 | #else |
304 | _mainWndList.append(newWnd); | 304 | _mainWndList.append(newWnd); |
305 | #endif | 305 | #endif |
306 | connect(newWnd, SIGNAL(closed(PwM *)), | 306 | connect(newWnd, SIGNAL(closed(PwM *)), |
307 | this, SLOT(mainWndClosed(PwM *))); | 307 | this, SLOT(mainWndClosed(PwM *))); |
308 | connect(newWnd, SIGNAL(gotFocus(PwM *)), | 308 | connect(newWnd, SIGNAL(gotFocus(PwM *)), |
309 | this, SLOT(setCurWidget(PwM *))); | 309 | this, SLOT(setCurWidget(PwM *))); |
310 | connect(newWnd, SIGNAL(lostFocus(PwM *)), | 310 | connect(newWnd, SIGNAL(lostFocus(PwM *)), |
311 | this, SLOT(resetCurWidget())); | 311 | this, SLOT(resetCurWidget())); |
312 | 312 | ||
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 | ||
340 | PwMDoc * PwMInit::createDoc() | 338 | PwMDoc * PwMInit::createDoc() |
341 | { | 339 | { |
342 | PwMDoc *doc = new PwMDoc(this); | 340 | PwMDoc *doc = new PwMDoc(this); |
343 | #ifdef CONFIG_KEYCARD | 341 | #ifdef CONFIG_KEYCARD |
344 | doc->setPwMKeyCard(keycard()); | 342 | doc->setPwMKeyCard(keycard()); |
345 | #endif | 343 | #endif |
346 | #ifdef CONFIG_KWALLETIF | 344 | #ifdef CONFIG_KWALLETIF |
347 | if (kwalletEmu()) | 345 | if (kwalletEmu()) |
348 | kwalletEmu()->connectDocSignals(doc); | 346 | kwalletEmu()->connectDocSignals(doc); |
349 | #endif | 347 | #endif |
350 | 348 | ||
351 | if (_tray) | 349 | if (_tray) |
352 | _tray->connectDocToTray(doc); | 350 | _tray->connectDocToTray(doc); |
@@ -370,88 +368,99 @@ again: | |||
370 | /* This should not happen! If we set forceMinimizeToTray , | 368 | /* This should not happen! If we set forceMinimizeToTray , |
371 | * we must be sure that _tray exists. | 369 | * we must be sure that _tray exists. |
372 | */ | 370 | */ |
373 | BUG(); | 371 | BUG(); |
374 | wnd->setForceMinimizeToTray(false); | 372 | wnd->setForceMinimizeToTray(false); |
375 | goto again; | 373 | goto again; |
376 | } | 374 | } |
377 | doMinimizeToTray = true; | 375 | doMinimizeToTray = true; |
378 | } else { | 376 | } else { |
379 | // Ask to minimize to tray. If not, delete doc. | 377 | // Ask to minimize to tray. If not, delete doc. |
380 | if (_tray && | 378 | if (_tray && |
381 | runStatus != shutdown && | 379 | runStatus != shutdown && |
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(); |
439 | out_success: | 448 | out_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 | ||
446 | { | 455 | { |
447 | /* If there's no main window and no tray icon | 456 | /* If there's no main window and no tray icon |
448 | * left, we have no user interface, so we can | 457 | * left, we have no user interface, so we can |
449 | * shut down the application. | 458 | * shut down the application. |
450 | */ | 459 | */ |
451 | if (!_tray) { | 460 | if (!_tray) { |
452 | #ifndef PWM_EMBEDDED | 461 | #ifndef PWM_EMBEDDED |
453 | dcopClient()->setAcceptCalls(true); | 462 | dcopClient()->setAcceptCalls(true); |
454 | dcopClient()->resume(); | 463 | dcopClient()->resume(); |
455 | #endif | 464 | #endif |
456 | shutdownApp(0); | 465 | shutdownApp(0); |
457 | return; | 466 | return; |