Bug 126296 - Always comes up with Morgantown WV and location won't change from that
Summary: Always comes up with Morgantown WV and location won't change from that
Status: RESOLVED FIXED
Alias: None
Product: kweather-kde3
Classification: Applications
Component: general (show other bugs)
Version: 2.1
Platform: unspecified Linux
: NOR normal with 1 vote (vote)
Target Milestone: ---
Assignee: geiseri
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-26 17:33 UTC by steve fisher
Modified: 2006-12-25 21:53 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description steve fisher 2006-04-26 17:33:42 UTC
Version:           2.1 (using KDE KDE 3.5.2)
Installed from:    I Don't Know
OS:                Linux

When I configure KWeather to another location and apply and OK it looks ok but it really is Morgantown WV weather and not Keene, NH that I had entered and selected. I even removed morgantown wv from the listing but it never really goes away.
Comment 1 Ruud Kuin 2006-09-20 19:24:12 UTC
I did the same, only entered Amsterdam The Netherlands and tried to remove Morgantown... I also removed morgantown wv from the listing but it never went away.
Comment 2 Martin Koller 2006-12-24 22:05:47 UTC
SVN commit 616273 by mkoller:

BUG: 124754
BUG: 138047
BUG: 136683
BUG: 126296
BUG: 113828
BUG: 122850
BUG: 118458
BUG: 116375
BUG: 103887
BUG: 76300
BUG: 73093

Long standing bug: make selection of a station work



 M  +6 -2      dockwidget.cpp  
 M  +47 -10    kcmweather.cpp  
 M  +1 -2      kcmweather.h  
 M  +4 -0      kcmweatherservice.cpp  
 M  +22 -13    kweather.cpp  
 M  +1 -0      kweather.h  
 M  +20 -6     prefdialogdata.ui  


--- branches/KDE/3.5/kdetoys/kweather/dockwidget.cpp #616272:616273
@@ -47,7 +47,8 @@
 
 void dockwidget::setLocationCode(const QString &locationCode)
 {
-	m_locationCode = locationCode;
+    m_locationCode = locationCode;
+    showWeather();
 }
 
 void dockwidget::setViewMode(int _mode)
@@ -82,7 +83,7 @@
     QString wind     = "?";
     QString pressure = "?";
 
-    if ( m_weatherService->stationNeedsMaintenance( m_locationCode ) )
+    if ( !m_locationCode.isEmpty() && m_weatherService->stationNeedsMaintenance( m_locationCode ) )
     {
         tip = i18n("Station reports that it needs maintenance\n"
                    "Please try again later");
@@ -111,6 +112,9 @@
     // On null or empty location code, or if the station needs maintenance, this will return the dunno icon.
     QPixmap icon = m_weatherService->icon( m_locationCode );
 
+    if ( ! m_locationCode.isEmpty() )
+        tip = m_weatherService->stationName( m_locationCode ) + "\n" + tip;
+
     QToolTip::remove(m_button);
     QToolTip::add(m_button, tip);
 
--- branches/KDE/3.5/kdetoys/kweather/kcmweather.cpp #616272:616273
@@ -83,17 +83,51 @@
 {
   delete mWeatherService;
 }
-void KCMWeather::focusInEvent(QFocusEvent *)
+void KCMWeather::showEvent( QShowEvent * )
 {
   fillStationList();
 }
 
 void KCMWeather::fillStationList()
 {
+  // store current selection
+  QString current = mWidget->m_reportLocation->currentText();
+
+  mWidget->m_reportLocation->clear();
+
   QStringList stationList = mWeatherService->listStations();
   QStringList::Iterator idx = stationList.begin();
+
+  // get station name from station id for sorting afterwards
   for(; idx != stationList.end(); ++idx)
-    mWidget->m_reportLocation->insertItem(mWeatherService->stationName(*idx));
+    *idx = mWeatherService->stationName(*idx);
+
+  stationList.sort();
+
+  idx = stationList.begin();
+  for(; idx != stationList.end(); ++idx)
+    mWidget->m_reportLocation->insertItem(*idx);
+
+  // restore previous selection
+  if ( current.isEmpty() )
+  {
+    // nothing defined yet; show this situation to the user, otherwise
+    // he will see the first available setting which is not what he selected to view
+    mWidget->m_reportLocation->insertItem("");
+    mWidget->m_reportLocation->setCurrentText("");
+  }
+  else
+  {
+    for (int i = 0; i < mWidget->m_reportLocation->count(); i++)
+      if (  mWidget->m_reportLocation->text(i) == current )
+      {
+        mWidget->m_reportLocation->setCurrentItem(i);
+        break;
+      }
+  }
+
+  if ( current != mWidget->m_reportLocation->currentText() )
+    reportLocationChanged();
 }
 
 void KCMWeather::changeViewMode( int mode )
@@ -102,11 +136,6 @@
   emit changed( true );
 }
 
-void KCMWeather::processURL( const QString &url )
-{
-  kapp->invokeBrowser( url );
-}
-
 void KCMWeather::enableLogWidgets( bool value )
 {
   mWidget->m_logFile->setEnabled( value );
@@ -135,7 +164,10 @@
   QString loc =  config.readEntry( "report_location" );
 
   mWidget->m_logFile->setURL( config.readPathEntry( "log_file_name" ) );
-  mWidget->m_reportLocation->setCurrentText( mWeatherService->stationName( loc ) );
+
+  if ( ! loc.isEmpty() )
+    mWidget->m_reportLocation->setCurrentText( mWeatherService->stationName( loc ) );
+
   mWidget->m_viewMode->setButton( config.readNumEntry( "smallview_mode", dockwidget::ShowAll ) );
   changeViewMode( config.readNumEntry( "smallview_mode", dockwidget::ShowAll ) );
   emit changed( false );
@@ -149,8 +181,13 @@
   config.setGroup( "General Options" );
   config.writeEntry( "logging", mWidget->m_enableLog->isChecked() );
   config.writeEntry( "log_file_name", mWidget->m_logFile->url() );
-  // Station idx to local idx
-  config.writeEntry( "report_location", mWeatherService->stationCode( mWidget->m_reportLocation->currentText() ) );
+
+  // Station idx to local idx; if nothing selected yet, keep it empty
+  QString loc;
+  if ( ! mWidget->m_reportLocation->currentText().isEmpty() )
+    loc = mWeatherService->stationCode( mWidget->m_reportLocation->currentText() );
+  config.writeEntry( "report_location", loc);
+
   config.writeEntry( "smallview_mode", mViewMode );
   config.sync();
 
--- branches/KDE/3.5/kdetoys/kweather/kcmweather.h #616272:616273
@@ -41,10 +41,9 @@
 
   protected:
     void fillStationList();
-    void focusInEvent( QFocusEvent * );
+    virtual void showEvent( QShowEvent * );
 
   private slots:
-    void processURL( const QString& );
     void enableLogWidgets( bool value );
     void changeViewMode( int mode );
     void reportLocationChanged();
--- branches/KDE/3.5/kdetoys/kweather/kcmweatherservice.cpp #616272:616273
@@ -43,6 +43,10 @@
 {
   QVBoxLayout *layout = new QVBoxLayout( this );
   mWidget = new ServiceConfigWidget( this );
+
+  // not needed, as a change immediately changes the service
+  //connect(mWidget, SIGNAL(changed(bool)), this, SIGNAL(changed(bool)));
+
   layout->addWidget( mWidget );
   KAboutData *about = new KAboutData( "kcmweatherservice",
                                       I18N_NOOP( "KWeather Configure Dialog" ),
--- branches/KDE/3.5/kdetoys/kweather/kweather.cpp #616272:616273
@@ -52,7 +52,7 @@
         QWidget *parent, const char *name):
         KPanelApplet(configFile, t, actions, parent, name), weatherIface(),
         mFirstRun( false ), mReport( 0 ), mClient( 0 ),
-        mContextMenu( 0 ), mWeatherService( 0 )
+        mContextMenu( 0 ), mWeatherService( 0 ), settingsDialog( 0 )
 {
 	kdDebug(12004) << "Constructor " << endl;
 	setObjId("weatherIface");
@@ -146,32 +146,41 @@
 }
 
 /** prefs */
-void kweather::preferences(){
+void kweather::preferences()
+{
     kdDebug(12004) << "prefs" << endl;
 
     savePrefs();
 
-    static KCMultiDialog *dlg = 0;
+    if ( settingsDialog == 0 )
+    {
+      settingsDialog = new KCMultiDialog( this );
+      connect( settingsDialog, SIGNAL( configCommitted() ), SLOT( slotPrefsAccepted() ) );
 
-    if ( dlg == 0 ) {
-      dlg = new KCMultiDialog( );
-      connect( dlg, SIGNAL( configCommitted(const QCString&) ), SLOT( slotPrefsAccepted() ) );
-
-      dlg->addModule( "kcmweather.desktop" );
-      dlg->addModule( "kcmweatherservice.desktop" );
+      settingsDialog->addModule( "kcmweather.desktop" );
+      settingsDialog->addModule( "kcmweatherservice.desktop" );
     }
 
-    dlg->show();
-    dlg->raise();
+    settingsDialog->show();
+    settingsDialog->raise();
 }
 
 /** The help handler */
-void kweather::help(){
+void kweather::help()
+{
     kapp->invokeHelp(QString::null, QString::fromLatin1("kweather"));
 }
 
 /** Display the current weather report. */
-void kweather::doReport(){
+void kweather::doReport()
+{
+    if ( reportLocation.isEmpty() )
+    {
+        // no station to display defined -> open settings dialog
+        preferences();
+        return;
+    }
+
 	kdDebug(12004) << "Showing out the report" << endl;
 	if ( mReport == 0 )
 	{
--- branches/KDE/3.5/kdetoys/kweather/kweather.h #616272:616273
@@ -77,6 +77,7 @@
 	//DCOPRef *mWeatherService;
 	KPopupMenu *mContextMenu;
 	WeatherService_stub *mWeatherService;
+	KCMultiDialog *settingsDialog;
 };
 
 #endif
--- branches/KDE/3.5/kdetoys/kweather/prefdialogdata.ui #616272:616273
@@ -27,12 +27,6 @@
             <height>0</height>
         </size>
     </property>
-    <property name="maximumSize">
-        <size>
-            <width>640</width>
-            <height>480</height>
-        </size>
-    </property>
     <property name="focusPolicy">
         <enum>TabFocus</enum>
     </property>
@@ -83,6 +77,20 @@
                     <property name="name">
                         <cstring>m_reportLocation</cstring>
                     </property>
+                    <property name="sizePolicy">
+                        <sizepolicy>
+                            <hsizetype>3</hsizetype>
+                            <vsizetype>0</vsizetype>
+                            <horstretch>0</horstretch>
+                            <verstretch>0</verstretch>
+                        </sizepolicy>
+                    </property>
+                    <property name="minimumSize">
+                        <size>
+                            <width>0</width>
+                            <height>0</height>
+                        </size>
+                    </property>
                 </widget>
                 <spacer>
                     <property name="name">
@@ -284,4 +292,10 @@
 </includes>
 <layoutdefaults spacing="3" margin="6"/>
 <layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+    <includehint>kcombobox.h</includehint>
+    <includehint>kurlrequester.h</includehint>
+    <includehint>klineedit.h</includehint>
+    <includehint>kpushbutton.h</includehint>
+</includehints>
 </UI>
Comment 3 Ruud Kuin 2006-12-25 21:53:12 UTC
Hi Martin;

I've solved it quite easily, I removed the KWeather-app from the panel.
After login out I added the KWeather menu again in yhe panel, after that I
could remove and add any new location, Morgantown WV was to be removed...

Hoped it helps you?!?

Ruud



24 Dec 2006 21:05:49 -0000, Martin Koller <m.koller@surfeu.at>:
[bugs.kde.org quoted mail]
<div>Hi Martin;</div>
<div>&nbsp;</div>
<div>I&#39;ve solved it quite easily, I removed the KWeather-app from the panel.</div>
<div>After login out I added the KWeather menu again in yhe panel, after that I could remove and add any new location, Morgantown WV was to be removed...</div>
<div>&nbsp;</div>
<div>Hoped it helps you?!?</div>
<div>&nbsp;</div>
<div>Ruud</div>
<div><br><br>&nbsp;</div>
<div><span class="gmail_quote">24 Dec 2006 21:05:49 -0000, Martin Koller &lt;<a href="mailto:m.koller@surfeu.at">m.koller@surfeu.at</a>&gt;:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">------- You are receiving this mail because: -------<br>You are a voter for the bug, or are watching someone who is.
<br><br><a href="http://bugs.kde.org/show_bug.cgi?id=126296">http://bugs.kde.org/show_bug.cgi?id=126296</a><br>m.koller surfeu at changed:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;What&nbsp;&nbsp;&nbsp;&nbsp;|Removed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |Added<br>----------------------------------------------------------------------------
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Status|UNCONFIRMED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |RESOLVED<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Resolution|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|FIXED<br><br><br><br>------- Additional Comments From m.koller surfeu at&nbsp;&nbsp;2006-12-24 22:05 -------<br>SVN commit 616273 by mkoller:
<br><br>BUG: 124754<br>BUG: 138047<br>BUG: 136683<br>BUG: 126296<br>BUG: 113828<br>BUG: 122850<br>BUG: 118458<br>BUG: 116375<br>BUG: 103887<br>BUG: 76300<br>BUG: 73093<br><br>Long standing bug: make selection of a station work
<br><br><br><br>M&nbsp;&nbsp;+6 -2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dockwidget.cpp<br>M&nbsp;&nbsp;+47 -10&nbsp;&nbsp;&nbsp;&nbsp;kcmweather.cpp<br>M&nbsp;&nbsp;+1 -2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;kcmweather.h<br>M&nbsp;&nbsp;+4 -0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;kcmweatherservice.cpp<br>M&nbsp;&nbsp;+22 -13&nbsp;&nbsp;&nbsp;&nbsp;kweather.cpp<br>M&nbsp;&nbsp;+1 -0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;kweather.h<br>M&nbsp;&nbsp;+20 -6&nbsp;&nbsp;&nbsp;&nbsp; 
prefdialogdata.ui<br><br><br>--- branches/KDE/3.5/kdetoys/kweather/dockwidget.cpp #616272:616273<br>@ -47,7 +47,8&nbsp;&nbsp;@<br><br>void dockwidget::setLocationCode(const QString &amp;locationCode)<br>{<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_locationCode = locationCode;
<br>+&nbsp;&nbsp;&nbsp;&nbsp;m_locationCode = locationCode;<br>+&nbsp;&nbsp;&nbsp;&nbsp;showWeather();<br>}<br><br>void dockwidget::setViewMode(int _mode)<br>@ -82,7 +83,7&nbsp;&nbsp;@<br>&nbsp;&nbsp;&nbsp;&nbsp;QString wind&nbsp;&nbsp;&nbsp;&nbsp; = &quot;?&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;QString pressure = &quot;?&quot;;<br><br>
-&nbsp;&nbsp;&nbsp;&nbsp;if ( m_weatherService-&gt;stationNeedsMaintenance( m_locationCode ) )<br>+&nbsp;&nbsp;&nbsp;&nbsp;if ( !m_locationCode.isEmpty() &amp;&amp; m_weatherService-&gt;stationNeedsMaintenance( m_locationCode ) )<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tip = i18n(&quot;Station reports that it needs maintenance\n&quot;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;Please try again later&quot;);<br>@ -111,6 +112,9&nbsp;&nbsp;@<br>&nbsp;&nbsp;&nbsp;&nbsp;// On null or empty location code, or if the station needs maintenance, this will return the dunno icon.<br>&nbsp;&nbsp;&nbsp;&nbsp;QPixmap icon = m_weatherService-&gt;icon( m_locationCode );
<br><br>+&nbsp;&nbsp;&nbsp;&nbsp;if ( ! m_locationCode.isEmpty() )<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tip = m_weatherService-&gt;stationName( m_locationCode ) + &quot;\n&quot; + tip;<br>+<br>&nbsp;&nbsp;&nbsp;&nbsp;QToolTip::remove(m_button);<br>&nbsp;&nbsp;&nbsp;&nbsp;QToolTip::add(m_button, tip);<br><br>
--- branches/KDE/3.5/kdetoys/kweather/kcmweather.cpp #616272:616273<br>@ -83,17 +83,51&nbsp;&nbsp;@<br>{<br>&nbsp;&nbsp;delete mWeatherService;<br>}<br>-void KCMWeather::focusInEvent(QFocusEvent *)<br>+void KCMWeather::showEvent( QShowEvent * )
<br>{<br>&nbsp;&nbsp;fillStationList();<br>}<br><br>void KCMWeather::fillStationList()<br>{<br>+&nbsp;&nbsp;// store current selection<br>+&nbsp;&nbsp;QString current = mWidget-&gt;m_reportLocation-&gt;currentText();<br>+<br>+&nbsp;&nbsp;mWidget-&gt;m_reportLocation-&gt;clear();
<br>+<br>&nbsp;&nbsp;QStringList stationList = mWeatherService-&gt;listStations();<br>&nbsp;&nbsp;QStringList::Iterator idx = stationList.begin();<br>+<br>+&nbsp;&nbsp;// get station name from station id for sorting afterwards<br>&nbsp;&nbsp;for(; idx != stationList.end
(); ++idx)<br>-&nbsp;&nbsp;&nbsp;&nbsp;mWidget-&gt;m_reportLocation-&gt;insertItem(mWeatherService-&gt;stationName(*idx));<br>+&nbsp;&nbsp;&nbsp;&nbsp;*idx = mWeatherService-&gt;stationName(*idx);<br>+<br>+&nbsp;&nbsp;stationList.sort();<br>+<br>+&nbsp;&nbsp;idx = stationList.begin
();<br>+&nbsp;&nbsp;for(; idx != stationList.end(); ++idx)<br>+&nbsp;&nbsp;&nbsp;&nbsp;mWidget-&gt;m_reportLocation-&gt;insertItem(*idx);<br>+<br>+&nbsp;&nbsp;// restore previous selection<br>+&nbsp;&nbsp;if ( current.isEmpty() )<br>+&nbsp;&nbsp;{<br>+&nbsp;&nbsp;&nbsp;&nbsp;// nothing defined yet; show this situation to the user, otherwise
<br>+&nbsp;&nbsp;&nbsp;&nbsp;// he will see the first available setting which is not what he selected to view<br>+&nbsp;&nbsp;&nbsp;&nbsp;mWidget-&gt;m_reportLocation-&gt;insertItem(&quot;&quot;);<br>+&nbsp;&nbsp;&nbsp;&nbsp;mWidget-&gt;m_reportLocation-&gt;setCurrentText(&quot;&quot;);
<br>+&nbsp;&nbsp;}<br>+&nbsp;&nbsp;else<br>+&nbsp;&nbsp;{<br>+&nbsp;&nbsp;&nbsp;&nbsp;for (int i = 0; i &lt; mWidget-&gt;m_reportLocation-&gt;count(); i++)<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (&nbsp;&nbsp;mWidget-&gt;m_reportLocation-&gt;text(i) == current )<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mWidget-&gt;m_reportLocation-&gt;setCurrentItem(i);
<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>+&nbsp;&nbsp;}<br>+<br>+&nbsp;&nbsp;if ( current != mWidget-&gt;m_reportLocation-&gt;currentText() )<br>+&nbsp;&nbsp;&nbsp;&nbsp;reportLocationChanged();<br>}<br><br>void KCMWeather::changeViewMode( int mode )<br>@ -102,11 +136,6&nbsp;&nbsp;@
<br>&nbsp;&nbsp;emit changed( true );<br>}<br><br>-void KCMWeather::processURL( const QString &amp;url )<br>-{<br>-&nbsp;&nbsp;kapp-&gt;invokeBrowser( url );<br>-}<br>-<br>void KCMWeather::enableLogWidgets( bool value )<br>{<br>&nbsp;&nbsp;mWidget-&gt;m_logFile-&gt;setEnabled( value );
<br>@ -135,7 +164,10&nbsp;&nbsp;@<br>&nbsp;&nbsp;QString loc =&nbsp;&nbsp;config.readEntry( &quot;report_location&quot; );<br><br>&nbsp;&nbsp;mWidget-&gt;m_logFile-&gt;setURL( config.readPathEntry( &quot;log_file_name&quot; ) );<br>-&nbsp;&nbsp;mWidget-&gt;m_reportLocation-&gt;setCurrentText( mWeatherService-&gt;stationName( loc ) );
<br>+<br>+&nbsp;&nbsp;if ( ! loc.isEmpty() )<br>+&nbsp;&nbsp;&nbsp;&nbsp;mWidget-&gt;m_reportLocation-&gt;setCurrentText( mWeatherService-&gt;stationName( loc ) );<br>+<br>&nbsp;&nbsp;mWidget-&gt;m_viewMode-&gt;setButton( config.readNumEntry( &quot;smallview_mode&quot;, dockwidget::ShowAll ) );
<br>&nbsp;&nbsp;changeViewMode( config.readNumEntry( &quot;smallview_mode&quot;, dockwidget::ShowAll ) );<br>&nbsp;&nbsp;emit changed( false );<br>@ -149,8 +181,13&nbsp;&nbsp;@<br>&nbsp;&nbsp;config.setGroup( &quot;General Options&quot; );<br>&nbsp;&nbsp;config.writeEntry
( &quot;logging&quot;, mWidget-&gt;m_enableLog-&gt;isChecked() );<br>&nbsp;&nbsp;config.writeEntry( &quot;log_file_name&quot;, mWidget-&gt;m_logFile-&gt;url() );<br>-&nbsp;&nbsp;// Station idx to local idx<br>-&nbsp;&nbsp;config.writeEntry( &quot;report_location&quot;, mWeatherService-&gt;stationCode( mWidget-&gt;m_reportLocation-&gt;currentText() ) );
<br>+<br>+&nbsp;&nbsp;// Station idx to local idx; if nothing selected yet, keep it empty<br>+&nbsp;&nbsp;QString loc;<br>+&nbsp;&nbsp;if ( ! mWidget-&gt;m_reportLocation-&gt;currentText().isEmpty() )<br>+&nbsp;&nbsp;&nbsp;&nbsp;loc = mWeatherService-&gt;stationCode( mWidget-&gt;m_reportLocation-&gt;currentText() );
<br>+&nbsp;&nbsp;config.writeEntry( &quot;report_location&quot;, loc);<br>+<br>&nbsp;&nbsp;config.writeEntry( &quot;smallview_mode&quot;, mViewMode );<br>&nbsp;&nbsp;config.sync();<br><br>--- branches/KDE/3.5/kdetoys/kweather/kcmweather.h #616272:616273
<br>@ -41,10 +41,9&nbsp;&nbsp;@<br><br>&nbsp;&nbsp;protected:<br>&nbsp;&nbsp;&nbsp;&nbsp;void fillStationList();<br>-&nbsp;&nbsp;&nbsp;&nbsp;void focusInEvent( QFocusEvent * );<br>+&nbsp;&nbsp;&nbsp;&nbsp;virtual void showEvent( QShowEvent * );<br><br>&nbsp;&nbsp;private slots:<br>-&nbsp;&nbsp;&nbsp;&nbsp;void processURL( const QString&amp; );
<br>&nbsp;&nbsp;&nbsp;&nbsp;void enableLogWidgets( bool value );<br>&nbsp;&nbsp;&nbsp;&nbsp;void changeViewMode( int mode );<br>&nbsp;&nbsp;&nbsp;&nbsp;void reportLocationChanged();<br>--- branches/KDE/3.5/kdetoys/kweather/kcmweatherservice.cpp #616272:616273<br>@ -43,6 +43,10&nbsp;&nbsp;@<br>
{<br>&nbsp;&nbsp;QVBoxLayout *layout = new QVBoxLayout( this );<br>&nbsp;&nbsp;mWidget = new ServiceConfigWidget( this );<br>+<br>+&nbsp;&nbsp;// not needed, as a change immediately changes the service<br>+&nbsp;&nbsp;//connect(mWidget, SIGNAL(changed(bool)), this, SIGNAL(changed(bool)));
<br>+<br>&nbsp;&nbsp;layout-&gt;addWidget( mWidget );<br>&nbsp;&nbsp;KAboutData *about = new KAboutData( &quot;kcmweatherservice&quot;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I18N_NOOP( &quot;KWeather Configure Dialog&quot; ),<br>--- branches/KDE/3.5/kdetoys/kweather/kweather.cpp #616272:616273
<br>@ -52,7 +52,7&nbsp;&nbsp;@<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;QWidget *parent, const char *name):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;KPanelApplet(configFile, t, actions, parent, name), weatherIface(),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mFirstRun( false ), mReport( 0 ), mClient( 0 ),<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mContextMenu( 0 ), mWeatherService( 0 )
<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mContextMenu( 0 ), mWeatherService( 0 ), settingsDialog( 0 )<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kdDebug(12004) &lt;&lt; &quot;Constructor &quot; &lt;&lt; endl;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setObjId(&quot;weatherIface&quot;);<br>@ -146,32 +146,41&nbsp;&nbsp;@
<br>}<br><br>/** prefs */<br>-void kweather::preferences(){<br>+void kweather::preferences()<br>+{<br>&nbsp;&nbsp;&nbsp;&nbsp;kdDebug(12004) &lt;&lt; &quot;prefs&quot; &lt;&lt; endl;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;savePrefs();<br><br>-&nbsp;&nbsp;&nbsp;&nbsp;static KCMultiDialog *dlg = 0;
<br>+&nbsp;&nbsp;&nbsp;&nbsp;if ( settingsDialog == 0 )<br>+&nbsp;&nbsp;&nbsp;&nbsp;{<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;settingsDialog = new KCMultiDialog( this );<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connect( settingsDialog, SIGNAL( configCommitted() ), SLOT( slotPrefsAccepted() ) );<br><br>-&nbsp;&nbsp;&nbsp;&nbsp;if ( dlg == 0 ) {
<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dlg = new KCMultiDialog( );<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connect( dlg, SIGNAL( configCommitted(const QCString&amp;) ), SLOT( slotPrefsAccepted() ) );<br>-<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dlg-&gt;addModule( &quot;kcmweather.desktop&quot; );<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dlg-&gt;addModule( &quot;
kcmweatherservice.desktop&quot; );<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;settingsDialog-&gt;addModule( &quot;kcmweather.desktop&quot; );<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;settingsDialog-&gt;addModule( &quot;kcmweatherservice.desktop&quot; );<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>-&nbsp;&nbsp;&nbsp;&nbsp;dlg-&gt;show();
<br>-&nbsp;&nbsp;&nbsp;&nbsp;dlg-&gt;raise();<br>+&nbsp;&nbsp;&nbsp;&nbsp;settingsDialog-&gt;show();<br>+&nbsp;&nbsp;&nbsp;&nbsp;settingsDialog-&gt;raise();<br>}<br><br>/** The help handler */<br>-void kweather::help(){<br>+void kweather::help()<br>+{<br>&nbsp;&nbsp;&nbsp;&nbsp;kapp-&gt;invokeHelp(QString::null, QString::fromLatin1(&quot;kweather&quot;));
<br>}<br><br>/** Display the current weather report. */<br>-void kweather::doReport(){<br>+void kweather::doReport()<br>+{<br>+&nbsp;&nbsp;&nbsp;&nbsp;if ( reportLocation.isEmpty() )<br>+&nbsp;&nbsp;&nbsp;&nbsp;{<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// no station to display defined -&gt; open settings dialog
<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;preferences();<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;<br>+&nbsp;&nbsp;&nbsp;&nbsp;}<br>+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kdDebug(12004) &lt;&lt; &quot;Showing out the report&quot; &lt;&lt; endl;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( mReport == 0 )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>--- branches/KDE/3.5/kdetoys/kweather/kweather.h #616272:616273
<br>@ -77,6 +77,7&nbsp;&nbsp;@<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //DCOPRef *mWeatherService;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; KPopupMenu *mContextMenu;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WeatherService_stub *mWeatherService;<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; KCMultiDialog *settingsDialog;<br>};<br><br>#endif<br>--- branches/KDE/3.5/kdetoys/kweather/prefdialogdata.ui #616272:616273
<br>@ -27,12 +27,6&nbsp;&nbsp;@<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;height&gt;0&lt;/height&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/size&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property&gt;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&lt;property name=&quot;maximumSize&quot;&gt;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;size&gt;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;width&gt;640&lt;/width&gt;
<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;height&gt;480&lt;/height&gt;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/size&gt;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;property name=&quot;focusPolicy&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;enum&gt;TabFocus&lt;/enum&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property&gt;
<br>@ -83,6 +77,20&nbsp;&nbsp;@<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;property name=&quot;name&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n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6&quot;/&gt;
<br>&lt;layoutfunctions spacing=&quot;KDialog::spacingHint&quot; margin=&quot;KDialog::marginHint&quot;/&gt;<br>+&lt;includehints&gt;<br>+&nbsp;&nbsp;&nbsp;&nbsp;&lt;includehint&gt;kcombobox.h&lt;/includehint&gt;<br>+&nbsp;&nbsp;&nbsp;&nbsp;&lt;includehint&gt;kurlrequester.h
&lt;/includehint&gt;<br>+&nbsp;&nbsp;&nbsp;&nbsp;&lt;includehint&gt;klineedit.h&lt;/includehint&gt;<br>+&nbsp;&nbsp;&nbsp;&nbsp;&lt;includehint&gt;kpushbutton.h&lt;/includehint&gt;<br>+&lt;/includehints&gt;<br>&lt;/UI&gt;<br></blockquote></div><br>