1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
/***************************************************************************
* Copyright (C) 2012 by Timothy Pearson *
* [email protected] *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <tdeconfig.h>
#include <tdeapplication.h>
#include <kdialog.h>
#include <klocale.h>
#include <kiconloader.h>
#include <tqlayout.h>
#include <tqobjectlist.h>
#include <tqguardedptr.h>
#include <tqlineedit.h>
#include <tqvaluelist.h>
#include <tqtimer.h>
#include <tqcursor.h>
#include <tqlabel.h>
#include <tqstyle.h>
#include <tqimage.h>
#ifdef Q_WS_X11
#include <netwm.h>
#endif
#include "processingdialog.h"
ProcessingDialogHeader::ProcessingDialogHeader(TQWidget* parent)
: TQWidget( parent, "", Qt::WDestructiveClose )
{
TQVBoxLayout* vbox = new TQVBoxLayout( this );
TQFrame* frame = new TQFrame( this );
frame->setFrameStyle( TQFrame::NoFrame );
frame->setLineWidth( 0 );
// we need to set the minimum size for the window
frame->setMinimumWidth(300);
vbox->addWidget( frame );
TQGridLayout* gbox = new TQGridLayout( frame, 1, 1, 0, KDialog::spacingHint() );
TQHBoxLayout* centerbox = new TQHBoxLayout( KDialog::spacingHint() );
TQHBoxLayout* seperatorbox = new TQHBoxLayout( 0 );
centerbox->setMargin(0);
seperatorbox->setMargin(0);
TQWidget* swidget = new TQWidget( frame );
swidget->resize(2, frame->sizeHint().width());
swidget->setBackgroundColor(Qt::black);
seperatorbox->addWidget( swidget, AlignCenter );
TQLabel* label = new TQLabel( i18n("LDAP/Kerberos Realm Configuration"), frame );
TQFont fnt = label->font();
fnt.setBold( true );
label->setFont( fnt );
centerbox->addWidget( label, AlignCenter );
gbox->addLayout(centerbox, 0, 0);
gbox->addLayout(seperatorbox, 1, 0);
setFixedSize( sizeHint() );
}
ProcessingDialogHeader::~ProcessingDialogHeader()
{
}
ProcessingDialog::ProcessingDialog(TQWidget* parent)
: TQWidget( parent, "systemmodaldialogclass", Qt::WType_Dialog | Qt::WDestructiveClose ), m_keepOnTopTimer(NULL), m_allowClose(false)
{
// Signal that we do not want any window controls to be shown at all
Atom kde_wm_system_modal_notification;
kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_KDE_WM_MODAL_SYS_NOTIFICATION", False);
XChangeProperty(tqt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L);
TQVBoxLayout* vbox = new TQVBoxLayout( this );
TQFrame* frame = new TQFrame( this );
frame->setFrameStyle( TQFrame::NoFrame );
frame->setLineWidth( style().pixelMetric( TQStyle::PM_DefaultFrameWidth, frame ) );
// we need to set the minimum size for the window
frame->setMinimumWidth(400);
vbox->addWidget( frame );
TQGridLayout* gbox = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() );
TQHBoxLayout* centerbox = new TQHBoxLayout( frame, 0, KDialog::spacingHint() );
m_statusLabel = new TQLabel( i18n("Pondering what to do next").append("..."), frame );
TQFont fnt = m_statusLabel->font();
fnt.setBold( false );
fnt.setPointSize( fnt.pointSize() * 1 );
m_statusLabel->setFont( fnt );
gbox->addMultiCellWidget( m_statusLabel, 2, 2, 0, 0, AlignLeft | AlignVCenter );
ProcessingDialogHeader *theader = new ProcessingDialogHeader(this);
centerbox->addWidget( theader, AlignCenter );
gbox->addLayout(centerbox, 0, 0);
setFixedSize( sizeHint() );
setCaption( i18n("Please wait...") );
// Center the dialog
TQSize sh = sizeHint();
TQRect rect = parent->geometry();
move(rect.x() + (rect.width() - sh.width())/2, rect.y() + (rect.height() - sh.height())/2);
show();
keepMeOnTop();
}
ProcessingDialog::~ProcessingDialog()
{
m_keepOnTopTimer->stop();
delete m_keepOnTopTimer;
}
void ProcessingDialog::keepMeOnTop()
{
if (!m_keepOnTopTimer) {
m_keepOnTopTimer = new TQTimer();
connect(m_keepOnTopTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(keepMeOnTop()));
m_keepOnTopTimer->start(100, FALSE);
}
setActiveWindow();
raise();
setFocus();
}
void ProcessingDialog::setStatusMessage(TQString message)
{
if (message == "") {
m_statusLabel->setText(i18n("Pondering what to do next").append("..."));
}
else {
m_statusLabel->setText(message);
}
}
void ProcessingDialog::closeDialog()
{
m_allowClose = true;
close();
}
void ProcessingDialog::closeEvent(TQCloseEvent *e)
{
//---------------------------------------------
// Don't call the base function because
// we want to ignore the close event
//---------------------------------------------
if (m_allowClose)
TQWidget::closeEvent(e);
}
#include "processingdialog.moc"
|