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

List:       kde-commits
Subject:    playground/base/attica/plasma/opendesktop
From:       Sebastian Kügler <sebas () kde ! org>
Date:       2009-04-30 21:57:11
Message-ID: 1241128631.465501.13695.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 961899 by sebas:

Use a combo box for the country

We don't confuse the user with country codes and such, on top of that, it becomes \
translatable.

 M  +10 -3     opendesktop.cpp  
 M  +16 -11    opendesktopLocationConfig.ui  


--- trunk/playground/base/attica/plasma/opendesktop/opendesktop.cpp #961898:961899
@@ -435,12 +435,16 @@
     ui.username->setText(m_username);
 
     locationUi.city->setText(m_geolocation->city);
-    locationUi.country->setText(m_geolocation->countryCode);
-    locationUi.city->setText(m_geolocation->city);
     locationUi.latitude->setText(QString::number(m_geolocation->latitude));
     locationUi.longitude->setText(QString::number(m_geolocation->longitude));
     locationUi.distance->setValue(m_geolocation->distance);
 
+    locationUi.countryCombo->setInsertPolicy(QComboBox::InsertAlphabetically);
+    foreach ( const QString &cc, KGlobal::locale()->allCountriesList() ) {
+        locationUi.countryCombo->addItem(KGlobal::locale()->countryCodeToName(cc), \
cc); +    }
+    locationUi.countryCombo->setCurrentIndex(locationUi.countryCombo->findText(KGlobal::locale()->countryCodeToName(m_geolocation->countryCode)));
 +
     // actually, 0,0 is a valid location, but here we're using it to see if we
     // actually have a location, a bit dirty but far less complex, especially given
     // that this point is located in the middle of the ocean off the coast of Ghana
@@ -498,11 +502,14 @@
 {
     // Location tab
     m_geolocation->city = locationUi.city->text();
-    m_geolocation->countryCode = locationUi.country->text();
+    m_geolocation->countryCode = \
locationUi.countryCombo->itemData(locationUi.countryCombo->currentIndex()).toString();
 +    m_geolocation->country = locationUi.countryCombo->currentText();
     m_geolocation->latitude = locationUi.latitude->text().toDouble();
     m_geolocation->longitude = locationUi.longitude->text().toDouble();
     m_geolocation->distance = locationUi.distance->text().toDouble();
 
+    kDebug() << "New location:" << m_geolocation->city << m_geolocation->country << \
m_geolocation->countryCode << m_geolocation->latitude << m_geolocation->longitude; +
     saveGeoLocation();
 }
 
--- trunk/playground/base/attica/plasma/opendesktop/opendesktopLocationConfig.ui \
#961898:961899 @@ -7,7 +7,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>211</width>
+    <width>233</width>
     <height>185</height>
    </rect>
   </property>
@@ -42,16 +42,6 @@
      </property>
     </widget>
    </item>
-   <item row="3" column="1">
-    <widget class="KLineEdit" name="country">
-     <property name="minimumSize">
-      <size>
-       <width>100</width>
-       <height>0</height>
-      </size>
-     </property>
-    </widget>
-   </item>
    <item row="4" column="0">
     <widget class="QLabel" name="label_5">
      <property name="text">
@@ -103,6 +93,16 @@
      </property>
     </widget>
    </item>
+   <item row="3" column="1">
+    <widget class="KComboBox" name="countryCombo">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+    </widget>
+   </item>
   </layout>
  </widget>
  <customwidgets>
@@ -116,6 +116,11 @@
    <extends>QLineEdit</extends>
    <header>klineedit.h</header>
   </customwidget>
+  <customwidget>
+   <class>KComboBox</class>
+   <extends>QComboBox</extends>
+   <header>kcombobox.h</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