Просмотр исходного кода

Show an indicator if the url is encrypted or not in connection wizard.

Fixes bug #1350
Klaas Freitag 12 лет назад
Родитель
Сommit
45c75f722c
3 измененных файлов с 92 добавлено и 40 удалено
  1. 2 0
      mirall.qrc
  2. 84 29
      src/wizard/owncloudsetupnocredspage.ui
  3. 6 11
      src/wizard/owncloudsetuppage.cpp

+ 2 - 0
mirall.qrc

@@ -14,5 +14,7 @@
         <file>resources/activity.png</file>
         <file>resources/activity.png</file>
         <file>resources/network.png</file>
         <file>resources/network.png</file>
         <file>resources/owncloud_logo_blue.png</file>
         <file>resources/owncloud_logo_blue.png</file>
+	<file>resources/lock-http.png</file>
+	<file>resources/lock-https.png</file>
     </qresource>
     </qresource>
 </RCC>
 </RCC>

+ 84 - 29
src/wizard/owncloudsetupnocredspage.ui

@@ -6,7 +6,7 @@
    <rect>
    <rect>
     <x>0</x>
     <x>0</x>
     <y>0</y>
     <y>0</y>
-    <width>525</width>
+    <width>602</width>
     <height>193</height>
     <height>193</height>
    </rect>
    </rect>
   </property>
   </property>
@@ -19,8 +19,8 @@
   <property name="windowTitle">
   <property name="windowTitle">
    <string>Form</string>
    <string>Form</string>
   </property>
   </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
+  <layout class="QGridLayout" name="gridLayout">
+   <item row="0" column="0">
     <widget class="QLabel" name="topLabel">
     <widget class="QLabel" name="topLabel">
      <property name="sizePolicy">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
       <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -39,8 +39,8 @@
      </property>
      </property>
     </widget>
     </widget>
    </item>
    </item>
-   <item>
-    <layout class="QHBoxLayout" name="horizontalLayout">
+   <item row="1" column="0">
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
      <item>
      <item>
       <spacer name="horizontalSpacer">
       <spacer name="horizontalSpacer">
        <property name="orientation">
        <property name="orientation">
@@ -58,28 +58,75 @@
       </spacer>
       </spacer>
      </item>
      </item>
      <item>
      <item>
-      <widget class="QLabel" name="label_2">
-       <property name="text">
-        <string>Server &amp;Address</string>
-       </property>
-       <property name="buddy">
-        <cstring>leUrl</cstring>
-       </property>
-      </widget>
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <item>
+        <spacer name="verticalSpacer_2">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeType">
+          <enum>QSizePolicy::Minimum</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>13</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <item>
+          <widget class="QLabel" name="label_2">
+           <property name="text">
+            <string>Server &amp;Address</string>
+           </property>
+           <property name="buddy">
+            <cstring>leUrl</cstring>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="Utils::FancyLineEdit" name="leUrl">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="toolTip">
+            <string>Enter the URL of the server that you want to connect to (without http or https).</string>
+           </property>
+           <property name="placeholderText">
+            <string>https://...</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <spacer name="verticalSpacer_3">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeType">
+          <enum>QSizePolicy::Minimum</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>18</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
      </item>
      </item>
      <item>
      <item>
-      <widget class="Utils::FancyLineEdit" name="leUrl">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="toolTip">
-        <string>Enter the URL of the server that you want to connect to (without http or https).</string>
-       </property>
-       <property name="placeholderText">
-        <string>https://...</string>
+      <widget class="QLabel" name="urlLabel">
+       <property name="text">
+        <string/>
        </property>
        </property>
       </widget>
       </widget>
      </item>
      </item>
@@ -101,7 +148,7 @@
      </item>
      </item>
     </layout>
     </layout>
    </item>
    </item>
-   <item>
+   <item row="2" column="0">
     <widget class="QLabel" name="errorLabel">
     <widget class="QLabel" name="errorLabel">
      <property name="sizePolicy">
      <property name="sizePolicy">
       <sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum">
       <sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum">
@@ -114,7 +161,7 @@
      </property>
      </property>
     </widget>
     </widget>
    </item>
    </item>
-   <item>
+   <item row="3" column="0">
     <spacer name="verticalSpacer">
     <spacer name="verticalSpacer">
      <property name="orientation">
      <property name="orientation">
       <enum>Qt::Vertical</enum>
       <enum>Qt::Vertical</enum>
@@ -127,14 +174,14 @@
      </property>
      </property>
     </spacer>
     </spacer>
    </item>
    </item>
-   <item>
+   <item row="4" column="0">
     <layout class="QHBoxLayout" name="resultLayout">
     <layout class="QHBoxLayout" name="resultLayout">
      <property name="spacing">
      <property name="spacing">
       <number>0</number>
       <number>0</number>
      </property>
      </property>
     </layout>
     </layout>
    </item>
    </item>
-   <item>
+   <item row="5" column="0">
     <widget class="QLabel" name="bottomLabel">
     <widget class="QLabel" name="bottomLabel">
      <property name="text">
      <property name="text">
       <string>TextLabel</string>
       <string>TextLabel</string>
@@ -142,6 +189,14 @@
     </widget>
     </widget>
    </item>
    </item>
   </layout>
   </layout>
+  <zorder>topLabel</zorder>
+  <zorder>errorLabel</zorder>
+  <zorder>bottomLabel</zorder>
+  <zorder>label</zorder>
+  <zorder>verticalSpacer</zorder>
+  <zorder>verticalSpacer_2</zorder>
+  <zorder>verticalSpacer_3</zorder>
+  <zorder>urlLabel</zorder>
  </widget>
  </widget>
  <customwidgets>
  <customwidgets>
   <customwidget>
   <customwidget>

+ 6 - 11
src/wizard/owncloudsetuppage.cpp

@@ -97,20 +97,15 @@ void OwncloudSetupPage::slotUrlChanged(const QString& url)
     if (newUrl != url) {
     if (newUrl != url) {
         _ui.leUrl->setText(newUrl);
         _ui.leUrl->setText(newUrl);
     }
     }
-#if 0
-    bool visible = false;
 
 
-    if (url.startsWith(QLatin1String("https://"))) {
-        _ui.urlLabel->setPixmap( QPixmap(":/mirall/resources/security-high.png"));
-        _ui.urlLabel->setToolTip(tr("This url is secure. You can use it."));
-        visible = true;
-    }
     if (url.startsWith(QLatin1String("http://"))) {
     if (url.startsWith(QLatin1String("http://"))) {
-        _ui.urlLabel->setPixmap( QPixmap(":/mirall/resources/security-low.png"));
-        _ui.urlLabel->setToolTip(tr("This url is NOT secure. You should not use it."));
-        visible = true;
+        _ui.urlLabel->setPixmap( QPixmap(":/mirall/resources/lock-http.png"));
+        _ui.urlLabel->setToolTip(tr("This url is NOT secure as it is not encrypted.\n"
+                                    "It is not advisable to use it."));
+    } else {
+        _ui.urlLabel->setPixmap( QPixmap(":/mirall/resources/lock-https.png"));
+        _ui.urlLabel->setToolTip(tr("This url is secure. You can use it."));
     }
     }
-#endif
 }
 }
 
 
 bool OwncloudSetupPage::isComplete() const
 bool OwncloudSetupPage::isComplete() const