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

List:       kde-commits
Subject:    KDE/kdeedu/marble/src
From:       Henry de Valence <hdevalence () gmail ! com>
Date:       2008-12-03 3:33:13
Message-ID: 1228275193.991885.23407.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 891857 by hdevalence:

Reenable build of World Clock and fix the custom TZ selection mechanism


 M  +3 -3      CMakeLists.txt  
 M  +5 -5      plasmoid/CMakeLists.txt  
 M  +46 -8     plasmoid/worldclock.cpp  
 M  +2 -0      plasmoid/worldclock.h  


--- trunk/KDE/kdeedu/marble/src/CMakeLists.txt #891856:891857
@@ -23,9 +23,9 @@
 add_subdirectory( plugins )
 add_subdirectory( bindings )
 
-# if( NOT QTONLY AND PLASMA_FOUND )
-#    add_subdirectory( plasmoid )
-# endif( NOT QTONLY AND PLASMA_FOUND )
+if( NOT QTONLY AND PLASMA_FOUND )
+   add_subdirectory( plasmoid )
+endif( NOT QTONLY AND PLASMA_FOUND )
 
 if(APPLE)
   add_subdirectory( mac )
--- trunk/KDE/kdeedu/marble/src/plasmoid/CMakeLists.txt #891856:891857
@@ -10,20 +10,20 @@
    ${CMAKE_BINARY_DIR}
    ${KDE4_INCLUDES}
    )
- 
+
 set(worldclock_SRCS worldclock.cpp )
 
 qt4_add_resources(worldclock_SRCS ../marble.qrc)
 
 kde4_add_ui_files( worldclock_SRCS worldclockConfig.ui )
- 
+
 kde4_add_plugin(plasma_applet_worldclock ${worldclock_SRCS})
 target_link_libraries(plasma_applet_worldclock
-                      ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS}
+                      ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${PLASMA_LIBS}
                       marblewidget )
- 
+
 install(TARGETS plasma_applet_worldclock
         DESTINATION ${PLUGIN_INSTALL_DIR})
- 
+
 install(FILES plasma-applet-kworldclock.desktop
         DESTINATION ${SERVICES_INSTALL_DIR})
--- trunk/KDE/kdeedu/marble/src/plasmoid/worldclock.cpp #891856:891857
@@ -75,7 +75,7 @@
 void WorldClock::init()
 {
     KConfigGroup cg = config();
-    m_map = new MarbleMap( this );
+    m_map = new MarbleMap();
     if(cg.readEntry("projection", static_cast<int>(Equirectangular)) == Mercator)
         m_map->setProjection(Mercator);
     else
@@ -106,15 +106,26 @@
     m_map->updateSun();
     m_map->setNeedsUpdate();
 
+    m_customTz = cg.readEntry("customtz", false );
     m_locationkey = QString(KSystemTimeZones::local().name());
-    m_locations = KSystemTimeZones::zones();
-    QList<QString> zones = m_locations.keys();
-    for (int i = 0; i < zones.size(); ++i ) {
-        KTimeZone curzone = m_locations.value( zones.at( i ) );
-        if ( curzone.latitude() == KTimeZone::UNKNOWN ||
-             curzone.longitude() == KTimeZone::UNKNOWN ) {
-            m_locations.remove( zones.at(i) );
+    if(m_customTz) {
+        QStringList tzlist = cg.readEntry("tzlist", QStringList());
+        m_locations = QMap<QString, KTimeZone>();
+        foreach( const QString tzname, tzlist ) {
+            m_locations.insert(tzname, KSystemTimeZones::zone(tzname));
         }
+        if(!m_locations.contains(m_locationkey))
+            m_locationkey = m_locations.keys().first();
+    } else {
+        m_locations = KSystemTimeZones::zones();
+        QList<QString> zones = m_locations.keys();
+        for (int i = 0; i < zones.size(); ++i ) {
+            KTimeZone curzone = m_locations.value( zones.at( i ) );
+            if ( curzone.latitude() == KTimeZone::UNKNOWN ||
+                curzone.longitude() == KTimeZone::UNKNOWN ) {
+                m_locations.remove( zones.at(i) );
+            }
+        }
     }
 
     //Font sizes will change before painting
@@ -405,7 +416,13 @@
     if(cg.readEntry("showdate", false ))
         ui.showdate->setChecked(true);
 
+    if(cg.readEntry("customtz", false ))
+        ui.customTz->setChecked(true);
+
     ui.tzWidget->setSelectionMode( QTreeView::MultiSelection );
+    foreach(const QString tz, cg.readEntry("tzlist")) {
+        ui.tzWidget->setSelected(tz,true);
+    }
 
     connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
     connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
@@ -426,6 +443,26 @@
     if( ui.showdate->isChecked() != cg.readEntry("showdate", false))
         m_showDate = ui.showdate->isChecked();
 
+    if( ui.customTz->isChecked() != cg.readEntry("customtz", false)) {
+        m_customTz = ui.customTz->isChecked();
+    }
+
+    if(m_customTz) {
+        QStringList tzlist = ui.tzWidget->selection();
+        kDebug() << "\tSetting TZLIST";
+        kDebug() << tzlist;
+        QMap<QString, KTimeZone> selectedZones;
+        selectedZones.insert(KSystemTimeZones::local().name(),
+                                KSystemTimeZones::local());
+        foreach( const QString tzname, tzlist ) {
+            selectedZones.insert(tzname, KSystemTimeZones::zone(tzname));
+        }
+        cg.writeEntry("tzlist",tzlist);
+        m_locations = selectedZones;
+        if(!m_locations.contains(m_locationkey))
+            m_locationkey = m_locations.keys().first();
+    }
+
     // What projection? note: +1 because the spherical projection is 0
     if((ui.projection->currentIndex() + 1) != cg.readEntry("projection",
                                           static_cast<int>(Equirectangular))  )
@@ -452,6 +489,7 @@
     cg.writeEntry("rotation", ui.longitudeEdit->value());
     cg.writeEntry("centersun", ui.daylightButton->isChecked());
     cg.writeEntry("showdate", ui.showdate->isChecked());
+    cg.writeEntry("customtz", ui.customTz->isChecked());
 
     emit configNeedsSaving();
 }
--- trunk/KDE/kdeedu/marble/src/plasmoid/worldclock.h #891856:891857
@@ -80,6 +80,8 @@
         //time in user's local zone
         QDateTime m_localtime;
         bool m_showDate;
+        //use custom zone list?
+        bool m_customTz;
 
         //the translation
         QPoint m_t;
[prev in list] [next in list] [prev in thread] [next in thread] 

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