author | zautrix <zautrix> | 2004-10-19 23:51:51 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-19 23:51:51 (UTC) |
commit | a9119c4edc272815121ddc863963b5289bb95b13 (patch) (unidiff) | |
tree | f515514cda0e212da6722ef8baf5d378e08d34eb | |
parent | f013ff3c0108100c6dbf037a05502ed493361fbf (diff) | |
download | kdepimpi-a9119c4edc272815121ddc863963b5289bb95b13.zip kdepimpi-a9119c4edc272815121ddc863963b5289bb95b13.tar.gz kdepimpi-a9119c4edc272815121ddc863963b5289bb95b13.tar.bz2 |
more fixes
-rw-r--r-- | pwmanager/pwmanager/getmasterpwwnd_emb.cpp | 11 | ||||
-rw-r--r-- | pwmanager/pwmanager/main.cpp | 1 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwminit.cpp | 4 |
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 | |||
@@ -3,164 +3,169 @@ | |||
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 | */ |
50 | getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name) | 50 | getMasterPwWnd::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 | */ |
124 | getMasterPwWnd::~getMasterPwWnd() | 129 | getMasterPwWnd::~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 | ||
129 | void getMasterPwWnd::okButton_slot() | 134 | void 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 | ||
134 | void getMasterPwWnd::cancelButton_slot() | 139 | void 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 | ||
139 | void getMasterPwWnd::add0() | 144 | void getMasterPwWnd::add0() |
140 | { | 145 | { |
141 | addCharacter("0"); | 146 | addCharacter("0"); |
142 | } | 147 | } |
143 | void getMasterPwWnd::add1() | 148 | void getMasterPwWnd::add1() |
144 | { | 149 | { |
145 | addCharacter("1"); | 150 | addCharacter("1"); |
146 | } | 151 | } |
147 | void getMasterPwWnd::add2() | 152 | void getMasterPwWnd::add2() |
148 | { | 153 | { |
149 | addCharacter("2"); | 154 | addCharacter("2"); |
150 | } | 155 | } |
151 | void getMasterPwWnd::add3() | 156 | void getMasterPwWnd::add3() |
152 | { | 157 | { |
153 | addCharacter("3"); | 158 | addCharacter("3"); |
154 | } | 159 | } |
155 | void getMasterPwWnd::add4() | 160 | void getMasterPwWnd::add4() |
156 | { | 161 | { |
157 | addCharacter("4"); | 162 | addCharacter("4"); |
158 | } | 163 | } |
159 | void getMasterPwWnd::add5() | 164 | void getMasterPwWnd::add5() |
160 | { | 165 | { |
161 | addCharacter("5"); | 166 | addCharacter("5"); |
162 | } | 167 | } |
163 | void getMasterPwWnd::add6() | 168 | void getMasterPwWnd::add6() |
164 | { | 169 | { |
165 | addCharacter("6"); | 170 | addCharacter("6"); |
166 | } | 171 | } |
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 | |||
@@ -142,73 +142,72 @@ int main(int argc, char *argv[]) | |||
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 | |||
@@ -68,142 +68,141 @@ static NOREGPARM void sig_handler(int signum) | |||
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | 71 | ||
72 | 72 | ||
73 | 73 | ||
74 | PwMInit::PwMInit(PwMApplication *_app) | 74 | PwMInit::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 | ||
86 | PwMInit::~PwMInit() | 86 | PwMInit::~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 | ||
130 | void PwMInit::initializeApp() | 130 | void 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 | ||
184 | void PwMInit::shutdownApp(int exitStatus) | 183 | void 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 | ||
196 | void PwMInit::initPosixSignalHandler() | 195 | void 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 | ||
202 | void PwMInit::initDCOP() | 201 | void 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 | } |
@@ -231,129 +230,128 @@ void PwMInit::initKWalletEmu(bool forceDisable, bool forceReload) | |||
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 | ||
238 | void PwMInit::initKeycard() | 237 | void 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 | ||
246 | void PwMInit::initTray() | 245 | void 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 | ||
282 | void PwMInit::removeTrayAndQuit() | 281 | void 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 | ||
289 | PwM * PwMInit::createMainWnd(const QString &loadFile, | 288 | PwM * 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 | ||
339 | PwMDoc * PwMInit::createDoc() | 337 | PwMDoc * 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 | ||
357 | void PwMInit::mainWndClosed(PwM *wnd) | 355 | void PwMInit::mainWndClosed(PwM *wnd) |
358 | { | 356 | { |
359 | bool doMinimizeToTray = false; | 357 | bool doMinimizeToTray = false; |