| Summary: | Always comes up with Morgantown WV and location won't change from that | ||
|---|---|---|---|
| Product: | [Unmaintained] kweather-kde3 | Reporter: | steve fisher <sfisher> |
| Component: | general | Assignee: | geiseri |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | 2.1 | ||
| Target Milestone: | --- | ||
| Platform: | unspecified | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
steve fisher
2006-04-26 17:33:42 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. 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>
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> </div> <div>I'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> </div> <div>Hoped it helps you?!?</div> <div> </div> <div>Ruud</div> <div><br><br> </div> <div><span class="gmail_quote">24 Dec 2006 21:05:49 -0000, Martin Koller <<a href="mailto:m.koller@surfeu.at">m.koller@surfeu.at</a>>:</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> What |Removed |Added<br>---------------------------------------------------------------------------- <br> Status|UNCONFIRMED |RESOLVED<br> Resolution| |FIXED<br><br><br><br>------- Additional Comments From m.koller surfeu at 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 +6 -2 dockwidget.cpp<br>M +47 -10 kcmweather.cpp<br>M +1 -2 kcmweather.h<br>M +4 -0 kcmweatherservice.cpp<br>M +22 -13 kweather.cpp<br>M +1 -0 kweather.h<br>M +20 -6 prefdialogdata.ui<br><br><br>--- branches/KDE/3.5/kdetoys/kweather/dockwidget.cpp #616272:616273<br>@ -47,7 +47,8 @<br><br>void dockwidget::setLocationCode(const QString &locationCode)<br>{<br>- m_locationCode = locationCode; <br>+ m_locationCode = locationCode;<br>+ showWeather();<br>}<br><br>void dockwidget::setViewMode(int _mode)<br>@ -82,7 +83,7 @<br> QString wind = "?";<br> QString pressure = "?";<br><br> - if ( m_weatherService->stationNeedsMaintenance( m_locationCode ) )<br>+ if ( !m_locationCode.isEmpty() && m_weatherService->stationNeedsMaintenance( m_locationCode ) )<br> {<br> tip = i18n("Station reports that it needs maintenance\n" <br> "Please try again later");<br>@ -111,6 +112,9 @<br> // On null or empty location code, or if the station needs maintenance, this will return the dunno icon.<br> QPixmap icon = m_weatherService->icon( m_locationCode ); <br><br>+ if ( ! m_locationCode.isEmpty() )<br>+ tip = m_weatherService->stationName( m_locationCode ) + "\n" + tip;<br>+<br> QToolTip::remove(m_button);<br> QToolTip::add(m_button, tip);<br><br> --- branches/KDE/3.5/kdetoys/kweather/kcmweather.cpp #616272:616273<br>@ -83,17 +83,51 @<br>{<br> delete mWeatherService;<br>}<br>-void KCMWeather::focusInEvent(QFocusEvent *)<br>+void KCMWeather::showEvent( QShowEvent * ) <br>{<br> fillStationList();<br>}<br><br>void KCMWeather::fillStationList()<br>{<br>+ // store current selection<br>+ QString current = mWidget->m_reportLocation->currentText();<br>+<br>+ mWidget->m_reportLocation->clear(); <br>+<br> QStringList stationList = mWeatherService->listStations();<br> QStringList::Iterator idx = stationList.begin();<br>+<br>+ // get station name from station id for sorting afterwards<br> for(; idx != stationList.end (); ++idx)<br>- mWidget->m_reportLocation->insertItem(mWeatherService->stationName(*idx));<br>+ *idx = mWeatherService->stationName(*idx);<br>+<br>+ stationList.sort();<br>+<br>+ idx = stationList.begin ();<br>+ for(; idx != stationList.end(); ++idx)<br>+ mWidget->m_reportLocation->insertItem(*idx);<br>+<br>+ // restore previous selection<br>+ if ( current.isEmpty() )<br>+ {<br>+ // nothing defined yet; show this situation to the user, otherwise <br>+ // he will see the first available setting which is not what he selected to view<br>+ mWidget->m_reportLocation->insertItem("");<br>+ mWidget->m_reportLocation->setCurrentText(""); <br>+ }<br>+ else<br>+ {<br>+ for (int i = 0; i < mWidget->m_reportLocation->count(); i++)<br>+ if ( mWidget->m_reportLocation->text(i) == current )<br>+ {<br>+ mWidget->m_reportLocation->setCurrentItem(i); <br>+ break;<br>+ }<br>+ }<br>+<br>+ if ( current != mWidget->m_reportLocation->currentText() )<br>+ reportLocationChanged();<br>}<br><br>void KCMWeather::changeViewMode( int mode )<br>@ -102,11 +136,6 @ <br> emit changed( true );<br>}<br><br>-void KCMWeather::processURL( const QString &url )<br>-{<br>- kapp->invokeBrowser( url );<br>-}<br>-<br>void KCMWeather::enableLogWidgets( bool value )<br>{<br> mWidget->m_logFile->setEnabled( value ); <br>@ -135,7 +164,10 @<br> QString loc = config.readEntry( "report_location" );<br><br> mWidget->m_logFile->setURL( config.readPathEntry( "log_file_name" ) );<br>- mWidget->m_reportLocation->setCurrentText( mWeatherService->stationName( loc ) ); <br>+<br>+ if ( ! loc.isEmpty() )<br>+ mWidget->m_reportLocation->setCurrentText( mWeatherService->stationName( loc ) );<br>+<br> mWidget->m_viewMode->setButton( config.readNumEntry( "smallview_mode", dockwidget::ShowAll ) ); <br> changeViewMode( config.readNumEntry( "smallview_mode", dockwidget::ShowAll ) );<br> emit changed( false );<br>@ -149,8 +181,13 @<br> config.setGroup( "General Options" );<br> config.writeEntry ( "logging", mWidget->m_enableLog->isChecked() );<br> config.writeEntry( "log_file_name", mWidget->m_logFile->url() );<br>- // Station idx to local idx<br>- config.writeEntry( "report_location", mWeatherService->stationCode( mWidget->m_reportLocation->currentText() ) ); <br>+<br>+ // Station idx to local idx; if nothing selected yet, keep it empty<br>+ QString loc;<br>+ if ( ! mWidget->m_reportLocation->currentText().isEmpty() )<br>+ loc = mWeatherService->stationCode( mWidget->m_reportLocation->currentText() ); <br>+ config.writeEntry( "report_location", loc);<br>+<br> config.writeEntry( "smallview_mode", mViewMode );<br> config.sync();<br><br>--- branches/KDE/3.5/kdetoys/kweather/kcmweather.h #616272:616273 <br>@ -41,10 +41,9 @<br><br> protected:<br> void fillStationList();<br>- void focusInEvent( QFocusEvent * );<br>+ virtual void showEvent( QShowEvent * );<br><br> private slots:<br>- void processURL( const QString& ); <br> void enableLogWidgets( bool value );<br> void changeViewMode( int mode );<br> void reportLocationChanged();<br>--- branches/KDE/3.5/kdetoys/kweather/kcmweatherservice.cpp #616272:616273<br>@ -43,6 +43,10 @<br> {<br> QVBoxLayout *layout = new QVBoxLayout( this );<br> mWidget = new ServiceConfigWidget( this );<br>+<br>+ // not needed, as a change immediately changes the service<br>+ //connect(mWidget, SIGNAL(changed(bool)), this, SIGNAL(changed(bool))); <br>+<br> layout->addWidget( mWidget );<br> KAboutData *about = new KAboutData( "kcmweatherservice",<br> I18N_NOOP( "KWeather Configure Dialog" ),<br>--- branches/KDE/3.5/kdetoys/kweather/kweather.cpp #616272:616273 <br>@ -52,7 +52,7 @<br> QWidget *parent, const char *name):<br> KPanelApplet(configFile, t, actions, parent, name), weatherIface(),<br> mFirstRun( false ), mReport( 0 ), mClient( 0 ),<br>- mContextMenu( 0 ), mWeatherService( 0 ) <br>+ mContextMenu( 0 ), mWeatherService( 0 ), settingsDialog( 0 )<br>{<br> kdDebug(12004) << "Constructor " << endl;<br> setObjId("weatherIface");<br>@ -146,32 +146,41 @ <br>}<br><br>/** prefs */<br>-void kweather::preferences(){<br>+void kweather::preferences()<br>+{<br> kdDebug(12004) << "prefs" << endl;<br><br> savePrefs();<br><br>- static KCMultiDialog *dlg = 0; <br>+ if ( settingsDialog == 0 )<br>+ {<br>+ settingsDialog = new KCMultiDialog( this );<br>+ connect( settingsDialog, SIGNAL( configCommitted() ), SLOT( slotPrefsAccepted() ) );<br><br>- if ( dlg == 0 ) { <br>- dlg = new KCMultiDialog( );<br>- connect( dlg, SIGNAL( configCommitted(const QCString&) ), SLOT( slotPrefsAccepted() ) );<br>-<br>- dlg->addModule( "kcmweather.desktop" );<br>- dlg->addModule( " kcmweatherservice.desktop" );<br>+ settingsDialog->addModule( "kcmweather.desktop" );<br>+ settingsDialog->addModule( "kcmweatherservice.desktop" );<br> }<br><br>- dlg->show(); <br>- dlg->raise();<br>+ settingsDialog->show();<br>+ settingsDialog->raise();<br>}<br><br>/** The help handler */<br>-void kweather::help(){<br>+void kweather::help()<br>+{<br> kapp->invokeHelp(QString::null, QString::fromLatin1("kweather")); <br>}<br><br>/** Display the current weather report. */<br>-void kweather::doReport(){<br>+void kweather::doReport()<br>+{<br>+ if ( reportLocation.isEmpty() )<br>+ {<br>+ // no station to display defined -> open settings dialog <br>+ preferences();<br>+ return;<br>+ }<br>+<br> kdDebug(12004) << "Showing out the report" << endl;<br> if ( mReport == 0 )<br> {<br>--- branches/KDE/3.5/kdetoys/kweather/kweather.h #616272:616273 <br>@ -77,6 +77,7 @<br> //DCOPRef *mWeatherService;<br> KPopupMenu *mContextMenu;<br> WeatherService_stub *mWeatherService;<br>+ KCMultiDialog *settingsDialog;<br>};<br><br>#endif<br>--- branches/KDE/3.5/kdetoys/kweather/prefdialogdata.ui #616272:616273 <br>@ -27,12 +27,6 @<br> <height>0</height><br> </size><br> </property><br>- <property name="maximumSize"><br>- <size><br>- <width>640</width> <br>- <height>480</height><br>- </size><br>- </property><br> <property name="focusPolicy"><br> <enum>TabFocus</enum><br> </property> <br>@ -83,6 +77,20 @<br> <property name="name"><br> <cstring>m_reportLocation</cstring><br> </property><br>+ <property name="sizePolicy"> <br>+ <sizepolicy><br>+ <hsizetype>3</hsizetype><br>+ <vsizetype>0</vsizetype><br>+ <horstretch>0</horstretch> <br>+ <verstretch>0</verstretch><br>+ </sizepolicy><br>+ </property><br>+ <property name="minimumSize"> <br>+ <size><br>+ <width>0</width><br>+ <height>0</height><br>+ </size><br>+ </property> <br> </widget><br> <spacer><br> <property name="name"><br>@ -284,4 +292,10 @<br></includes><br><layoutdefaults spacing="3" margin="6"/> <br><layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/><br>+<includehints><br>+ <includehint>kcombobox.h</includehint><br>+ <includehint>kurlrequester.h </includehint><br>+ <includehint>klineedit.h</includehint><br>+ <includehint>kpushbutton.h</includehint><br>+</includehints><br></UI><br></blockquote></div><br> |