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

List:       kde-commits
Subject:    branches/KDE/3.5/kdetoys/kweather
From:       Martin Koller <m.koller () surfeu ! at>
Date:       2007-02-24 12:22:29
Message-ID: 1172319749.844178.31751.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 636839 by mkoller:

BUG: 101955

Don't show a passive popup when the network is unreachable, as we already
show this situation by the "dunno" icon and now also mention it in the
tooltip


 M  +5 -2      dockwidget.cpp  
 M  +0 -1      dockwidget.h  
 M  +10 -6     reportview.cpp  
 M  +9 -6      weatherlib.cpp  


--- branches/KDE/3.5/kdetoys/kweather/dockwidget.cpp #636838:636839
@@ -99,9 +99,12 @@
 
         tip += "<h3><center><nobr>" +
                m_weatherService->stationName( m_locationCode ) + " (" +
-               m_weatherService->stationCountry( m_locationCode ) + \
")</nobr></center></h3><br>"; +               m_weatherService->stationCountry( \
m_locationCode ) + ")</nobr></center></h3>";  
-        tip += QString("<table>"
+        if ( m_weatherService->currentIconString( m_locationCode ) == "dunno" )  // \
no data +            tip += "<center><nobr>" + i18n("The network is currently \
offline...") + "</nobr></center>"; +
+        tip += QString("<br><table>"
                 "<tr><th><nobr>" + i18n( "Temperature:"   ) + \
                "</nobr></th><td><nobr>%1</nobr></td>"
                     "<th><nobr>" + i18n( "Dew Point:"     ) + \
"</nobr></th><td><nobr>%2</nobr></td></nobr></tr>"  
--- branches/KDE/3.5/kdetoys/kweather/dockwidget.h #636838:636839
@@ -55,7 +55,6 @@
 private:
     void initDock();
     void updateFont();
-    DCOPReply callDCOP( const QString &name );
 
     int m_mode;
     QString m_locationCode;
--- branches/KDE/3.5/kdetoys/kweather/reportview.cpp #636838:636839
@@ -122,12 +122,16 @@
     .arg(bgColor).arg(textColor).arg(textColor).arg(textColor).arg(textColor) +    
     QString("</style><title></title></head><body dir=\"%1\">").arg( \
                QApplication::reverseLayout()?"rtl":"ltr") + 
     "<div class=\"headerTitle\"><b>" + i18n( "Weather Report - %1 - %2" ).arg( \
                locationName ).arg( countryName ) +        
-    "</b></div>\n" +    
-    QString("<div class=\"headerMsg\"><b>" + i18n( "Last updated on %1" ) + \
                "</b></div>\n"
-    "<table><tr><td width=\"60\" style=\"text-align: center; border: dotted %2 \
                1px;\">"
-    "<img width=\"64\" height=\"64\" src=\"%3\" /></td>"
-    "<td style=\"vertical-align: top\">%4</td></tr>")
-    .arg(date).arg(bgColor).arg(KURL(icon).url()).arg(weatherText) +
+    "</b></div>\n";
+
+    if ( ! date.isEmpty() )
+      contents += "<div class=\"headerMsg\"><b>" + i18n( "Last updated on %1" \
).arg(date) + "</b></div>\n"; +
+    contents += QString(
+    "<table><tr><td width=\"60\" style=\"text-align: center; border: dotted %1 \
1px;\">" +    "<img width=\"64\" height=\"64\" src=\"%2\" /></td>"
+    "<td style=\"vertical-align: top\">%3</td></tr>")
+    .arg(bgColor).arg(KURL(icon).url()).arg(weatherText) +
     "</table><table>" +
     QString("<tr><th style=\"text-align: right\">" + i18n( "Temperature:" )
     + "</th><td>%1</td>"
--- branches/KDE/3.5/kdetoys/kweather/weatherlib.cpp #636838:636839
@@ -102,9 +102,7 @@
 		    && !hostDown)
 		{
 			hostDown= true;
-			// should not bother after this point
-			KPassivePopup::message( i18n("KWeather Error!"),
-				i18n("The network is unavailable for use."),  0L,"error" );
+      // no need to show a passive popup here, as below all stations will show \
"dunno" icon  }
 	}
 	// Find the job
@@ -285,9 +283,14 @@
 QString WeatherLib::date(const QString &stationID){
 	Data *d = findData(stationID);
 
-	QDateTime gmtDateTime(d->wi.qsDate, d->wi.qsTime);
-	QDateTime localDateTime = gmtDateTime.addSecs(KRFCDate::localUTCOffset() * 60);
-	return KGlobal::locale()->formatDateTime(localDateTime, false, false);
+  if ( ! d->wi.qsDate.isValid() )
+    return "";
+  else
+  {
+    QDateTime gmtDateTime(d->wi.qsDate, d->wi.qsTime);
+    QDateTime localDateTime = gmtDateTime.addSecs(KRFCDate::localUTCOffset() * 60);
+    return KGlobal::locale()->formatDateTime(localDateTime, false, false);
+  }
 }
 
 /** Returns the current cover */


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

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