forked from qt-creator/qt-creator
Core: Add legal checkbox
Task-number: QTAIASSIST-122 Change-Id: I3ff4c51e9b09185e3e99c56f658565eaae6f016b Reviewed-by: <peter.schneider@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -45,6 +45,7 @@
|
|||||||
#include <utils/theme/theme_p.h>
|
#include <utils/theme/theme_p.h>
|
||||||
|
|
||||||
#include <QAuthenticator>
|
#include <QAuthenticator>
|
||||||
|
#include <QCheckBox>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
@@ -176,17 +177,27 @@ static void initTAndCAcceptDialog()
|
|||||||
dialog.setWindowTitle(Tr::tr("Terms and Conditions"));
|
dialog.setWindowTitle(Tr::tr("Terms and Conditions"));
|
||||||
|
|
||||||
QDialogButtonBox buttonBox;
|
QDialogButtonBox buttonBox;
|
||||||
|
QCheckBox *acceptCheckBox;
|
||||||
QPushButton *acceptButton
|
QPushButton *acceptButton
|
||||||
= buttonBox.addButton(Tr::tr("Accept"), QDialogButtonBox::ButtonRole::YesRole);
|
= buttonBox.addButton(Tr::tr("Accept"), QDialogButtonBox::ButtonRole::YesRole);
|
||||||
QPushButton *decline
|
QPushButton *decline
|
||||||
= buttonBox.addButton(Tr::tr("Decline"), QDialogButtonBox::ButtonRole::NoRole);
|
= buttonBox.addButton(Tr::tr("Decline"), QDialogButtonBox::ButtonRole::NoRole);
|
||||||
acceptButton->setAutoDefault(false);
|
acceptButton->setAutoDefault(false);
|
||||||
acceptButton->setDefault(false);
|
acceptButton->setDefault(false);
|
||||||
|
acceptButton->setEnabled(false);
|
||||||
decline->setAutoDefault(true);
|
decline->setAutoDefault(true);
|
||||||
decline->setDefault(true);
|
decline->setDefault(true);
|
||||||
QObject::connect(&buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
|
QObject::connect(&buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
|
||||||
QObject::connect(&buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
|
QObject::connect(&buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
|
||||||
|
|
||||||
|
const QLatin1String legal = QLatin1String(
|
||||||
|
"I confirm that I have reviewed and accept the terms and conditions\n"
|
||||||
|
"of this extension. I confirm that I have the authority and ability to\n"
|
||||||
|
"accept the terms and conditions of this extension for the customer.\n"
|
||||||
|
"I acknowledge that if the customer and the Qt Company already have a\n"
|
||||||
|
"valid agreement in place, that agreement shall apply, but these terms\n"
|
||||||
|
"shall govern the use of this extension.");
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
Column {
|
Column {
|
||||||
Tr::tr("The plugin %1 requires you to accept the following terms and conditions:").arg(spec->name()), br,
|
Tr::tr("The plugin %1 requires you to accept the following terms and conditions:").arg(spec->name()), br,
|
||||||
@@ -195,11 +206,14 @@ static void initTAndCAcceptDialog()
|
|||||||
readOnly(true),
|
readOnly(true),
|
||||||
}, br,
|
}, br,
|
||||||
Row {
|
Row {
|
||||||
Tr::tr("Do you wish to accept?"), &buttonBox,
|
acceptCheckBox = new QCheckBox(legal), &buttonBox,
|
||||||
}
|
}
|
||||||
}.attachTo(&dialog);
|
}.attachTo(&dialog);
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
acceptCheckBox, &QCheckBox::toggled, acceptButton, &QPushButton::setEnabled);
|
||||||
|
|
||||||
return dialog.exec() == QDialog::Accepted;
|
return dialog.exec() == QDialog::Accepted;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user