Commit b340539e authored by Scott Harvey's avatar Scott Harvey Committed by Nate Graham
Browse files

Polish `Details` panel; added "Not Applicable" to fill otherwise blank spaces

Summary: Aligned detail item labels; added "Not Applicable" when PolicyKit info is missing

Test Plan:
- Apply patch
- Kill and relaunch `polkit-kde-authentication-agent-1`
- Launch an application or change a KCM that prompts for authorization
- Check that details are no longer left blank

Reviewers: davidedmundson, ngraham, #plasma

Reviewed By: davidedmundson, ngraham, #plasma

Subscribers: abetts, plasma-devel, #plasma

Tags: #plasma

Maniphest Tasks: T8569

Differential Revision: https://phabricator.kde.org/D12479
parent a69e7559
......@@ -323,7 +323,15 @@ AuthDetails::AuthDetails(const PolkitQt1::Details &details,
{
setupUi(this);
app_label->setText(appname);
// better N/A than a blank space
if (appname.isEmpty()) {
QFont nameFont = app_label->font();
nameFont.setItalic(true);
app_label->setFont(nameFont);
app_label->setText(i18n("Not Applicable"));
} else {
app_label->setText(appname);
}
foreach(const QString &key, details.keys()) { //krazy:exclude=foreach (Details is not a map/hash, but rather a method)
int row = gridLayout->rowCount() + 1;
......@@ -333,12 +341,27 @@ AuthDetails::AuthDetails(const PolkitQt1::Details &details,
"provided by polkit", "%1:", key));
gridLayout->addWidget(keyLabel, row, 0);
keyLabel->setAlignment(Qt::AlignRight);
QFont lblFont(keyLabel->font());
lblFont.setBold(true);
keyLabel->setFont(lblFont);
QLabel *valueLabel = new QLabel(this);
valueLabel->setText(details.lookup(key));
gridLayout->addWidget(valueLabel, row, 1);
}
action_label->setText(actionDescription.description());
// replace blank description
// neither isEmpty() or isNull() worked (?)
if (actionDescription.description() == "") {
QFont descrFont(action_label->font());
descrFont.setItalic(true);
action_label->setFont(descrFont);
action_label->setText(i18n("Not Applicable"));
} else {
action_label->setText(actionDescription.description());
}
action_id_label->setText(actionDescription.actionId());
QString vendor = actionDescription.vendorName();
......
......@@ -19,15 +19,27 @@
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Action:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1" colspan="3">
<widget class="QLabel" name="action_label">
<property name="text">
<string>Action:</string>
<string>&lt;null&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
......@@ -38,31 +50,52 @@
</property>
</widget>
</item>
<item row="4" column="1" colspan="3">
<item row="5" column="1" colspan="3">
<widget class="KUrlLabel" name="vendorUL">
<property name="text">
<string>Vendor:</string>
</property>
<property name="tipText" stdset="0">
<property name="tipText">
<string/>
</property>
<property name="useTips" stdset="0">
<property name="glowEnabled">
<bool>false</bool>
</property>
<property name="useTips">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="vendorL">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Vendor:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Application:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
......@@ -70,6 +103,9 @@
<property name="text">
<string>Application:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="3" column="1">
......@@ -85,6 +121,22 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Action ID:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment