summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2021-12-28 14:28:11 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2021-12-28 14:28:11 +0900
commitfa8c5e1b82e6a9e3d6eefc96241efc9371f02a12 (patch)
treef699c8de675ca852af5fcaf0ff82e292845dede0 /src
parenta1aaa8e3767232d3d367f4f4221ba45796c4dc6f (diff)
downloadpolkit-agent-tde-fa8c5e1b82e6a9e3d6eefc96241efc9371f02a12.tar.gz
polkit-agent-tde-fa8c5e1b82e6a9e3d6eefc96241efc9371f02a12.zip
Improved GUI dialog presentation.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src')
-rw-r--r--src/AuthDialog.cpp67
-rw-r--r--src/AuthDialogWidget.ui23
-rw-r--r--src/polkit-listener.cpp2
3 files changed, 43 insertions, 49 deletions
diff --git a/src/AuthDialog.cpp b/src/AuthDialog.cpp
index 2079bca..03872af 100644
--- a/src/AuthDialog.cpp
+++ b/src/AuthDialog.cpp
@@ -112,6 +112,7 @@ AuthDialog::AuthDialog(const TQString &actionId, const TQString &message,
m_userData.append(identities[0].toString());
m_authWidget->userCB->setCurrentItem(0);
}
+ on_userCB_currentIndexChanged(-1);
}
AuthDialog::~AuthDialog()
@@ -131,41 +132,41 @@ void AuthDialog::setRequest(const TQString &request, bool requiresAdmin)
Identity identity = adminUserSelected();
if (request.startsWith("password:", false))
{
- if (requiresAdmin)
- {
- if (!identity.isValid())
- {
- m_authWidget->lblPassword->setText(i18n("Password for root:"));
- }
- else
- {
- TQString username = identity.toString().remove("unix-user:");
- m_authWidget->lblPassword->setText(i18n("Password for %1:").arg(username));
- }
- }
- else
- {
- m_authWidget->lblPassword->setText(i18n("Password:"));
- }
+ if (!identity.isValid())
+ {
+ m_authWidget->lblPassword->setText(i18n("Password for root:"));
+ }
+ else
+ {
+ if (!m_authWidget->userCB->isVisible())
+ {
+ TQString username = identity.toString().remove("unix-user:");
+ m_authWidget->lblPassword->setText(i18n("Password for %1:").arg(username));
+ }
+ else
+ {
+ m_authWidget->lblPassword->setText(i18n("Password:"));
+ }
+ }
}
else if (request.startsWith("password or swipe finger:"), false)
{
- if (requiresAdmin)
- {
- if (!identity.isValid())
- {
- m_authWidget->lblPassword->setText(i18n("Password or swipe finger for root:"));
- }
- else
- {
- TQString username = identity.toString().remove("unix-user:");
- m_authWidget->lblPassword->setText(i18n("Password or swipe finger for %1:").arg(username));
- }
- }
- else
- {
- m_authWidget->lblPassword->setText(i18n("Password or swipe finger:"));
- }
+ if (!identity.isValid())
+ {
+ m_authWidget->lblPassword->setText(i18n("Password or swipe finger for root:"));
+ }
+ else
+ {
+ if (!m_authWidget->userCB->isVisible())
+ {
+ TQString username = identity.toString().remove("unix-user:");
+ m_authWidget->lblPassword->setText(i18n("Password or swipe finger for %1:").arg(username));
+ }
+ else
+ {
+ m_authWidget->lblPassword->setText(i18n("Password or swipe finger:"));
+ }
+ }
}
else
{
@@ -261,6 +262,7 @@ void AuthDialog::on_userCB_currentIndexChanged(int /*index*/)
if (!identity.isValid())
{
m_authWidget->lePassword->setEnabled(false);
+ m_authWidget->lblPassword->setText(i18n("Password:"));
m_authWidget->lblPassword->setEnabled(false);
enableButtonOK(false);
}
@@ -283,7 +285,6 @@ TQString AuthDialog::password() const
void AuthDialog::authenticationFailure()
{
- // TODO errorMessageKTW->setText(i18n("Authentication failure, please try again."), KTitleWidget::ErrorMessage);
TQFont bold = font();
bold.setBold(true);
m_authWidget->errorMessageKTW->setText(i18n("Authentication failure, please try again."));
diff --git a/src/AuthDialogWidget.ui b/src/AuthDialogWidget.ui
index 0425eb1..daf4cb2 100644
--- a/src/AuthDialogWidget.ui
+++ b/src/AuthDialogWidget.ui
@@ -8,8 +8,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>335</width>
- <height>193</height>
+ <width>300</width>
+ <height>200</height>
</rect>
</property>
<property name="sizePolicy">
@@ -115,7 +115,7 @@
</widget>
</vbox>
</widget>
- <widget class="TQLabel" row="2" column="1" colspan="3">
+ <widget class="TQLabel" row="1" column="1" colspan="3">
<property name="name">
<cstring>errorMessageKTW</cstring>
</property>
@@ -128,6 +128,11 @@
</sizepolicy>
</property>
</widget>
+ <widget class="KComboBox" row="2" column="1" colspan="3">
+ <property name="name">
+ <cstring>userCB</cstring>
+ </property>
+ </widget>
<widget class="TQLabel" row="3" column="1" colspan="2">
<property name="name">
<cstring>lblPassword</cstring>
@@ -147,20 +152,8 @@
<enum>Password</enum>
</property>
</widget>
- <widget class="KComboBox" row="1" column="1" colspan="3">
- <property name="name">
- <cstring>userCB</cstring>
- </property>
- </widget>
</grid>
</widget>
- <!--customwidgets>
- <customwidget>
- <class>KTitleWidget</class>
- <extends>TQWidget</extends>
- <header>ktitlewidget.h</header>
- </customwidget>
- </customwidgets-->
<tabstops>
<tabstop>userCB</tabstop>
<tabstop>lePassword</tabstop>
diff --git a/src/polkit-listener.cpp b/src/polkit-listener.cpp
index efd5261..f58a6c6 100644
--- a/src/polkit-listener.cpp
+++ b/src/polkit-listener.cpp
@@ -178,7 +178,7 @@ void PolkitListener::request(const TQString &request, bool _)
if (m_dialog)
{
m_dialog->setRequest(request, m_selectedUser.isValid() &&
- m_selectedUser.toString() == "unix-user:root");
+ m_selectedUser.toString() == "unix-user:root");
}
}