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

List:       kde-commits
Subject:    playground/base/plasma/applets/weather_station
From:       Teemu Rytilahti <tpr () d5k ! net>
Date:       2008-07-31 22:20:15
Message-ID: 1217542815.561023.15635.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 840351 by rytilahti:

- let user decide in which format (s)he wants to see wind
- let's test the automatic detection of ion's places.. only ion_willab is currently converted to have it.



 M  +13 -7     weatherconfig.cpp  
 M  +2 -0      weatherconfig.h  


--- trunk/playground/base/plasma/applets/weather_station/weatherconfig.cpp #840350:840351
@@ -42,13 +42,9 @@
     removeButton->setEnabled(false);
     validateButton->setEnabled(false);
 
-    // If not in metric, dont display wind in meters per second
-    if (KGlobal::locale()->measureSystem() == KLocale::Metric) {
-        windOptionsComboList->addItem(i18n("Kilometers Per Hour"), 0);
-        windOptionsComboList->addItem(i18n("Metres Per Second"), 1);
-    } else {
-        windOptionsComboList->addItem(i18n("Miles Per Hour"), 2);
-    }
+    windOptionsComboList->addItem(i18n("Kilometers Per Hour"), 0);
+    windOptionsComboList->addItem(i18n("Metres Per Second"), 1);
+    windOptionsComboList->addItem(i18n("Miles Per Hour"), 2);
     windOptionsComboList->addItem(i18n("Knots"), 3);
     windOptionsComboList->addItem(i18n("Beaufort Scale"), 4);
     //windOptionsComboList->model()->sort(0, Qt::AscendingOrder);
@@ -69,6 +65,13 @@
     locationEdit->clear();
 }
 
+void WeatherConfig::pluginChanged(int idx)
+{
+    QString comboData = pluginComboList->itemData(idx).toString();
+
+    c.weatherEngine->connectSource(QString("%1|list").arg(comboData), this);
+}
+
 void WeatherConfig::setData(const ConfigData& data)
 {
     c = data;
@@ -100,6 +103,9 @@
     }
     pluginComboList->model()->sort(0, Qt::AscendingOrder);
     pluginComboList->setCurrentIndex(0);
+    
+    // the list is now full, let's connect to see if it changes..
+    connect(pluginComboList, SIGNAL(activated(int)), this, SLOT(pluginChanged(int)));
 
     weatherUpdateSpin->setValue(c.weatherUpdateTime);
     windOptionsComboList->setCurrentIndex(0);
--- trunk/playground/base/plasma/applets/weather_station/weatherconfig.h #840350:840351
@@ -60,10 +60,12 @@
 
 public slots:
     void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data);
+    void pluginChanged(int idx);
 
 protected:
     void validate(const QString& source, const QVariant& data);
     void showAddPlaceDialog(const QStringList& tokens);
+    
 
 protected slots:
     void removePlace();
[prev in list] [next in list] [prev in thread] [next in thread] 

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