[trojita] /: Create a new IMAP Server Info dialog.

Espen Sandøy Hustad null at kde.org
Mon May 20 14:07:17 BST 2019


Git commit 26725965a5f9bcc0c4a370fb0cfc68328460149a by Espen Sandøy Hustad.
Committed on 29/04/2019 at 18:51.
Pushed by gerrit into branch 'master'.

Create a new IMAP Server Info dialog.

The old dialog was based on a QMessageBox::Information. This has no
support for scrollbars, except using a detailed text which does not
support HTML formatting.

The new dialog is based on the About Trojita dialog, with a scrollable
list of server capabilities.

Change-Id: I14ba8ffe5346ae352c5994a45e875c76fa43b82c
GUI:
BUG: 406417

M  +1    -0    CMakeLists.txt
A  +139  -0    src/Gui/ImapInfoDialog.ui
M  +11   -4    src/Gui/Window.cpp

https://commits.kde.org/trojita/26725965a5f9bcc0c4a370fb0cfc68328460149a

diff --git a/CMakeLists.txt b/CMakeLists.txt
index af5bb0a8..2ac99b27 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -402,6 +402,7 @@ set(libDesktopGui_UI
     ${path_DesktopGui}/CreateMailboxDialog.ui
     ${path_DesktopGui}/EditIdentity.ui
     ${path_DesktopGui}/EditFavoriteTag.ui
+    ${path_DesktopGui}/ImapInfoDialog.ui
     ${path_DesktopGui}/PasswordDialog.ui
     ${path_DesktopGui}/ProgressPopUp.ui
     ${path_DesktopGui}/SettingsCachePage.ui
diff --git a/src/Gui/ImapInfoDialog.ui b/src/Gui/ImapInfoDialog.ui
new file mode 100644
index 00000000..9d81634f
--- /dev/null
+++ b/src/Gui/ImapInfoDialog.ui
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ImapInfoDialog</class>
+ <widget class="QDialog" name="ImapInfoDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>350</width>
+    <height>400</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>IMAP Server Info</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="rightMargin">
+    <number>0</number>
+   </property>
+   <item>
+    <layout class="QHBoxLayout" name="main">
+     <property name="spacing">
+      <number>10</number>
+     </property>
+     <item>
+      <layout class="QVBoxLayout" name="column" stretch="0,1">
+       <property name="spacing">
+        <number>20</number>
+       </property>
+       <item>
+        <widget class="QLabel" name="version">
+         <property name="text">
+          <string><html><head/><body><p>SERVERINFO Placeholder</p></body></html></string>
+         </property>
+         <property name="wordWrap">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QScrollArea" name="scrollableCapabilities">
+         <property name="frameShape">
+          <enum>QFrame::NoFrame</enum>
+         </property>
+         <property name="verticalScrollBarPolicy">
+          <enum>Qt::ScrollBarAsNeeded</enum>
+         </property>
+         <property name="horizontalScrollBarPolicy">
+          <enum>Qt::ScrollBarAlwaysOff</enum>
+         </property>
+         <property name="widgetResizable">
+          <bool>true</bool>
+         </property>
+         <widget class="QLabel" name="capabilities">
+          <property name="geometry">
+           <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>340</width>
+            <height>306</height>
+           </rect>
+          </property>
+          <property name="font">
+           <font>
+            <family>Monospace</family>
+           </font>
+          </property>
+          <property name="text">
+           <string notr="true">CAPABILITIES placeholder</string>
+          </property>
+          <property name="alignment">
+           <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+          </property>
+          <property name="wordWrap">
+           <bool>true</bool>
+          </property>
+          <property name="readOnly" stdset="0">
+           <bool>true</bool>
+          </property>
+         </widget>
+        </widget>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Ok</set>
+     </property>
+     <property name="centerButtons">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources>
+  <include location="../icons.qrc"/>
+ </resources>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>ImapInfoDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>ImapInfoDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/src/Gui/Window.cpp b/src/Gui/Window.cpp
index f4c024d7..4ad7d93d 100644
--- a/src/Gui/Window.cpp
+++ b/src/Gui/Window.cpp
@@ -34,6 +34,7 @@
 #include <QMessageBox>
 #include <QProgressBar>
 #include <QRegularExpression>
+#include <QScopedPointer>
 #include <QScrollBar>
 #include <QSplitter>
 #include <QSslError>
@@ -101,6 +102,7 @@
 
 #include "ui_CreateMailboxDialog.h"
 #include "ui_AboutDialog.h"
+#include "ui_ImapInfoDialog.h"
 
 #include "Imap/Model/ModelTest/modeltest.h"
 #include "UiUtils/IconLoader.h"
@@ -2529,10 +2531,15 @@ void MainWindow::slotShowImapInfo()
         idString = tr("<p>The server has not provided information about its software version.</p>");
     }
 
-    QMessageBox::information(this, tr("IMAP Server Information"),
-                             tr("%1"
-                                "<p>The following capabilities are currently advertised:</p>\n"
-                                "<ul>\n%2</ul>").arg(idString, caps));
+    Ui::ImapInfoDialog ui;
+    QScopedPointer<QDialog> dialog(new QDialog(this));
+
+    ui.setupUi(dialog.data());
+    ui.version->setText(tr("%1\n"
+                           "<p>The following capabilities are currently advertised:</p>").arg(idString));
+    ui.capabilities->setText(tr("<ul>\n%1</ul>").arg(caps));
+
+    dialog->exec();
 }
 
 QSize MainWindow::sizeHint() const



More information about the kde-doc-english mailing list