summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/getmasterpwwnd_emb.cpp11
-rw-r--r--pwmanager/pwmanager/main.cpp1
-rw-r--r--pwmanager/pwmanager/pwminit.cpp4
3 files changed, 9 insertions, 7 deletions
diff --git a/pwmanager/pwmanager/getmasterpwwnd_emb.cpp b/pwmanager/pwmanager/getmasterpwwnd_emb.cpp
index 7f4ccef..8b6dfbc 100644
--- a/pwmanager/pwmanager/getmasterpwwnd_emb.cpp
+++ b/pwmanager/pwmanager/getmasterpwwnd_emb.cpp
@@ -1,196 +1,201 @@
1/* 1/*
2 This file is part of PwManager/Platform independent. 2 This file is part of PwManager/Platform independent.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22 22
23$Id$ 23$Id$
24*/ 24*/
25 25
26#include "getmasterpwwnd_emb.h" 26#include "getmasterpwwnd_emb.h"
27 27
28#include "klocale.h" 28#include "klocale.h"
29 29
30/* 30/*
31#include <qvariant.h> 31#include <qvariant.h>
32#include <qpushbutton.h> 32#include <qpushbutton.h>
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qlineedit.h> 34#include <qlineedit.h>
35#include <qlayout.h> 35#include <qlayout.h>
36#include <qtooltip.h> 36#include <qtooltip.h>
37#include <qwhatsthis.h> 37#include <qwhatsthis.h>
38*/ 38*/
39 39
40#include <qwidget.h> 40#include <qwidget.h>
41#include <qlayout.h> 41#include <qlayout.h>
42#include <qlabel.h> 42#include <qlabel.h>
43#include <qlineedit.h> 43#include <qlineedit.h>
44#include <qpushbutton.h> 44#include <qpushbutton.h>
45 45
46/* 46/*
47 * Constructs a getMasterPwWnd as a child of 'parent', with the 47 * Constructs a getMasterPwWnd as a child of 'parent', with the
48 * name 'name' 48 * name 'name'
49 */ 49 */
50getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name) 50getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name)
51 : KDialogBase( KDialogBase::Plain, i18n( "Master-password" ), 51 : KDialogBase( KDialogBase::Plain, i18n( "Master-password" ),
52 KDialogBase::Ok | KDialogBase::Cancel, 52 KDialogBase::Ok | KDialogBase::Cancel,
53 KDialogBase::Ok, parent, name, true ) 53 KDialogBase::Ok, parent, name, true )
54{ 54{
55 QWidget *page = plainPage(); 55 QWidget *page = plainPage();
56 QVBoxLayout *pageLayout = new QVBoxLayout( page ); 56 QVBoxLayout *pageLayout = new QVBoxLayout( page );
57 57
58 pwLineEdit = new QLineEdit( page, "pwLineEdit" ); 58 pwLineEdit = new QLineEdit( page, "pwLineEdit" );
59 pwLineEdit->setEchoMode( QLineEdit::Password ); 59 pwLineEdit->setEchoMode( QLineEdit::Password );
60 60
61 QLabel* textLabel1 = new QLabel( pwLineEdit, i18n("Please enter the master-password:"), page, "textLabel1" ); 61 QLabel* textLabel1 = new QLabel( pwLineEdit, i18n("Please enter the master-password:"), page, "textLabel1" );
62 textLabel1->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) ); 62 textLabel1->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) );
63 pageLayout->addWidget(textLabel1); 63 pageLayout->addWidget(textLabel1);
64 pageLayout->addWidget(pwLineEdit); 64 pageLayout->addWidget(pwLineEdit);
65 65
66 QWidget* numberBox = new QWidget( page ); 66 QWidget* numberBox = new QWidget( page );
67 numberBox->setFixedHeight(100); 67#ifndef DESKTOP_VERSION
68 numberBox->setFixedWidth(100); 68 numberBox->setFixedHeight(150);
69 numberBox->setFixedWidth(150);
70#endif
69 71
70 QGridLayout* numberLayout = new QGridLayout( numberBox, 4, 3 ); 72 QGridLayout* numberLayout = new QGridLayout( numberBox, 4, 3 );
71 numberLayout->setMargin( 0 ); 73 numberLayout->setMargin( 0 );
72 numberLayout->setSpacing( 0 ); 74 numberLayout->setSpacing( 0 );
73 75
74 QPushButton* p1 = new QPushButton( i18n("1"), numberBox ); 76 QPushButton* p1 = new QPushButton( i18n("1"), numberBox );
75 numberLayout->addWidget( p1, 0, 0 ); 77 numberLayout->addWidget( p1, 0, 0 );
76 QPushButton* p2 = new QPushButton( i18n("2"), numberBox ); 78 QPushButton* p2 = new QPushButton( i18n("2"), numberBox );
77 numberLayout->addWidget( p2, 0, 1 ); 79 numberLayout->addWidget( p2, 0, 1 );
78 QPushButton* p3 = new QPushButton( i18n("3"), numberBox ); 80 QPushButton* p3 = new QPushButton( i18n("3"), numberBox );
79 numberLayout->addWidget( p3, 0, 2 ); 81 numberLayout->addWidget( p3, 0, 2 );
80 QPushButton* p4 = new QPushButton( i18n("4"), numberBox ); 82 QPushButton* p4 = new QPushButton( i18n("4"), numberBox );
81 numberLayout->addWidget( p4, 1, 0 ); 83 numberLayout->addWidget( p4, 1, 0 );
82 QPushButton* p5 = new QPushButton( i18n("5"), numberBox ); 84 QPushButton* p5 = new QPushButton( i18n("5"), numberBox );
83 numberLayout->addWidget( p5, 1, 1 ); 85 numberLayout->addWidget( p5, 1, 1 );
84 QPushButton* p6 = new QPushButton( i18n("6"), numberBox ); 86 QPushButton* p6 = new QPushButton( i18n("6"), numberBox );
85 numberLayout->addWidget( p6, 1, 2 ); 87 numberLayout->addWidget( p6, 1, 2 );
86 QPushButton* p7 = new QPushButton( i18n("7"), numberBox ); 88 QPushButton* p7 = new QPushButton( i18n("7"), numberBox );
87 numberLayout->addWidget( p7, 2, 0 ); 89 numberLayout->addWidget( p7, 2, 0 );
88 QPushButton* p8 = new QPushButton( i18n("8"), numberBox ); 90 QPushButton* p8 = new QPushButton( i18n("8"), numberBox );
89 numberLayout->addWidget( p8, 2, 1 ); 91 numberLayout->addWidget( p8, 2, 1 );
90 QPushButton* p9 = new QPushButton( i18n("9"), numberBox ); 92 QPushButton* p9 = new QPushButton( i18n("9"), numberBox );
91 numberLayout->addWidget( p9, 2, 2 ); 93 numberLayout->addWidget( p9, 2, 2 );
92 QPushButton* clear = new QPushButton( i18n("x"), numberBox ); 94 QPushButton* clear = new QPushButton( i18n("x"), numberBox );
93 numberLayout->addWidget( clear, 3, 0 ); 95 numberLayout->addWidget( clear, 3, 0 );
94 QPushButton* p0 = new QPushButton( i18n("0"), numberBox ); 96 QPushButton* p0 = new QPushButton( i18n("0"), numberBox );
95 numberLayout->addWidget( p0, 3, 1 ); 97 numberLayout->addWidget( p0, 3, 1 );
96 QPushButton* backspace = new QPushButton( i18n("-"), numberBox ); 98 QPushButton* backspace = new QPushButton( i18n("-"), numberBox );
97 numberLayout->addWidget( backspace, 3, 2 ); 99 numberLayout->addWidget( backspace, 3, 2 );
98 100
99 101
100 pageLayout->addWidget(numberBox); 102 pageLayout->addWidget(numberBox);
101 103#ifdef DESKTOP_VERSION
104 resize( sizeHint() );
105#else
102 resize( 200,sizeHint().height() ); 106 resize( 200,sizeHint().height() );
107#endif
103 108
104 connect( p0, SIGNAL( clicked() ), this, SLOT( add0() ) ); 109 connect( p0, SIGNAL( clicked() ), this, SLOT( add0() ) );
105 connect( p1, SIGNAL( clicked() ), this, SLOT( add1() ) ); 110 connect( p1, SIGNAL( clicked() ), this, SLOT( add1() ) );
106 connect( p2, SIGNAL( clicked() ), this, SLOT( add2() ) ); 111 connect( p2, SIGNAL( clicked() ), this, SLOT( add2() ) );
107 connect( p3, SIGNAL( clicked() ), this, SLOT( add3() ) ); 112 connect( p3, SIGNAL( clicked() ), this, SLOT( add3() ) );
108 connect( p4, SIGNAL( clicked() ), this, SLOT( add4() ) ); 113 connect( p4, SIGNAL( clicked() ), this, SLOT( add4() ) );
109 connect( p5, SIGNAL( clicked() ), this, SLOT( add5() ) ); 114 connect( p5, SIGNAL( clicked() ), this, SLOT( add5() ) );
110 connect( p6, SIGNAL( clicked() ), this, SLOT( add6() ) ); 115 connect( p6, SIGNAL( clicked() ), this, SLOT( add6() ) );
111 connect( p7, SIGNAL( clicked() ), this, SLOT( add7() ) ); 116 connect( p7, SIGNAL( clicked() ), this, SLOT( add7() ) );
112 connect( p8, SIGNAL( clicked() ), this, SLOT( add8() ) ); 117 connect( p8, SIGNAL( clicked() ), this, SLOT( add8() ) );
113 connect( p9, SIGNAL( clicked() ), this, SLOT( add9() ) ); 118 connect( p9, SIGNAL( clicked() ), this, SLOT( add9() ) );
114 connect( backspace, SIGNAL( clicked() ), this, SLOT( backspace() ) ); 119 connect( backspace, SIGNAL( clicked() ), this, SLOT( backspace() ) );
115 connect( clear, SIGNAL( clicked() ), this, SLOT( clear() ) ); 120 connect( clear, SIGNAL( clicked() ), this, SLOT( clear() ) );
116 121
117 122
118 123
119} 124}
120 125
121/* 126/*
122 * Destroys the object and frees any allocated resources 127 * Destroys the object and frees any allocated resources
123 */ 128 */
124getMasterPwWnd::~getMasterPwWnd() 129getMasterPwWnd::~getMasterPwWnd()
125{ 130{
126 // no need to delete child widgets, Qt does it all for us 131 // no need to delete child widgets, Qt does it all for us
127} 132}
128 133
129void getMasterPwWnd::okButton_slot() 134void getMasterPwWnd::okButton_slot()
130{ 135{
131 qWarning( "getMasterPwWnd::okButton_slot(): Not implemented yet" ); 136 qWarning( "getMasterPwWnd::okButton_slot(): Not implemented yet" );
132} 137}
133 138
134void getMasterPwWnd::cancelButton_slot() 139void getMasterPwWnd::cancelButton_slot()
135{ 140{
136 qWarning( "getMasterPwWnd::cancelButton_slot(): Not implemented yet" ); 141 qWarning( "getMasterPwWnd::cancelButton_slot(): Not implemented yet" );
137} 142}
138 143
139void getMasterPwWnd::add0() 144void getMasterPwWnd::add0()
140{ 145{
141 addCharacter("0"); 146 addCharacter("0");
142} 147}
143void getMasterPwWnd::add1() 148void getMasterPwWnd::add1()
144{ 149{
145 addCharacter("1"); 150 addCharacter("1");
146} 151}
147void getMasterPwWnd::add2() 152void getMasterPwWnd::add2()
148{ 153{
149 addCharacter("2"); 154 addCharacter("2");
150} 155}
151void getMasterPwWnd::add3() 156void getMasterPwWnd::add3()
152{ 157{
153 addCharacter("3"); 158 addCharacter("3");
154} 159}
155void getMasterPwWnd::add4() 160void getMasterPwWnd::add4()
156{ 161{
157 addCharacter("4"); 162 addCharacter("4");
158} 163}
159void getMasterPwWnd::add5() 164void getMasterPwWnd::add5()
160{ 165{
161 addCharacter("5"); 166 addCharacter("5");
162} 167}
163void getMasterPwWnd::add6() 168void getMasterPwWnd::add6()
164{ 169{
165 addCharacter("6"); 170 addCharacter("6");
166} 171}
167void getMasterPwWnd::add7() 172void getMasterPwWnd::add7()
168{ 173{
169 addCharacter("7"); 174 addCharacter("7");
170} 175}
171void getMasterPwWnd::add8() 176void getMasterPwWnd::add8()
172{ 177{
173 addCharacter("8"); 178 addCharacter("8");
174} 179}
175void getMasterPwWnd::add9() 180void getMasterPwWnd::add9()
176{ 181{
177 addCharacter("9"); 182 addCharacter("9");
178} 183}
179void getMasterPwWnd::backspace() 184void getMasterPwWnd::backspace()
180{ 185{
181 QString old = pwLineEdit->text(); 186 QString old = pwLineEdit->text();
182 old.truncate(old.length()-1); 187 old.truncate(old.length()-1);
183 pwLineEdit->setText(old); 188 pwLineEdit->setText(old);
184} 189}
185 190
186void getMasterPwWnd::clear() 191void getMasterPwWnd::clear()
187{ 192{
188 pwLineEdit->setText(""); 193 pwLineEdit->setText("");
189} 194}
190 195
191void getMasterPwWnd::addCharacter(const QString& s) 196void getMasterPwWnd::addCharacter(const QString& s)
192{ 197{
193 QString old = pwLineEdit->text(); 198 QString old = pwLineEdit->text();
194 pwLineEdit->setText(old + s); 199 pwLineEdit->setText(old + s);
195} 200}
196 201
diff --git a/pwmanager/pwmanager/main.cpp b/pwmanager/pwmanager/main.cpp
index 9d1d863..3f2d055 100644
--- a/pwmanager/pwmanager/main.cpp
+++ b/pwmanager/pwmanager/main.cpp
@@ -78,137 +78,136 @@ static void printDebugConfigureInfo()
78 cout << "CONFIG_KWALLETIF: enabled" << endl; 78 cout << "CONFIG_KWALLETIF: enabled" << endl;
79#else 79#else
80 cout << "CONFIG_KWALLETIF: disabled" << endl; 80 cout << "CONFIG_KWALLETIF: disabled" << endl;
81#endif 81#endif
82#ifdef BIG_ENDIAN_HOST 82#ifdef BIG_ENDIAN_HOST
83 cout << "Endianess: big-endian" << endl; 83 cout << "Endianess: big-endian" << endl;
84#else 84#else
85 cout << "Endianess: little-endian" << endl; 85 cout << "Endianess: little-endian" << endl;
86#endif 86#endif
87 cout << "sizeof(long): " << sizeof(long) << endl; 87 cout << "sizeof(long): " << sizeof(long) << endl;
88 cout << "================================" << endl; 88 cout << "================================" << endl;
89} 89}
90#else // PWM_DEBUG 90#else // PWM_DEBUG
91static inline void printDebugConfigureInfo() { /* nothing */ } 91static inline void printDebugConfigureInfo() { /* nothing */ }
92#endif // PWM_DEBUG 92#endif // PWM_DEBUG
93 93
94#ifndef PWM_EMBEDDED 94#ifndef PWM_EMBEDDED
95static void addAuthors(KAboutData *aboutData) 95static void addAuthors(KAboutData *aboutData)
96{ 96{
97 aboutData->addAuthor("Michael Buesch", 97 aboutData->addAuthor("Michael Buesch",
98 I18N_NOOP( 98 I18N_NOOP(
99 "main programming and current maintainer"), 99 "main programming and current maintainer"),
100 "mbuesch@freenet.de"); 100 "mbuesch@freenet.de");
101 aboutData->addAuthor("Matt Scifo", 101 aboutData->addAuthor("Matt Scifo",
102 I18N_NOOP( 102 I18N_NOOP(
103 "original implementaion of \n" 103 "original implementaion of \n"
104 "\"categories\" and the password-tree \n" 104 "\"categories\" and the password-tree \n"
105 "in the system-tray. Original implementations of \n" 105 "in the system-tray. Original implementations of \n"
106 "numerous view-improvements."), 106 "numerous view-improvements."),
107 "mscifo@o1.com"); 107 "mscifo@o1.com");
108 aboutData->addCredit("Elias Probst", 108 aboutData->addCredit("Elias Probst",
109 I18N_NOOP( 109 I18N_NOOP(
110 "Gentoo ebuild maintainer."), 110 "Gentoo ebuild maintainer."),
111 "elias.probst@gmx.de"); 111 "elias.probst@gmx.de");
112 aboutData->addCredit("George Staikos", 112 aboutData->addCredit("George Staikos",
113 I18N_NOOP("KWallet"), 113 I18N_NOOP("KWallet"),
114 "staikos@kde.org"); 114 "staikos@kde.org");
115 aboutData->addCredit("Matthew Palmer", 115 aboutData->addCredit("Matthew Palmer",
116 I18N_NOOP("rc2 code"), 116 I18N_NOOP("rc2 code"),
117 "mjp16@uow.edu.au"); 117 "mjp16@uow.edu.au");
118 aboutData->addCredit("Olivier Sessink", 118 aboutData->addCredit("Olivier Sessink",
119 I18N_NOOP("gpasman"), 119 I18N_NOOP("gpasman"),
120 "gpasman@nl.linux.org"); 120 "gpasman@nl.linux.org");
121 aboutData->addCredit("The libgcrypt developers", 121 aboutData->addCredit("The libgcrypt developers",
122 I18N_NOOP("Blowfish and SHA1 algorithms"), 122 I18N_NOOP("Blowfish and SHA1 algorithms"),
123 0, "ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/"); 123 0, "ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/");
124 aboutData->addCredit("Troy Engel", 124 aboutData->addCredit("Troy Engel",
125 I18N_NOOP("kpasman"), 125 I18N_NOOP("kpasman"),
126 "tengel@sonic.net"); 126 "tengel@sonic.net");
127 aboutData->addCredit("Wickey", 127 aboutData->addCredit("Wickey",
128 I18N_NOOP("graphics-design in older versions."), 128 I18N_NOOP("graphics-design in older versions."),
129 "wickey@gmx.at"); 129 "wickey@gmx.at");
130 aboutData->addCredit("Ian MacGregor", 130 aboutData->addCredit("Ian MacGregor",
131 I18N_NOOP( 131 I18N_NOOP(
132 "original documentation author.")); 132 "original documentation author."));
133} 133}
134#endif 134#endif
135 135
136int main(int argc, char *argv[]) 136int main(int argc, char *argv[])
137{ 137{
138 printDebugConfigureInfo(); 138 printDebugConfigureInfo();
139#ifndef PWM_EMBEDDED 139#ifndef PWM_EMBEDDED
140 KAboutData aboutData(PACKAGE_NAME, PROG_NAME, 140 KAboutData aboutData(PACKAGE_NAME, PROG_NAME,
141 PACKAGE_VER, description, KAboutData::License_File, 141 PACKAGE_VER, description, KAboutData::License_File,
142 "(c) 2003, 2004 Michael Buesch and the PwManager Team", 0, 142 "(c) 2003, 2004 Michael Buesch and the PwManager Team", 0,
143 "http://passwordmanager.sourceforge.net/", 143 "http://passwordmanager.sourceforge.net/",
144 "mbuesch@freenet.de"); 144 "mbuesch@freenet.de");
145 addAuthors(&aboutData); 145 addAuthors(&aboutData);
146 146
147 KCmdLineArgs::init(argc, argv, &aboutData); 147 KCmdLineArgs::init(argc, argv, &aboutData);
148 KCmdLineArgs::addCmdLineOptions(options); 148 KCmdLineArgs::addCmdLineOptions(options);
149 149
150 KUniqueApplication::addCmdLineOptions(); 150 KUniqueApplication::addCmdLineOptions();
151 if (!KUniqueApplication::start()) { 151 if (!KUniqueApplication::start()) {
152 printInfo("already running."); 152 printInfo("already running.");
153 return EXIT_SUCCESS; 153 return EXIT_SUCCESS;
154 } 154 }
155 PwMApplication a; 155 PwMApplication a;
156 aboutData.setLicenseTextFile(LICENSE_FILE); 156 aboutData.setLicenseTextFile(LICENSE_FILE);
157 return a.exec(); 157 return a.exec();
158#else 158#else
159 159
160 bool exitHelp = false; 160 bool exitHelp = false;
161 if ( argc > 1 ) { 161 if ( argc > 1 ) {
162 QString command = argv[1]; 162 QString command = argv[1];
163 if ( command == "-help" ){ 163 if ( command == "-help" ){
164 printf("PWM/PI command line commands:\n"); 164 printf("PWM/PI command line commands:\n");
165 printf(" no command: Start PWM/PI in usual way\n"); 165 printf(" no command: Start PWM/PI in usual way\n");
166 printf(" -help: This output\n"); 166 printf(" -help: This output\n");
167 printf(" PWM/PI is exiting now. Bye!\n"); 167 printf(" PWM/PI is exiting now. Bye!\n");
168 exitHelp = true; 168 exitHelp = true;
169 } 169 }
170 } 170 }
171 if ( ! exitHelp ) { 171 if ( ! exitHelp ) {
172 172
173 PwMApplication a(argc, argv); 173 PwMApplication a(argc, argv);
174 174
175 KGlobal::setAppName( "pwmanager" ); 175 KGlobal::setAppName( "pwmanager" );
176#ifndef DESKTOP_VERSION 176#ifndef DESKTOP_VERSION
177 //qDebug("width %d ",QApplication::desktop()->width() ); 177 //qDebug("width %d ",QApplication::desktop()->width() );
178 if ( QApplication::desktop()->width() > 320 ) 178 if ( QApplication::desktop()->width() > 320 )
179 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons22/"); 179 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons22/");
180 else 180 else
181 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons16/"); 181 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons16/");
182#else 182#else
183 QString fileName ; 183 QString fileName ;
184 fileName = qApp->applicationDirPath () + "/kdepim/pwmanager/icons22/"; 184 fileName = qApp->applicationDirPath () + "/kdepim/pwmanager/icons22/";
185 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 185 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
186 QApplication::addLibraryPath ( qApp->applicationDirPath () ); 186 QApplication::addLibraryPath ( qApp->applicationDirPath () );
187 187
188#endif 188#endif
189 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "pwmanager"))); 189 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "pwmanager")));
190 KPimGlobalPrefs::instance()->setGlobalConfig(); 190 KPimGlobalPrefs::instance()->setGlobalConfig();
191 191
192 a.newInstance(); 192 a.newInstance();
193 193
194 //US KAddressBookMain m ; 194 //US KAddressBookMain m ;
195 195
196 //US QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 196 //US QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
197 /*US 197 /*US
198#ifndef DESKTOP_VERSION 198#ifndef DESKTOP_VERSION
199 a.showMainWidget( &m ); 199 a.showMainWidget( &m );
200#else 200#else
201 a.setMainWidget( &m ); 201 a.setMainWidget( &m );
202 m.resize (640, 480 ); 202 m.resize (640, 480 );
203 m.show(); 203 m.show();
204#endif 204#endif
205 */ 205 */
206 qDebug("exec ");
207 a.exec(); 206 a.exec();
208 207
209 } 208 }
210 qDebug("PWMPI: Bye! "); 209 qDebug("PWMPI: Bye! ");
211 210
212#endif 211#endif
213 212
214} 213}
diff --git a/pwmanager/pwmanager/pwminit.cpp b/pwmanager/pwmanager/pwminit.cpp
index ea9e330..9238c8c 100644
--- a/pwmanager/pwmanager/pwminit.cpp
+++ b/pwmanager/pwmanager/pwminit.cpp
@@ -4,420 +4,418 @@
4 * email: mbuesch@freenet.de * 4 * email: mbuesch@freenet.de *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License version 2 * 7 * it under the terms of the GNU General Public License version 2 *
8 * as published by the Free Software Foundation. * 8 * as published by the Free Software Foundation. *
9 * * 9 * *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12/*************************************************************************** 12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk 13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager 14 * This file is originaly based on version 1.0.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#include "pwminit.h" 20#include "pwminit.h"
21#include "randomizer.h" 21#include "randomizer.h"
22#include <qdir.h> 22#include <qdir.h>
23 23
24#ifndef PWM_EMBEDDED 24#ifndef PWM_EMBEDDED
25#include "selftest.h" 25#include "selftest.h"
26#include "configuration.h" 26#include "configuration.h"
27#else 27#else
28#include "pwmprefs.h" 28#include "pwmprefs.h"
29#endif 29#endif
30 30
31#include "pwm.h" 31#include "pwm.h"
32#include "pwmexception.h" 32#include "pwmexception.h"
33#include "pwmtray.h" 33#include "pwmtray.h"
34#include "pwmdoc.h" 34#include "pwmdoc.h"
35 35
36#ifdef CONFIG_KWALLETIF 36#ifdef CONFIG_KWALLETIF
37# include "kwalletemu.h" 37# include "kwalletemu.h"
38#endif // CONFIG_KWALLETIF 38#endif // CONFIG_KWALLETIF
39#ifdef CONFIG_KEYCARD 39#ifdef CONFIG_KEYCARD
40# include "pwmkeycard.h" 40# include "pwmkeycard.h"
41#endif // CONFIG_KEYCARD 41#endif // CONFIG_KEYCARD
42 42
43#include <qmessagebox.h> 43#include <qmessagebox.h>
44 44
45#include <kmessagebox.h> 45#include <kmessagebox.h>
46#ifndef PWM_EMBEDDED 46#ifndef PWM_EMBEDDED
47#include <kcmdlineargs.h> 47#include <kcmdlineargs.h>
48#include <kwin.h> 48#include <kwin.h>
49#include <dcopclient.h> 49#include <dcopclient.h>
50#endif 50#endif
51 51
52#include <kapplication.h> 52#include <kapplication.h>
53#include <kiconloader.h> 53#include <kiconloader.h>
54 54
55#include <signal.h> 55#include <signal.h>
56 56
57static PwMInit *sig_init_pointer; 57static PwMInit *sig_init_pointer;
58static NOREGPARM void sig_handler(int signum) 58static NOREGPARM void sig_handler(int signum)
59{ 59{
60 switch (signum) { 60 switch (signum) {
61 case SIGINT: 61 case SIGINT:
62 case SIGTERM: 62 case SIGTERM:
63 sig_init_pointer->shutdownApp(20 + signum); 63 sig_init_pointer->shutdownApp(20 + signum);
64 break; 64 break;
65 default: 65 default:
66 printDebug(string("unhandled signal ") 66 printDebug(string("unhandled signal ")
67 + tostr(signum)); 67 + tostr(signum));
68 } 68 }
69} 69}
70 70
71 71
72 72
73 73
74PwMInit::PwMInit(PwMApplication *_app) 74PwMInit::PwMInit(PwMApplication *_app)
75 : runStatus (unknown) 75 : runStatus (unknown)
76 , _curWidget (0) 76 , _curWidget (0)
77 , _dcopClient (0) 77 , _dcopClient (0)
78 , _kwalletEmu (0) 78 , _kwalletEmu (0)
79 , _keycard (0) 79 , _keycard (0)
80 , _tray (0) 80 , _tray (0)
81{ 81{
82 sig_init_pointer = this; 82 sig_init_pointer = this;
83 app = _app; 83 app = _app;
84} 84}
85 85
86PwMInit::~PwMInit() 86PwMInit::~PwMInit()
87{ 87{
88#ifndef PWM_EMBEDDED 88#ifndef PWM_EMBEDDED
89 SelfTest::cancel(); 89 SelfTest::cancel();
90 // close all open mainwnds 90 // close all open mainwnds
91 QValueList<PwM *>::iterator i = _mainWndList.begin(), 91 QValueList<PwM *>::iterator i = _mainWndList.begin(),
92 end = _mainWndList.end(); 92 end = _mainWndList.end();
93 93
94#else 94#else
95 // close all open mainwnds 95 // close all open mainwnds
96 QValueList<PwM *>::Iterator i = _mainWndList.begin(), 96 QValueList<PwM *>::Iterator i = _mainWndList.begin(),
97 end = _mainWndList.end(); 97 end = _mainWndList.end();
98#endif 98#endif
99 while (i != end) { 99 while (i != end) {
100 disconnect(*i, SIGNAL(closed(PwM *)), 100 disconnect(*i, SIGNAL(closed(PwM *)),
101 this, SLOT(mainWndClosed(PwM *))); 101 this, SLOT(mainWndClosed(PwM *)));
102 delete *i; 102 delete *i;
103 ++i; 103 ++i;
104 } 104 }
105 _mainWndList.clear(); 105 _mainWndList.clear();
106 // close all remaining open documents 106 // close all remaining open documents
107 PwMDocList *_dl = PwMDoc::getOpenDocList(); 107 PwMDocList *_dl = PwMDoc::getOpenDocList();
108 vector<PwMDocList::listItem> dl = *(_dl->getList()); 108 vector<PwMDocList::listItem> dl = *(_dl->getList());
109 vector<PwMDocList::listItem>::iterator i2 = dl.begin(), 109 vector<PwMDocList::listItem>::iterator i2 = dl.begin(),
110 end2 = dl.end(); 110 end2 = dl.end();
111 while (i2 != end2) { 111 while (i2 != end2) {
112 delete (*i2).doc; 112 delete (*i2).doc;
113 ++i2; 113 ++i2;
114 } 114 }
115 115
116#ifdef CONFIG_KWALLETIF 116#ifdef CONFIG_KWALLETIF
117 delete_ifnot_null(_kwalletEmu); 117 delete_ifnot_null(_kwalletEmu);
118#endif // CONFIG_KWALLETIF 118#endif // CONFIG_KWALLETIF
119#ifdef CONFIG_KEYCARD 119#ifdef CONFIG_KEYCARD
120 delete_ifnot_null(_keycard); 120 delete_ifnot_null(_keycard);
121#endif // CONFIG_KEYCARD 121#endif // CONFIG_KEYCARD
122 delete_ifnot_null(_tray); 122 delete_ifnot_null(_tray);
123 123
124 Randomizer::cleanup(); 124 Randomizer::cleanup();
125#ifndef PWM_EMBEDDED 125#ifndef PWM_EMBEDDED
126 Configuration::cleanup(); 126 Configuration::cleanup();
127#endif 127#endif
128} 128}
129 129
130void PwMInit::initializeApp() 130void PwMInit::initializeApp()
131{ 131{
132 qDebug("PwMInit::initializeApp() "); 132 //qDebug("PwMInit::initializeApp() ");
133 PWM_ASSERT(runStatus == unknown); 133 PWM_ASSERT(runStatus == unknown);
134 runStatus = init; 134 runStatus = init;
135 initPosixSignalHandler(); 135 initPosixSignalHandler();
136 Randomizer::init(); 136 Randomizer::init();
137#ifndef PWM_EMBEDDED 137#ifndef PWM_EMBEDDED
138 Configuration::init(); 138 Configuration::init();
139#endif 139#endif
140 initDCOP(); 140 initDCOP();
141 initKWalletEmu(); 141 initKWalletEmu();
142 initKeycard(); 142 initKeycard();
143 initTray(); 143 initTray();
144 handleCmdLineArgs(); 144 handleCmdLineArgs();
145 qDebug("handle ");
146 bool openDeeplocked = false; 145 bool openDeeplocked = false;
147 if (conf()->confGlobAutostartDeepLocked() || 146 if (conf()->confGlobAutostartDeepLocked() ||
148 savedCmd.open_deeplocked) 147 savedCmd.open_deeplocked)
149 openDeeplocked = true; 148 openDeeplocked = true;
150 if ( false ){ 149 if ( false ){
151 // LR is not working 150 // LR is not working
152 //if (conf()->confWndAutoMinimizeOnStart() || 151 //if (conf()->confWndAutoMinimizeOnStart() ||
153 // savedCmd.minToTray) { 152 // savedCmd.minToTray) {
154 PwMDoc *newDoc = createDoc(); 153 PwMDoc *newDoc = createDoc();
155 qDebug(" createDoc()"); 154 qDebug(" createDoc()");
156 if (!newDoc->openDocUi(newDoc, 155 if (!newDoc->openDocUi(newDoc,
157 conf()->confGlobAutoStart(), 156 conf()->confGlobAutoStart(),
158 openDeeplocked)) { 157 openDeeplocked)) {
159 delete newDoc; 158 delete newDoc;
160 } 159 }
161 160
162 //US ENH for embedded devices: in the case of failure, open a document the default way 161 //US ENH for embedded devices: in the case of failure, open a document the default way
163 createMainWnd(conf()->confGlobAutoStart(), 162 createMainWnd(conf()->confGlobAutoStart(),
164 openDeeplocked, 163 openDeeplocked,
165 true, 164 true,
166 0, 165 0,
167 savedCmd.minimized); 166 savedCmd.minimized);
168 167
169 168
170 169
171 170
172 //} 171 //}
173 } else { 172 } else {
174 createMainWnd(conf()->confGlobAutoStart(), 173 createMainWnd(conf()->confGlobAutoStart(),
175 openDeeplocked, 174 openDeeplocked,
176 true, 175 true,
177 0, 176 0,
178 savedCmd.minimized); 177 savedCmd.minimized);
179 } 178 }
180 179
181 runStatus = running; 180 runStatus = running;
182} 181}
183 182
184void PwMInit::shutdownApp(int exitStatus) 183void PwMInit::shutdownApp(int exitStatus)
185{ 184{
186 printDebug(string("PwMInit::shutdownApp(") 185 printDebug(string("PwMInit::shutdownApp(")
187 + tostr(exitStatus) + ") called."); 186 + tostr(exitStatus) + ") called.");
188 PWM_ASSERT((runStatus == running) || (runStatus == init)); 187 PWM_ASSERT((runStatus == running) || (runStatus == init));
189 runStatus = shutdown; 188 runStatus = shutdown;
190 QApplication::exit(exitStatus); 189 QApplication::exit(exitStatus);
191 /* The destructor of PwMInit is called when control 190 /* The destructor of PwMInit is called when control
192 * leaves main() 191 * leaves main()
193 */ 192 */
194} 193}
195 194
196void PwMInit::initPosixSignalHandler() 195void PwMInit::initPosixSignalHandler()
197{ 196{
198 signal(SIGINT, sig_handler); 197 signal(SIGINT, sig_handler);
199 signal(SIGTERM, sig_handler); 198 signal(SIGTERM, sig_handler);
200} 199}
201 200
202void PwMInit::initDCOP() 201void PwMInit::initDCOP()
203{ 202{
204#ifndef PWM_EMBEDDED 203#ifndef PWM_EMBEDDED
205 _dcopClient = app->dcopClient(); 204 _dcopClient = app->dcopClient();
206 _dcopClient->setNotifications(true); 205 _dcopClient->setNotifications(true);
207#endif 206#endif
208 207
209} 208}
210 209
211void PwMInit::initKWalletEmu(bool forceDisable, bool forceReload) 210void PwMInit::initKWalletEmu(bool forceDisable, bool forceReload)
212{ 211{
213#ifdef CONFIG_KWALLETIF 212#ifdef CONFIG_KWALLETIF
214 if (!conf()->confGlobKwalletEmu() || 213 if (!conf()->confGlobKwalletEmu() ||
215 forceDisable) { 214 forceDisable) {
216 delete_ifnot_null(_kwalletEmu); 215 delete_ifnot_null(_kwalletEmu);
217 return; 216 return;
218 } 217 }
219 try { 218 try {
220 if (_kwalletEmu && forceReload) 219 if (_kwalletEmu && forceReload)
221 delete_and_null(_kwalletEmu); 220 delete_and_null(_kwalletEmu);
222 if (!_kwalletEmu) 221 if (!_kwalletEmu)
223 _kwalletEmu = new KWalletEmu(this); 222 _kwalletEmu = new KWalletEmu(this);
224 } catch (PwMException e) { 223 } catch (PwMException e) {
225 string errMsg("initializing KWallet emulation failed. ID: "); 224 string errMsg("initializing KWallet emulation failed. ID: ");
226 errMsg += tostr(static_cast<int>(e.getId())); 225 errMsg += tostr(static_cast<int>(e.getId()));
227 errMsg += " err-message: "; 226 errMsg += " err-message: ";
228 errMsg += e.getMessage(); 227 errMsg += e.getMessage();
229 printWarn(errMsg); 228 printWarn(errMsg);
230 return; 229 return;
231 } 230 }
232#else // CONFIG_KWALLETIF 231#else // CONFIG_KWALLETIF
233 PARAM_UNUSED(forceDisable); 232 PARAM_UNUSED(forceDisable);
234 PARAM_UNUSED(forceReload); 233 PARAM_UNUSED(forceReload);
235#endif // CONFIG_KWALLETIF 234#endif // CONFIG_KWALLETIF
236} 235}
237 236
238void PwMInit::initKeycard() 237void PwMInit::initKeycard()
239{ 238{
240#ifdef CONFIG_KEYCARD 239#ifdef CONFIG_KEYCARD
241 PWM_ASSERT(!_keycard); 240 PWM_ASSERT(!_keycard);
242 _keycard = new PwMKeyCard(this); 241 _keycard = new PwMKeyCard(this);
243#endif // CONFIG_KEYCARD 242#endif // CONFIG_KEYCARD
244} 243}
245 244
246void PwMInit::initTray() 245void PwMInit::initTray()
247{ 246{
248#ifdef PWM_EMBEDDED 247#ifdef PWM_EMBEDDED
249 //US ENH : embedded version does not support a tray 248 //US ENH : embedded version does not support a tray
250 return; 249 return;
251#endif 250#endif
252 251
253 if (!conf()->confGlobTray()) { 252 if (!conf()->confGlobTray()) {
254 if (!_tray) 253 if (!_tray)
255 return; 254 return;
256 _tray->hide(); 255 _tray->hide();
257 delete_and_null(_tray); 256 delete_and_null(_tray);
258 return; 257 return;
259 } 258 }
260 if (_tray) 259 if (_tray)
261 return; 260 return;
262 _tray = new PwMTray(this); 261 _tray = new PwMTray(this);
263 connect(_tray, SIGNAL(quitSelected()), 262 connect(_tray, SIGNAL(quitSelected()),
264 this, SLOT(removeTrayAndQuit())); 263 this, SLOT(removeTrayAndQuit()));
265 connect(_tray, SIGNAL(closed(PwMTray *)), 264 connect(_tray, SIGNAL(closed(PwMTray *)),
266 this, SLOT(trayIconClosed(PwMTray *))); 265 this, SLOT(trayIconClosed(PwMTray *)));
267 KIconLoader icons; 266 KIconLoader icons;
268#ifndef PWM_EMBEDDED 267#ifndef PWM_EMBEDDED
269 _tray->setPixmap(icons.loadIcon(PACKAGE_NAME, KIcon::Small)); 268 _tray->setPixmap(icons.loadIcon(PACKAGE_NAME, KIcon::Small));
270#endif 269#endif
271 _tray->show(); 270 _tray->show();
272 // connect the signals of all open documents. 271 // connect the signals of all open documents.
273 const vector<PwMDocList::listItem> *dl = PwMDoc::getOpenDocList()->getList(); 272 const vector<PwMDocList::listItem> *dl = PwMDoc::getOpenDocList()->getList();
274 vector<PwMDocList::listItem>::const_iterator i = dl->begin(), 273 vector<PwMDocList::listItem>::const_iterator i = dl->begin(),
275 end = dl->end(); 274 end = dl->end();
276 while (i != end) { 275 while (i != end) {
277 _tray->connectDocToTray((*i).doc); 276 _tray->connectDocToTray((*i).doc);
278 ++i; 277 ++i;
279 } 278 }
280} 279}
281 280
282void PwMInit::removeTrayAndQuit() 281void PwMInit::removeTrayAndQuit()
283{ 282{
284 PWM_ASSERT(_tray); 283 PWM_ASSERT(_tray);
285 // _tray is deleted in ~PwMInit 284 // _tray is deleted in ~PwMInit
286 shutdownApp(0); 285 shutdownApp(0);
287} 286}
288 287
289PwM * PwMInit::createMainWnd(const QString &loadFile, 288PwM * PwMInit::createMainWnd(const QString &loadFile,
290 bool loadFileDeepLocked, 289 bool loadFileDeepLocked,
291 bool virginity, 290 bool virginity,
292 PwMDoc *doc, 291 PwMDoc *doc,
293 bool minimized) 292 bool minimized)
294{ 293{
295 qDebug("PwMInit::createMainWnd ");
296 PwM *newWnd; 294 PwM *newWnd;
297 if (!doc) 295 if (!doc)
298 doc = createDoc(); 296 doc = createDoc();
299 newWnd = new PwM(this, doc, virginity); 297 newWnd = new PwM(this, doc, virginity);
300#ifndef PWM_EMBEDDED 298#ifndef PWM_EMBEDDED
301 _mainWndList.push_back(newWnd); 299 _mainWndList.push_back(newWnd);
302#else 300#else
303 _mainWndList.append(newWnd); 301 _mainWndList.append(newWnd);
304#endif 302#endif
305 connect(newWnd, SIGNAL(closed(PwM *)), 303 connect(newWnd, SIGNAL(closed(PwM *)),
306 this, SLOT(mainWndClosed(PwM *))); 304 this, SLOT(mainWndClosed(PwM *)));
307 connect(newWnd, SIGNAL(gotFocus(PwM *)), 305 connect(newWnd, SIGNAL(gotFocus(PwM *)),
308 this, SLOT(setCurWidget(PwM *))); 306 this, SLOT(setCurWidget(PwM *)));
309 connect(newWnd, SIGNAL(lostFocus(PwM *)), 307 connect(newWnd, SIGNAL(lostFocus(PwM *)),
310 this, SLOT(resetCurWidget())); 308 this, SLOT(resetCurWidget()));
311 309
312 //US ENH 310 //US ENH
313#ifndef PWM_EMBEDDED 311#ifndef PWM_EMBEDDED
314 if (minimized) 312 if (minimized)
315 newWnd->showMinimized(); 313 newWnd->showMinimized();
316 else 314 else
317 newWnd->show(); 315 newWnd->show();
318 316
319#else //PWM_EMBEDDED 317#else //PWM_EMBEDDED
320 318
321#ifndef DESKTOP_VERSION 319#ifndef DESKTOP_VERSION
322 app->showMainWidget( newWnd ); 320 app->showMainWidget( newWnd );
323#else //DESKTOP_VERSION 321#else //DESKTOP_VERSION
324 app->setMainWidget( newWnd ); 322 app->setMainWidget( newWnd );
325 newWnd->resize (640, 480 ); 323 newWnd->resize (640, 480 );
326 newWnd->show(); 324 newWnd->show();
327 qDebug("show "); 325 qDebug("show ");
328#endif //DESKTOP_VERSION 326#endif //DESKTOP_VERSION
329 327
330#endif //PWM_EMBEDDED 328#endif //PWM_EMBEDDED
331 329
332 if (loadFile != QString::null && 330 if (loadFile != QString::null &&
333 loadFile != "") { 331 loadFile != "") {
334 newWnd->openDoc(loadFile, loadFileDeepLocked); 332 newWnd->openDoc(loadFile, loadFileDeepLocked);
335 } 333 }
336 return newWnd; 334 return newWnd;
337} 335}
338 336
339PwMDoc * PwMInit::createDoc() 337PwMDoc * PwMInit::createDoc()
340{ 338{
341 PwMDoc *doc = new PwMDoc(this); 339 PwMDoc *doc = new PwMDoc(this);
342#ifdef CONFIG_KEYCARD 340#ifdef CONFIG_KEYCARD
343 doc->setPwMKeyCard(keycard()); 341 doc->setPwMKeyCard(keycard());
344#endif 342#endif
345#ifdef CONFIG_KWALLETIF 343#ifdef CONFIG_KWALLETIF
346 if (kwalletEmu()) 344 if (kwalletEmu())
347 kwalletEmu()->connectDocSignals(doc); 345 kwalletEmu()->connectDocSignals(doc);
348#endif 346#endif
349 347
350 if (_tray) 348 if (_tray)
351 _tray->connectDocToTray(doc); 349 _tray->connectDocToTray(doc);
352 350
353 return doc; 351 return doc;
354 352
355} 353}
356 354
357void PwMInit::mainWndClosed(PwM *wnd) 355void PwMInit::mainWndClosed(PwM *wnd)
358{ 356{
359 bool doMinimizeToTray = false; 357 bool doMinimizeToTray = false;
360 bool doDeleteDoc = false; 358 bool doDeleteDoc = false;
361#ifndef PWM_EMBEDDED 359#ifndef PWM_EMBEDDED
362 dcopClient()->suspend(); 360 dcopClient()->suspend();
363 dcopClient()->setAcceptCalls(false); 361 dcopClient()->setAcceptCalls(false);
364#endif 362#endif
365again: 363again:
366 364
367 if (wnd->isForceMinimizeToTray()) { 365 if (wnd->isForceMinimizeToTray()) {
368 if (unlikely(!_tray)) { 366 if (unlikely(!_tray)) {
369 /* This should not happen! If we set forceMinimizeToTray , 367 /* This should not happen! If we set forceMinimizeToTray ,
370 * we must be sure that _tray exists. 368 * we must be sure that _tray exists.
371 */ 369 */
372 BUG(); 370 BUG();
373 wnd->setForceMinimizeToTray(false); 371 wnd->setForceMinimizeToTray(false);
374 goto again; 372 goto again;
375 } 373 }
376 doMinimizeToTray = true; 374 doMinimizeToTray = true;
377 } else { 375 } else {
378 // Ask to minimize to tray. If not, delete doc. 376 // Ask to minimize to tray. If not, delete doc.
379 if (_tray && 377 if (_tray &&
380 runStatus != shutdown && 378 runStatus != shutdown &&
381 !wnd->isForceQuit() && 379 !wnd->isForceQuit() &&
382 !wnd->curDoc()->isDeleted()) { 380 !wnd->curDoc()->isDeleted()) {
383 if (conf()->confWndClose()) 381 if (conf()->confWndClose())
384 doDeleteDoc = true; 382 doDeleteDoc = true;
385 else 383 else
386 doMinimizeToTray = true; 384 doMinimizeToTray = true;
387 } else { 385 } else {
388 doDeleteDoc = true; 386 doDeleteDoc = true;
389 } 387 }
390 } 388 }
391 389
392 if (doMinimizeToTray) { 390 if (doMinimizeToTray) {
393 391
394 PWM_ASSERT(_tray); 392 PWM_ASSERT(_tray);
395 int mmlock = conf()->confGlobMinimizeLock(); 393 int mmlock = conf()->confGlobMinimizeLock();
396 switch (mmlock) { 394 switch (mmlock) {
397 case 0: // don't lock anything 395 case 0: // don't lock anything
398 break; 396 break;
399 case 1: // normal lock 397 case 1: // normal lock
400 wnd->curDoc()->lockAll(true); 398 wnd->curDoc()->lockAll(true);
401 break; 399 break;
402 case 2: // deep-lock 400 case 2: // deep-lock
403 wnd->curDoc()->deepLock(); 401 wnd->curDoc()->deepLock();
404 break; 402 break;
405 default: 403 default:
406 WARN(); 404 WARN();
407 } 405 }
408 } else if (doDeleteDoc) { 406 } else if (doDeleteDoc) {
409 if (!wnd->curDoc()->tryDelete()) { 407 if (!wnd->curDoc()->tryDelete()) {
410 /* We failed deleting the doc, 408 /* We failed deleting the doc,
411 * so open a new window with it, again. 409 * so open a new window with it, again.
412 */ 410 */
413 createMainWnd(QString::null, false, 411 createMainWnd(QString::null, false,
414 false, wnd->curDoc()); 412 false, wnd->curDoc());
415 } 413 }
416 } 414 }
417#ifndef PWM_EMBEDDED 415#ifndef PWM_EMBEDDED
418 // find the closed window in the "mainWndList" and delete it. 416 // find the closed window in the "mainWndList" and delete it.
419 QValueList<PwM *>::iterator i = _mainWndList.begin(), 417 QValueList<PwM *>::iterator i = _mainWndList.begin(),
420 end = _mainWndList.end(); 418 end = _mainWndList.end();
421#else 419#else
422 // find the closed window in the "mainWndList" and delete it. 420 // find the closed window in the "mainWndList" and delete it.
423 QValueList<PwM *>::Iterator i = _mainWndList.begin(), 421 QValueList<PwM *>::Iterator i = _mainWndList.begin(),