Use KDialog instead of QMessageBox for confirmation dialog (can't use KMessageBox)
svn path=/trunk/KDE/kdebase/workspace/; revision=714120
This commit is contained in:
parent
d965cdee99
commit
d32b4a3130
2 changed files with 17 additions and 7 deletions
|
@ -24,6 +24,7 @@ License. See the file "COPYING" for the exact licensing terms.
|
|||
|
||||
#include <QtDBus/QtDBus>
|
||||
#include <QTimer>
|
||||
#include <QLabel>
|
||||
#include <KPluginFactory>
|
||||
#include <KPluginLoader>
|
||||
|
||||
|
@ -37,9 +38,16 @@ namespace KWin
|
|||
|
||||
|
||||
ConfirmDialog::ConfirmDialog() :
|
||||
QMessageBox(QMessageBox::Question, i18n("Compositing settings changed"), "",
|
||||
QMessageBox::Yes | QMessageBox::No)
|
||||
KDialog()
|
||||
{
|
||||
setCaption( i18n( "Compositing settings changed" ));
|
||||
setButtons( KDialog::Yes | KDialog::No );
|
||||
setDefaultButton(KDialog::No);
|
||||
setEscapeButton(KDialog::No);
|
||||
|
||||
mTextLabel = new QLabel(this);
|
||||
setMainWidget(mTextLabel);
|
||||
|
||||
mSecondsToLive = 10+1;
|
||||
advanceTimer();
|
||||
}
|
||||
|
@ -52,12 +60,12 @@ void ConfirmDialog::advanceTimer()
|
|||
QString text = i18n("Compositing settings have changed.\n"
|
||||
"Do you want to keep the new settings?\n"
|
||||
"They will be automatically reverted in %1 seconds", mSecondsToLive);
|
||||
setText(text);
|
||||
mTextLabel->setText(text);
|
||||
QTimer::singleShot(1000, this, SLOT(advanceTimer()));
|
||||
}
|
||||
else
|
||||
{
|
||||
reject();
|
||||
slotButtonClicked(KDialog::No);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,7 +133,7 @@ void KWinCompositingConfig::showConfirmDialog()
|
|||
ConfirmDialog confirm;
|
||||
int result = confirm.exec();
|
||||
kDebug() << "result:" << result;
|
||||
if(result != QMessageBox::Yes)
|
||||
if(result != KDialog::Yes)
|
||||
{
|
||||
// Revert settings
|
||||
KConfigGroup config(mKWinConfig, "Compositing");
|
||||
|
|
|
@ -16,17 +16,18 @@ License. See the file "COPYING" for the exact licensing terms.
|
|||
|
||||
#include <ksharedconfig.h>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <kdialog.h>
|
||||
|
||||
#include "ui_main.h"
|
||||
#include "compositingprefs.h"
|
||||
|
||||
class KPluginSelector;
|
||||
class QLabel;
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
class ConfirmDialog : public QMessageBox
|
||||
class ConfirmDialog : public KDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -37,6 +38,7 @@ protected slots:
|
|||
|
||||
private:
|
||||
int mSecondsToLive;
|
||||
QLabel* mTextLabel;
|
||||
};
|
||||
|
||||
class KWinCompositingConfig : public KCModule
|
||||
|
|
Loading…
Reference in a new issue