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
|
/***************************************************************************
* Copyright (C) 2005 by Danny Kukawka *
* [email protected], [email protected] *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of version 2 of the GNU General Public License *
* as published by the Free Software Foundation. *
* *
* 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., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
/*!
* \file infodialog.cpp
* \brief In this file can be found the "information dialog with checkbox"
* related code.
* \author Danny Kukawka, <[email protected]>, <[email protected]>
* \date 2005
*/
// own headers
#include "infodialog.h"
// KDE headers:
#include <kiconloader.h>
#include <tdelocale.h>
// QT headers:
#include <tqcheckbox.h>
#include <tqdialog.h>
#include <tqlabel.h>
#include <tqpushbutton.h>
#include <tqstring.h>
#include <tqtooltip.h>
/*! This is the default constructor of class infoDialog . */
infoDialog::infoDialog( TDEConfig *config, TQString captionName, TQString message,
TQString dontShowAgainMsg, TQString settingsEntryName,
TQWidget *parent, const char *name)
:info_Dialog( parent, name, false, TQt::WStyle_StaysOnTop | WDestructiveClose )
{
if ( message.isEmpty() || (!dontShowAgainMsg.isEmpty() && settingsEntryName.isEmpty()) ||
(!dontShowAgainMsg.isEmpty() && (config == 0)))
close();
if (config != 0) {
settings = config;
settings->reparseConfiguration();
if (settings->hasGroup("infoDialog")){
settings->setGroup("infoDialog");
if (settings->readBoolEntry(settingsEntryName, false)) {
dialogDisabled = true;
//close();
}
else
dialogDisabled = false;
}
}
buttonOK->setIconSet(SmallIconSet("ok", TQIconSet::Automatic));
TQPixmap pixmap = 0;
pixmap = TDEGlobal::iconLoader()->loadIcon("messagebox_warning", TDEIcon::NoGroup, TDEIcon::SizeMedium);
iconPixmap->setPixmap( pixmap );
msgText->setText(message);
if (!captionName.isEmpty())
this->setCaption(i18n("TDEPowersave") + " - " + captionName);
else
this->setCaption(i18n("TDEPowersave"));
if (dontShowAgainMsg.isEmpty()) {
dontShowAgain->setHidden(true);
} else {
entryName = settingsEntryName;
dontShowAgain->setText(dontShowAgainMsg);
dontShowAgain->setHidden(false);
}
this->adjustSize();
}
/*! This is the default destructor of class infoDialog . */
infoDialog::~infoDialog()
{
// no need to delete child widgets, TQt does it all for us
}
/*!
* Use this function to get the value of \ref dialogDisabled.
* \return boolean with value of \ref dialogDisabled
* \retval true if disabled by user before
* \retval false if not
*/
bool infoDialog::dialogIsDisabled() {
return dialogDisabled;
}
/*!
* SLOT: called if the 'ok' button clicked. This TQT_SLOT sync the settings
* and close the dialog.
*/
void infoDialog::ButtonOK_clicked() {
if (!entryName.isEmpty() && dontShowAgain->isVisible()) {
settings->setGroup( "infoDialog" );
settings->writeEntry( entryName, dontShowAgain->isChecked());
settings->sync();
}
close();
}
#include "infodialog.moc"
|