Changeset View
Changeset View
Standalone View
Standalone View
AuthDialog.cpp
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | 53 | if (parent > 0) { | |||
---|---|---|---|---|---|
61 | 61 | | |||
62 | // raise on top | 62 | // raise on top | ||
63 | activateWindow(); | 63 | activateWindow(); | ||
64 | raise(); | 64 | raise(); | ||
65 | } | 65 | } | ||
66 | 66 | | |||
67 | setupUi(this); | 67 | setupUi(this); | ||
68 | 68 | | |||
69 | connect(userCB, QOverload<int>::of(&QComboBox::currentIndexChanged), | ||||
70 | this, &AuthDialog::checkSelectedUser); | ||||
71 | | ||||
69 | connect(buttonBox, &QDialogButtonBox::accepted, this, &AuthDialog::okClicked); | 72 | connect(buttonBox, &QDialogButtonBox::accepted, this, &AuthDialog::okClicked); | ||
70 | connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); | 73 | connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); | ||
71 | connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); | 74 | connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); | ||
72 | 75 | | |||
73 | QString detailsButtonText = i18n("Details"); | 76 | QString detailsButtonText = i18n("Details"); | ||
74 | QPushButton* detailsButton = new QPushButton(detailsButtonText + " >>"); | 77 | QPushButton* detailsButton = new QPushButton(detailsButtonText + " >>"); | ||
75 | detailsButton->setIcon(QIcon::fromTheme("help-about")); | 78 | detailsButton->setIcon(QIcon::fromTheme("help-about")); | ||
76 | detailsButton->setCheckable(true); | 79 | detailsButton->setCheckable(true); | ||
▲ Show 20 Lines • Show All 197 Lines • ▼ Show 20 Line(s) | 276 | if (userCB->currentIndex() == -1) | |||
274 | return PolkitQt1::Identity(); | 277 | return PolkitQt1::Identity(); | ||
275 | 278 | | |||
276 | const QString id = userCB->currentData().toString(); | 279 | const QString id = userCB->currentData().toString(); | ||
277 | if (id.isEmpty()) | 280 | if (id.isEmpty()) | ||
278 | return PolkitQt1::Identity(); | 281 | return PolkitQt1::Identity(); | ||
279 | return PolkitQt1::Identity::fromString(id); | 282 | return PolkitQt1::Identity::fromString(id); | ||
280 | } | 283 | } | ||
281 | 284 | | |||
282 | void AuthDialog::on_userCB_currentIndexChanged(int /*index*/) | 285 | void AuthDialog::checkSelectedUser() | ||
283 | { | 286 | { | ||
284 | PolkitQt1::Identity identity = adminUserSelected(); | 287 | PolkitQt1::Identity identity = adminUserSelected(); | ||
285 | // itemData is Null when "Select user" is selected | 288 | // itemData is Null when "Select user" is selected | ||
286 | if (!identity.isValid()) { | 289 | if (!identity.isValid()) { | ||
287 | lePassword->setEnabled(false); | 290 | lePassword->setEnabled(false); | ||
288 | lblPassword->setEnabled(false); | 291 | lblPassword->setEnabled(false); | ||
289 | buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); | 292 | buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); | ||
290 | } else { | 293 | } else { | ||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |