summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/waitwnd.cpp
Unidiff
Diffstat (limited to 'pwmanager/pwmanager/waitwnd.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/waitwnd.cpp94
1 files changed, 94 insertions, 0 deletions
diff --git a/pwmanager/pwmanager/waitwnd.cpp b/pwmanager/pwmanager/waitwnd.cpp
new file mode 100644
index 0000000..a3f25cc
--- a/dev/null
+++ b/pwmanager/pwmanager/waitwnd.cpp
@@ -0,0 +1,94 @@
1/***************************************************************************
2 * *
3 * copyright (C) 2003 by Michael Buesch *
4 * email: mbuesch@freenet.de *
5 * *
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 *
8 * as published by the Free Software Foundation. *
9 * *
10 ***************************************************************************/
11
12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk
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
16 *
17 * $Id$
18 **************************************************************************/
19
20#include "waitwnd.h"
21#include "globalstuff.h"
22#include "pwmexception.h"
23
24#include <qmessagebox.h>
25
26#include <klocale.h>
27
28
29WaitWnd::WaitWnd(QString caption, QString _staticText,
30 bool showCancelButton, bool showGenericText,
31 QWidget *parent,
32 const char *name, bool modal, WFlags f)
33 : QDialog(parent, name, modal, f)
34{
35 canClose = false;
36 vbox1 = new QVBox(this);
37 staticText = new QLabel(vbox1);
38 if (showGenericText) {
39 genericText = new QLabel(vbox1);
40 genericText->setAlignment(Qt::AlignHCenter | Qt::WordBreak);
41 } else {
42 genericText = 0;
43 }
44 if (showCancelButton) {
45 cancelButton = new QPushButton(vbox1);
46 connect(cancelButton, SIGNAL(clicked()),
47 this, SLOT(cancel_slot()));
48 cancelButton->setText(i18n("&Cancel"));
49 } else {
50 cancelButton = 0;
51 }
52
53 vbox1->setSpacing(10);
54 vbox1->setMargin(10);
55 resize(300, 150);
56 setCaption(caption);
57 staticText->setText(_staticText);
58 staticText->setAlignment(Qt::AlignHCenter | Qt::WordBreak);
59}
60
61WaitWnd::~WaitWnd()
62{
63}
64
65void WaitWnd::resizeEvent(QResizeEvent *)
66{
67 vbox1->resize(size());
68}
69
70void WaitWnd::closeEvent(QCloseEvent *e)
71{
72 if (canClose) {
73 emit goingToClose();
74 e->accept();
75 } else {
76 e->ignore();
77 }
78}
79
80void WaitWnd::cancel_slot()
81{
82 canClose = true;
83 close();
84}
85
86void WaitWnd::updateGenericText(const QString &text)
87{
88 if (genericText)
89 genericText->setText(text);
90}
91
92#ifndef PWM_EMBEDDED
93#include "waitwnd.moc"
94#endif