Port away from KDialog to unbreak the build

I couldn't reach this code before from the Qt4 build, sorry for the
temporary breakage.
This commit is contained in:
Kevin Ottens 2013-01-03 08:54:16 +01:00
parent 6a3903262c
commit 7676a7142c
2 changed files with 13 additions and 11 deletions

View File

@ -335,10 +335,9 @@ KConfigDialog *AppletPrivate::generateGenericConfigDialog()
dialog->setWindowTitle(configWindowTitle());
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
q->createConfigurationInterface(dialog);
dialog->showButton(KDialog::Default, false);
dialog->showButton(KDialog::Help, false);
QObject::connect(dialog, SIGNAL(applyClicked()), q, SLOT(configDialogFinished()));
QObject::connect(dialog, SIGNAL(okClicked()), q, SLOT(configDialogFinished()));
dialog->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel);
QObject::connect(dialog->button(QDialogButtonBox::Apply), SIGNAL(clicked()), q, SLOT(configDialogFinished()));
QObject::connect(dialog->button(QDialogButtonBox::Ok), SIGNAL(clicked()), q, SLOT(configDialogFinished()));
return dialog;
}
@ -450,7 +449,7 @@ void AppletPrivate::configDialogFinished()
// the config loader will trigger this for us, so we don't need to.
propagateConfigChanged();
if (KConfigDialog *dialog = qobject_cast<KConfigDialog *>(q->sender())) {
dialog->enableButton(KDialog::Apply, false);
dialog->button(QDialogButtonBox::Apply)->setEnabled(false);
}
}
}

View File

@ -19,6 +19,7 @@
#include "accessappletjob.h"
#include <QPushButton>
#include <qtimer.h>
#include <qtemporarydir.h>
@ -129,17 +130,19 @@ public:
message+= i18n("</table>");
message+= i18n("<br><br>Are you sure you want to open this widget on your system?");
KDialog *dialog = new KDialog;
QDialog *dialog = new QDialog;
dialog->setWindowTitle(i18n("Remote Widget"));
dialog->setButtons(KDialog::Yes|KDialog::No);
dialog->setButtonText(KDialog::Yes, i18n("Open Widget"));
dialog->setButtonText(KDialog::No, i18n("Reject Widget"));
int answer = KMessageBox::createKMessageBox(dialog, KDE::icon(iconName), message,
QDialogButtonBox *buttonBox = new QDialogButtonBox;
buttonBox->setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No);
buttonBox->button(QDialogButtonBox::Yes)->setText(i18n("Open Widget"));
buttonBox->button(QDialogButtonBox::No)->setText(i18n("Reject Widget"));
int answer = KMessageBox::createKMessageBox(dialog, buttonBox, KDE::icon(iconName), message,
QStringList(), QString(), 0,
KMessageBox::Dangerous);
if (answer!=KDialog::Yes) {
if (answer!=QDialogButtonBox::Yes) {
q->setError(-1);
q->setErrorText(i18nc("A remote widget was rejected by the user.", "User rejected"));
q->emitResult();