[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/network/telepathy-accounts-kcm-plugins/gabble
From:       Gustavo P. Boiko <gustavo.boiko () kdemail ! net>
Date:       2010-10-04 17:41:23
Message-ID: 20101004174123.B8ABDAC88C () svn ! kde ! org
[Download RAW message or body]

SVN commit 1182475 by boiko:

Replace the custom integer widgets by spinboxes


 M  +13 -32    proxy-settings-widget.cpp  
 M  +3 -29     proxy-settings-widget.ui  
 M  +9 -21     server-settings-widget.cpp  
 M  +15 -20    server-settings-widget.ui  


--- trunk/playground/network/telepathy-accounts-kcm-plugins/gabble/proxy-settings-widget.cpp \
#1182474:1182475 @@ -125,9 +125,9 @@
 
     if (d->stunPortParameter) {
         if (values.contains(d->stunPortParameter->name())) {
-            d->ui->stunPortLineEdit->setValue(values.value(d->stunPortParameter->name()).toUInt());
 +            d->ui->stunPortSpinBox->setValue(values.value(d->stunPortParameter->name()).toUInt());
  } else {
-            d->ui->stunPortLineEdit->setValue(d->stunPortParameter->defaultValue().toUInt());
 +            d->ui->stunPortSpinBox->setValue(d->stunPortParameter->defaultValue().toUInt());
  }
     }
 
@@ -143,10 +143,10 @@
 
     if (d->fallbackStunPortParameter) {
         if (values.contains(d->fallbackStunPortParameter->name())) {
-            d->ui->fallbackStunPortLineEdit->setValue(values.value(
+            d->ui->fallbackStunPortSpinBox->setValue(values.value(
                     d->fallbackStunPortParameter->name()).toUInt());
         } else {
-            d->ui->fallbackStunPortLineEdit->setValue(
+            d->ui->fallbackStunPortSpinBox->setValue(
                     d->fallbackStunPortParameter->defaultValue().toUInt());
         }
     }
@@ -163,10 +163,10 @@
 
     if (d->httpsProxyPortParameter) {
         if (values.contains(d->httpsProxyPortParameter->name())) {
-            d->ui->httpsProxyPortLineEdit->setValue(values.value(
+            d->ui->httpsProxyPortSpinBox->setValue(values.value(
                     d->httpsProxyPortParameter->name()).toUInt());
         } else {
-            d->ui->httpsProxyPortLineEdit->setValue(
+            d->ui->httpsProxyPortSpinBox->setValue(
                     d->httpsProxyPortParameter->defaultValue().toUInt());
         }
     }
@@ -203,7 +203,7 @@
 
     if (!d->stunPortParameter) {
         d->ui->stunPortLabel->hide();
-        d->ui->stunPortLineEdit->hide();
+        d->ui->stunPortSpinBox->hide();
     }
 
     if (!d->fallbackStunServerParameter) {
@@ -213,7 +213,7 @@
 
     if (!d->fallbackStunPortParameter) {
         d->ui->fallbackStunPortLabel->hide();
-        d->ui->fallbackStunPortLineEdit->hide();
+        d->ui->fallbackStunPortSpinBox->hide();
     }
 
     if (!d->httpsProxyServerParameter) {
@@ -223,7 +223,7 @@
 
     if (!d->httpsProxyPortParameter) {
         d->ui->httpsProxyPortLabel->hide();
-        d->ui->httpsProxyPortLineEdit->hide();
+        d->ui->httpsProxyPortSpinBox->hide();
     }
 
     if (!d->fallbackSocks5ProxiesParameter) {
@@ -274,7 +274,7 @@
     }
 
     if (d->stunPortParameter) {
-        parameters.insert(d->stunPortParameter, d->ui->stunPortLineEdit->value());
+        parameters.insert(d->stunPortParameter, d->ui->stunPortSpinBox->value());
     }
 
     if (d->fallbackStunServerParameter) {
@@ -283,7 +283,7 @@
     }
 
     if (d->fallbackStunPortParameter) {
-        parameters.insert(d->fallbackStunPortParameter, \
d->ui->fallbackStunPortLineEdit->value()); +        \
parameters.insert(d->fallbackStunPortParameter, \
d->ui->fallbackStunPortSpinBox->value());  }
 
     if (d->httpsProxyServerParameter) {
@@ -291,7 +291,7 @@
     }
 
     if (d->httpsProxyPortParameter) {
-        parameters.insert(d->httpsProxyPortParameter, \
d->ui->httpsProxyPortLineEdit->value()); +        \
parameters.insert(d->httpsProxyPortParameter, d->ui->httpsProxyPortSpinBox->value()); \
}  
     if (d->fallbackSocks5ProxiesParameter) {
@@ -312,26 +312,7 @@
 {
     kDebug();
 
-    // Validate all the int's and uint's.
-    if (d->ui->stunPortLineEdit->validity() != QValidator::Acceptable) {
-        KMessageBox::error(this,
-                              i18n("\"<b>%1</b>\" is not an acceptable value for \
                <b>%2</b>")
-                              .arg(d->ui->stunPortLineEdit->text())
-                              .arg(d->ui->stunPortLabel->text()));
-        return false;
-    } else if (d->ui->fallbackStunPortLineEdit->validity() != \
                QValidator::Acceptable) {
-        KMessageBox::error(this,
-                              i18n("\"<b>%1</b>\" is not an acceptable value for \
                <b>%2</b>")
-                              .arg(d->ui->fallbackStunPortLineEdit->text())
-                              .arg(d->ui->fallbackStunPortLabel->text()));
-        return false;
-    } else if (d->ui->httpsProxyPortLineEdit->validity() != QValidator::Acceptable) \
                {
-        KMessageBox::error(this,
-                              i18n("\"<b>%1</b>\" is not an acceptable value for \
                <b>%2</b>")
-                              .arg(d->ui->httpsProxyPortLineEdit->text())
-                              .arg(d->ui->httpsProxyPortLabel->text()));
-        return false;
-    }
+    //TODO: check what parameters should be validated
 
     return true;
 }
--- trunk/playground/network/telepathy-accounts-kcm-plugins/gabble/proxy-settings-widget.ui \
#1182474:1182475 @@ -40,14 +40,7 @@
          </widget>
         </item>
         <item>
-         <widget class="UnsignedIntegerEdit" name="stunPortLineEdit">
-          <property name="maximumSize">
-           <size>
-            <width>60</width>
-            <height>16777215</height>
-           </size>
-          </property>
-         </widget>
+         <widget class="QSpinBox" name="stunPortSpinBox"/>
         </item>
        </layout>
       </item>
@@ -71,14 +64,7 @@
          </widget>
         </item>
         <item>
-         <widget class="UnsignedIntegerEdit" name="fallbackStunPortLineEdit">
-          <property name="maximumSize">
-           <size>
-            <width>60</width>
-            <height>16777215</height>
-           </size>
-          </property>
-         </widget>
+         <widget class="QSpinBox" name="fallbackStunPortSpinBox"/>
         </item>
        </layout>
       </item>
@@ -111,14 +97,7 @@
          </widget>
         </item>
         <item>
-         <widget class="UnsignedIntegerEdit" name="httpsProxyPortLineEdit">
-          <property name="maximumSize">
-           <size>
-            <width>60</width>
-            <height>16777215</height>
-           </size>
-          </property>
-         </widget>
+         <widget class="QSpinBox" name="httpsProxyPortSpinBox"/>
         </item>
        </layout>
       </item>
@@ -171,11 +150,6 @@
    <extends>QTextEdit</extends>
    <header>ktextedit.h</header>
   </customwidget>
-  <customwidget>
-   <class>UnsignedIntegerEdit</class>
-   <extends>QLineEdit</extends>
-   <header location="global">KCMTelepathyAccounts/UnsignedIntegerEdit</header>
-  </customwidget>
  </customwidgets>
  <resources/>
  <connections/>
--- trunk/playground/network/telepathy-accounts-kcm-plugins/gabble/server-settings-widget.cpp \
#1182474:1182475 @@ -112,18 +112,18 @@
 
     if (d->portParameter) {
         if (values.contains(d->portParameter->name())) {
-            d->ui->portLineEdit->setValue(values.value(d->portParameter->name()).toUInt());
 +            d->ui->portSpinBox->setValue(values.value(d->portParameter->name()).toUInt());
  } else {
-            d->ui->portLineEdit->setValue(d->portParameter->defaultValue().toUInt());
 +            d->ui->portSpinBox->setValue(d->portParameter->defaultValue().toUInt());
  }
     }
 
     if (d->keepaliveIntervalParameter) {
         if (values.contains(d->keepaliveIntervalParameter->name())) {
-            d->ui->keepaliveIntervalLineEdit->setValue(values.value(
+            d->ui->keepaliveIntervalSpinBox->setValue(values.value(
                     d->keepaliveIntervalParameter->name()).toUInt());
         } else {
-            d->ui->keepaliveIntervalLineEdit->setValue(
+            d->ui->keepaliveIntervalSpinBox->setValue(
                     d->keepaliveIntervalParameter->defaultValue().toUInt());
         }
     }
@@ -174,12 +174,12 @@
 
     if (!d->portParameter) {
         d->ui->portLabel->hide();
-        d->ui->portLineEdit->hide();
+        d->ui->portSpinBox->hide();
     }
 
     if (!d->keepaliveIntervalParameter) {
         d->ui->keepaliveIntervalLabel->hide();
-        d->ui->keepaliveIntervalLineEdit->hide();
+        d->ui->keepaliveIntervalSpinBox->hide();
     }
 
     if (!d->lowBandwidthParameter) {
@@ -233,11 +233,11 @@
     }
 
     if (d->portParameter) {
-        parameters.insert(d->portParameter, d->ui->portLineEdit->value());
+        parameters.insert(d->portParameter, d->ui->portSpinBox->value());
     }
 
     if (d->keepaliveIntervalParameter) {
-        parameters.insert(d->keepaliveIntervalParameter, \
d->ui->keepaliveIntervalLineEdit->value()); +        \
parameters.insert(d->keepaliveIntervalParameter, \
d->ui->keepaliveIntervalSpinBox->value());  }
 
     if (d->lowBandwidthParameter) {
@@ -264,19 +264,7 @@
 {
     kDebug();
 
-    if (d->ui->portLineEdit->validity() != QValidator::Acceptable) {
-        KMessageBox::error(this,
-                              i18n("\"<b>%1</b>\" is not an acceptable value for \
                <b>%2</b>")
-                              .arg(d->ui->portLineEdit->text())
-                              .arg(d->ui->portLabel->text()));
-        return false;
-    } else if (d->ui->keepaliveIntervalLineEdit->validity() != \
                QValidator::Acceptable) {
-        KMessageBox::error(this,
-                              i18n("\"<b>%1</b>\" is not an acceptable value for \
                <b>%2</b>")
-                              .arg(d->ui->keepaliveIntervalLineEdit->text())
-                              .arg(d->ui->keepaliveIntervalLabel->text()));
-        return false;
-    }
+    //TODO: check which parameters need validation
 
     return true;
 }
--- trunk/playground/network/telepathy-accounts-kcm-plugins/gabble/server-settings-widget.ui \
#1182474:1182475 @@ -19,38 +19,38 @@
      <property name="title">
       <string>Server Settings</string>
      </property>
-     <layout class="QVBoxLayout" name="verticalLayout">
-      <item>
-       <layout class="QHBoxLayout" name="horizontalLayout_3">
-        <item>
+     <layout class="QFormLayout" name="formLayout">
+      <item row="0" column="0">
          <widget class="QLabel" name="serverLabel">
           <property name="text">
            <string>Server Address:</string>
           </property>
          </widget>
         </item>
-        <item>
+      <item row="0" column="1">
          <widget class="KLineEdit" name="serverLineEdit"/>
         </item>
-       </layout>
-      </item>
-      <item>
-       <layout class="QHBoxLayout" name="horizontalLayout_2">
-        <item>
+      <item row="1" column="0">
          <widget class="QLabel" name="portLabel">
           <property name="text">
            <string>Server Port:</string>
           </property>
          </widget>
         </item>
-        <item>
-         <widget class="UnsignedIntegerEdit" name="portLineEdit"/>
+      <item row="1" column="1">
+       <widget class="QSpinBox" name="portSpinBox">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+       </widget>
         </item>
        </layout>
-      </item>
-     </layout>
      <zorder></zorder>
      <zorder></zorder>
+     <zorder>serverLineEdit</zorder>
     </widget>
    </item>
    <item>
@@ -69,7 +69,7 @@
          </widget>
         </item>
         <item>
-         <widget class="UnsignedIntegerEdit" name="keepaliveIntervalLineEdit"/>
+         <widget class="QSpinBox" name="keepaliveIntervalSpinBox"/>
         </item>
        </layout>
       </item>
@@ -121,11 +121,6 @@
    <extends>QLineEdit</extends>
    <header>klineedit.h</header>
   </customwidget>
-  <customwidget>
-   <class>UnsignedIntegerEdit</class>
-   <extends>QLineEdit</extends>
-   <header location="global">KCMTelepathyAccounts/UnsignedIntegerEdit</header>
-  </customwidget>
  </customwidgets>
  <resources/>
  <connections/>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic