[kde-doc-english] [trojita] src/Gui: GUI: make the password input dialog a bit more lightweight

Jan Kundrát jkt at flaska.net
Wed Mar 20 00:39:46 UTC 2013


Git commit d2653787edc3cb7dce2d48297718f181a1e89790 by Jan Kundrát.
Committed on 20/03/2013 at 01:29.
Pushed by jkt into branch 'master'.

GUI: make the password input dialog a bit more lightweight

This is very likely a matter of personal preference, but to me this version just
looks better.

M  +2    -2    src/Gui/PasswordDialog.cpp
M  +2    -1    src/Gui/PasswordDialog.h
M  +29   -43   src/Gui/PasswordDialog.ui
M  +2    -2    src/Gui/Window.cpp

http://commits.kde.org/trojita/d2653787edc3cb7dce2d48297718f181a1e89790

diff --git a/src/Gui/PasswordDialog.cpp b/src/Gui/PasswordDialog.cpp
index cf1fad2..a6fc7d8 100644
--- a/src/Gui/PasswordDialog.cpp
+++ b/src/Gui/PasswordDialog.cpp
@@ -50,11 +50,11 @@ QString PasswordDialog::password() const
     return ui.passwordLineEdit->text();
 }
 
-QString PasswordDialog::getPassword(QWidget *parent, const QString &windowTitle, const QString &title, const QString &description, QLineEdit::EchoMode echo, const QString &password, bool *ok)
+QString PasswordDialog::getPassword(QWidget *parent, const QString &windowTitle, const QString &description,
+                                    QLineEdit::EchoMode echo, const QString &password, bool *ok)
 {
     PasswordDialog dialog(parent);
     dialog.setWindowTitle(windowTitle);
-    dialog.ui.titleLabel->setText(title);
     dialog.ui.descriptionLabel->setText(description);
     dialog.ui.passwordLineEdit->setEchoMode(echo);
     dialog.ui.passwordLineEdit->setText(password);
diff --git a/src/Gui/PasswordDialog.h b/src/Gui/PasswordDialog.h
index d5794c1..4e87649 100644
--- a/src/Gui/PasswordDialog.h
+++ b/src/Gui/PasswordDialog.h
@@ -39,7 +39,8 @@ public:
     ~PasswordDialog();
 
     QString password() const;
-    static QString getPassword(QWidget *parent, const QString &windowTitle, const QString &title, const QString &description, QLineEdit::EchoMode echo = QLineEdit::Normal, const QString &password = 0, bool *ok = 0);
+    static QString getPassword(QWidget *parent, const QString &windowTitle, const QString &description,
+                               QLineEdit::EchoMode echo = QLineEdit::Normal, const QString &password = 0, bool *ok = 0);
 
 protected:
     void showEvent(QShowEvent *event);
diff --git a/src/Gui/PasswordDialog.ui b/src/Gui/PasswordDialog.ui
index 4feec20..7e4c096 100644
--- a/src/Gui/PasswordDialog.ui
+++ b/src/Gui/PasswordDialog.ui
@@ -7,14 +7,27 @@
     <x>0</x>
     <y>0</y>
     <width>400</width>
-    <height>130</height>
+    <height>128</height>
    </rect>
   </property>
   <property name="windowTitle">
-   <string>Authentication</string>
+   <string>Authentication Required</string>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
     <layout class="QGridLayout" name="gridLayout">
      <property name="horizontalSpacing">
       <number>12</number>
@@ -22,29 +35,6 @@
      <property name="verticalSpacing">
       <number>6</number>
      </property>
-     <item row="0" column="0" rowspan="3">
-      <widget class="QLabel" name="iconLabel">
-       <property name="text">
-        <string/>
-       </property>
-       <property name="pixmap">
-        <pixmap resource="../icons.qrc">:/icons/dialog-password.png</pixmap>
-       </property>
-      </widget>
-     </item>
-     <item row="0" column="1">
-      <widget class="QLabel" name="titleLabel">
-       <property name="font">
-        <font>
-         <weight>75</weight>
-         <bold>true</bold>
-        </font>
-       </property>
-       <property name="text">
-        <string><h2>Authentication required</h2></string>
-       </property>
-      </widget>
-     </item>
      <item row="1" column="1">
       <widget class="QLabel" name="descriptionLabel">
        <property name="sizePolicy">
@@ -61,34 +51,30 @@
        </property>
       </widget>
      </item>
+     <item row="0" column="0" rowspan="3">
+      <widget class="QLabel" name="iconLabel">
+       <property name="text">
+        <string/>
+       </property>
+       <property name="pixmap">
+        <pixmap resource="../icons.qrc">:/icons/dialog-password.png</pixmap>
+       </property>
+      </widget>
+     </item>
      <item row="2" column="1">
-      <layout class="QHBoxLayout" name="horizontalLayout">
-       <item>
-        <widget class="QLabel" name="passwordLabel">
-         <property name="text">
-          <string>&Password:</string>
-         </property>
-         <property name="buddy">
-          <cstring>passwordLineEdit</cstring>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="LineEdit" name="passwordLineEdit"/>
-       </item>
-      </layout>
+      <widget class="LineEdit" name="passwordLineEdit"/>
      </item>
     </layout>
    </item>
    <item>
-    <spacer name="verticalSpacer">
+    <spacer name="verticalSpacer_2">
      <property name="orientation">
       <enum>Qt::Vertical</enum>
      </property>
      <property name="sizeHint" stdset="0">
       <size>
-       <width>10</width>
-       <height>0</height>
+       <width>20</width>
+       <height>40</height>
       </size>
      </property>
     </spacer>
diff --git a/src/Gui/Window.cpp b/src/Gui/Window.cpp
index f009d78..f9dda08 100644
--- a/src/Gui/Window.cpp
+++ b/src/Gui/Window.cpp
@@ -916,8 +916,8 @@ void MainWindow::authenticationRequested()
     QString pass = s.value(Common::SettingsNames::imapPassKey).toString();
     if (m_ignoreStoredPassword || pass.isEmpty()) {
         bool ok;
-        pass = PasswordDialog::getPassword(this, tr("IMAP Password"), tr("<h3>Authentication required</h3>"),
-                                           tr("<p>Please provide password for %1 on %2.</p>").arg(
+        pass = PasswordDialog::getPassword(this, tr("Authentication Required"),
+                                           tr("<p>Please provide IMAP password for user <b>%1</b> on <b>%2</b>:</p>").arg(
                                                user, QSettings().value(Common::SettingsNames::imapHostKey).toString()),
                                            QLineEdit::Password, QString(), &ok);
         if (ok) {



More information about the kde-doc-english mailing list