[Marble-commits] branches/KDE/4.5/kdeedu/marble/src/plasmoid

Cristian Oneț onet.cristian at gmail.com
Tue Sep 14 08:11:22 CEST 2010


SVN commit 1175092 by conet:

BUG: 240979
Fix for KWorldClock that displays the UTC time instead of the local time after
loading the session until the mouse hovers over it. Backport to the 4.5 branch.



 M  +10 -13    worldclock.cpp  


--- branches/KDE/4.5/kdeedu/marble/src/plasmoid/worldclock.cpp #1175091:1175092
@@ -77,11 +77,6 @@
     KConfigGroup cg = config();
     m_map = new MarbleMap();
 
-    if(cg.readEntry("projection", static_cast<int>(Equirectangular)) == Mercator)
-        m_map->setProjection(Mercator);
-    else
-        m_map->setProjection(Equirectangular);
-
     //Set how we want the map to look
     m_map->centerOn( cg.readEntry("rotation", -20), 0 );
     m_map->setMapThemeId( "earth/bluemarble/bluemarble.dgml" );
@@ -93,6 +88,11 @@
     m_map->setShowCities     ( false );
     m_map->setShowOtherPlaces( false );
 
+    if(cg.readEntry("projection", static_cast<int>(Equirectangular)) == Mercator)
+        m_map->setProjection(Mercator);
+    else
+        m_map->setProjection(Equirectangular);
+
     foreach( RenderPlugin* item, m_map->model()->renderPlugins() )
         item->setVisible( false );
 
@@ -108,7 +108,7 @@
     m_map->setNeedsUpdate();
 
     m_customTz = cg.readEntry("customtz", false );
-    m_locationkey = QString(KSystemTimeZones::local().name());
+    m_locationkey = KSystemTimeZones::local().name();
     if(m_customTz) {
         QStringList tzlist = cg.readEntry("tzlist", QStringList());
         m_locations = QMap<QString, KTimeZone>();
@@ -235,10 +235,8 @@
     bool ok = m_map->viewParams()->viewport()->currentProjection()->geoCoordinates(
                 m_hover.x(), m_hover.y(), m_map->viewParams()->viewport(), lon, lat );
 
-    QString timezone;
     if( !ok ) {
-        timezone = KSystemTimeZones::local().name();
-        return i18n( timezone.toUtf8().data() );
+        return KSystemTimeZones::local().name();
         }
     QList<QString> zones = m_locations.keys();
 
@@ -253,8 +251,7 @@
             closest = zones.at( i );
         }
     }
-    timezone = m_locations.value( closest ).name();
-    return i18n( timezone.toUtf8().data() );
+    return m_locations.value( closest ).name();
 }
 
 void WorldClock::setTz( QString newtz )
@@ -288,7 +285,7 @@
     else
         timestr = KGlobal::locale()->formatTime( m_time.time() );
 
-    QString locstr = m_locationkey;
+    QString locstr = i18n( m_locationkey.toUtf8().data() );
     locstr.remove( 0, locstr.lastIndexOf( '/' ) + 1 ).replace( '_', ' ' );
     QRect timeRect( m_points.value( "topleft" ), m_points.value( "middleright" ) );
     QRect locationRect( m_points.value( "middleleft" ), m_points.value( "bottomright" ) );
@@ -387,7 +384,7 @@
 
     p->setPen( QColor( 0xFF, 0xFF, 0xFF ) );
 
-    QString locstr = m_locationkey;
+    QString locstr = i18n( m_locationkey.toUtf8().data() );
     locstr.remove( 0, locstr.lastIndexOf( '/' ) + 1 ).replace( '_', ' ' );
 
     QString timestr;


More information about the Marble-commits mailing list