KWeather: Split Display module in two sumbodules

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
pull/18/head
Mavridis Philippe 3 years ago
parent 257301adc0
commit b1d0b204e1
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494

@ -110,21 +110,29 @@ tde_add_kpart( weather_panelapplet AUTOMOC
)
##### kcm_weather (kpart) #######################
##### kcm_weatherapplet (kpart) #################
tde_add_kpart( kcm_weather AUTOMOC
SOURCES kcmweather.cpp prefdialogdata.ui
tde_add_kpart( kcm_weatherapplet AUTOMOC
SOURCES kcmweatherapplet.cpp appletconfig.ui
weatherservice.stub
LINK tdeio-shared
DESTINATION ${PLUGIN_INSTALL_DIR}
)
##### kcm_weatherservice (kpart) ################
##### kcm_weatherservice (kpart) #################
tde_add_kpart( kcm_weatherservice AUTOMOC
SOURCES kcmweatherservice.cpp
serviceconfigwidget.cpp serviceconfigdata.ui
SOURCES kcmweatherservice.cpp serviceconfig.ui
weatherservice.stub
LINK tdeio-shared
DESTINATION ${PLUGIN_INSTALL_DIR}
)
##### kcm_weatherstations (kpart) ################
tde_add_kpart( kcm_weatherstations AUTOMOC
SOURCES kcmweatherstations.cpp
stationsconfigwidget.cpp stationsconfig.ui
weatherservice.stub
LINK tdeui-shared tdehtml-shared
DESTINATION ${PLUGIN_INSTALL_DIR}
@ -171,8 +179,9 @@ tde_create_translated_desktop(
tde_create_translated_desktop(
SOURCE
kweatherservice.desktop
kcmweather.desktop
kcmweatherapplet.desktop
kcmweatherservice.desktop
kcmweatherstations.desktop
DESTINATION ${SERVICES_INSTALL_DIR}
PO_DIR kweather-desktops
)

@ -1,16 +1,16 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>prefsDialogData</class>
<class>appletConfig</class>
<author>ian reinhart geiser &lt;geiseri@kde.org&gt;</author>
<widget class="TQWidget">
<property name="name">
<cstring>prefsDialogData</cstring>
<cstring>appletConfig</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>761</width>
<height>464</height>
<height>385</height>
</rect>
</property>
<property name="sizePolicy">
@ -28,7 +28,7 @@
</size>
</property>
<property name="caption">
<string>prefsDialogData</string>
<string>appletConfig</string>
</property>
<property name="focusPolicy">
<enum>TabFocus</enum>
@ -138,14 +138,18 @@
<property name="exclusive">
<bool>true</bool>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQRadioButton">
<property name="name">
<cstring>m_smallView</cstring>
</property>
<property name="geometry">
<rect>
<x>6</x>
<y>24</y>
<width>747</width>
<height>26</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>1</hsizetype>
@ -169,34 +173,49 @@
</widget>
<widget class="TQRadioButton">
<property name="name">
<cstring>CheckBox9</cstring>
<cstring>CheckBox10</cstring>
</property>
<property name="geometry">
<rect>
<x>6</x>
<y>82</y>
<width>747</width>
<height>26</height>
</rect>
</property>
<property name="text">
<string>Show &amp;icon and temperature</string>
<string>Show icon, temperature, &amp;wind and pressure information</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="buttonGroupId">
<number>2</number>
<number>3</number>
</property>
</widget>
<widget class="TQRadioButton">
<property name="name">
<cstring>CheckBox10</cstring>
<cstring>CheckBox9</cstring>
</property>
<property name="text">
<string>Show icon, temperature, &amp;wind and pressure information</string>
<property name="geometry">
<rect>
<x>6</x>
<y>53</y>
<width>747</width>
<height>26</height>
</rect>
</property>
<property name="checked">
<bool>true</bool>
<property name="text">
<string>Show &amp;icon and temperature</string>
</property>
<property name="buttonGroupId">
<number>3</number>
<number>2</number>
</property>
</widget>
</vbox>
</widget>
<widget class="TQGroupBox">
<property name="name">
<cstring>GroupBox1</cstring>
<cstring>groupBox3</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
@ -206,110 +225,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Logging Options</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQCheckBox" row="0" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>m_enableLog</cstring>
</property>
<property name="text">
<string>E&amp;nable logging</string>
</property>
</widget>
<spacer row="0" column="2">
<property name="name">
<cstring>Spacer6_2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>294</width>
<height>16</height>
</size>
</property>
</spacer>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>m_labelLogFile</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Log &amp;file:</string>
</property>
<property name="buddy" stdset="0">
<cstring>m_logFile</cstring>
</property>
</widget>
<widget class="KURLRequester" row="1" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>m_logFile</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>252</width>
<height>0</height>
</size>
</property>
<property name="toolTip" stdset="0">
<string>Enter the logfile name.</string>
</property>
<property name="whatsThis" stdset="0">
<string>Enter the full path and filename to enable logging in KWeather.</string>
</property>
</widget>
</grid>
</widget>
<widget class="TQButtonGroup">
<property name="name">
<cstring>m_iconTheme</cstring>
</property>
<property name="title">
<string>Weather Icons</string>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQRadioButton">
<property name="name">
<cstring>m_systemIcons</cstring>
</property>
<property name="text">
<string>&amp;Use system theme</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="TQRadioButton">
<property name="name">
<cstring>m_kweatherIcons</cstring>
</property>
<property name="text">
<string>Use classic &amp;KWeather theme</string>
</property>
</widget>
</vbox>
</widget>
<widget class="TQGroupBox">
<property name="name">
<cstring>groupBox3</cstring>
</property>
<property name="title">
<string>Text</string>
</property>
@ -351,33 +266,36 @@
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
<enum>MinimumExpanding</enum>
</property>
<property name="sizeHint">
<size>
<width>637</width>
<width>624</width>
<height>20</height>
</size>
</property>
</spacer>
</hbox>
</widget>
<spacer>
<property name="name">
<cstring>spacer4</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>MinimumExpanding</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>91</height>
</size>
</property>
</spacer>
</vbox>
</widget>
<connections>
<connection>
<sender>m_enableLog</sender>
<signal>toggled(bool)</signal>
<receiver>m_labelLogFile</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>m_enableLog</sender>
<signal>toggled(bool)</signal>
<receiver>m_logFile</receiver>
<slot>setEnabled(bool)</slot>
</connection>
</connections>
<includes>
<include location="global" impldecl="in implementation">kcolorbutton.h</include>
<include location="global" impldecl="in implementation">kcombobox.h</include>

@ -36,26 +36,26 @@
#include <kcolorbutton.h>
#include "dockwidget.h"
#include "prefdialogdata.h"
#include "appletconfig.h"
#include "kcmweather.h"
#include "kcmweatherapplet.h"
#include "weatherservice_stub.h"
extern "C"
{
KDE_EXPORT TDECModule *create_weather( TQWidget *parent, const char * )
KDE_EXPORT TDECModule *create_weatherapplet( TQWidget *parent, const char * )
{
return new KCMWeather( parent, "kweather" );
return new KCMWeatherApplet( parent, "kweather" );
}
}
KCMWeather::KCMWeather( TQWidget *parent, const char *name )
KCMWeatherApplet::KCMWeatherApplet( TQWidget *parent, const char *name )
: TDECModule( parent, name )
{
mWeatherService = new WeatherService_stub( "KWeatherService",
"WeatherService" );
TQVBoxLayout *layout = new TQVBoxLayout( this );
mWidget = new prefsDialogData( this );
mWidget = new appletConfig( this );
mWidget->m_reportLocation->setFocus();
layout->addWidget( mWidget );
@ -63,19 +63,15 @@ KCMWeather::KCMWeather( TQWidget *parent, const char *name )
fillStationList();
load();
connect( mWidget->m_enableLog, TQT_SIGNAL( toggled( bool ) ),
TQT_SLOT( enableLogWidgets( bool ) ) );
connect( mWidget->m_viewMode, TQT_SIGNAL( released( int ) ),
TQT_SLOT( changeViewMode( int ) ) );
connect( mWidget->m_reportLocation, TQT_SIGNAL( activated( const TQString& ) ),
TQT_SLOT( reportLocationChanged() ) );
connect( mWidget->m_textColor, TQT_SIGNAL( changed(const TQColor &) ),
TQT_SLOT( textColorChanged(const TQColor &) ) );
connect( mWidget->m_iconTheme, TQT_SIGNAL( released( int ) ),
TQT_SLOT( changed() ) );
TDEAboutData *about = new TDEAboutData(
I18N_NOOP( "kcmweather" ),
I18N_NOOP( "kcmweatherapplet" ),
I18N_NOOP( "KWeather Configure Dialog" ),
0, 0, TDEAboutData::License_GPL,
I18N_NOOP( "(c), 2003 Tobias Koenig" ) );
@ -84,16 +80,16 @@ KCMWeather::KCMWeather( TQWidget *parent, const char *name )
setAboutData(about);
}
KCMWeather::~KCMWeather()
KCMWeatherApplet::~KCMWeatherApplet()
{
delete mWeatherService;
}
void KCMWeather::showEvent( TQShowEvent * )
void KCMWeatherApplet::showEvent( TQShowEvent * )
{
fillStationList();
}
void KCMWeather::fillStationList()
void KCMWeatherApplet::fillStationList()
{
// store current selection
TQString current = mWidget->m_reportLocation->currentText();
@ -135,41 +131,30 @@ void KCMWeather::fillStationList()
reportLocationChanged();
}
void KCMWeather::changeViewMode( int mode )
void KCMWeatherApplet::changeViewMode( int mode )
{
mViewMode = mode;
emit changed( true );
}
void KCMWeather::enableLogWidgets( bool value )
{
mWidget->m_logFile->setEnabled( value );
mWidget->m_labelLogFile->setEnabled( value );
emit changed( true );
}
void KCMWeather::reportLocationChanged()
void KCMWeatherApplet::reportLocationChanged()
{
kdDebug() << "New station: " << mWidget->m_reportLocation->currentText()
<< " Code: " << mWeatherService->stationCode( mWidget->m_reportLocation->currentText() ) << endl;
emit changed( true );
}
void KCMWeather::textColorChanged(const TQColor &)
void KCMWeatherApplet::textColorChanged(const TQColor &)
{
emit changed( true );
}
void KCMWeather::load()
void KCMWeatherApplet::load()
{
kdDebug() << "Load" << endl;
TDEConfig config( "weather_panelappletrc" );
config.setGroup( "General Options" );
bool enabled = config.readBoolEntry( "logging", false );
mWidget->m_enableLog->setChecked( enabled );
enableLogWidgets( enabled );
static TQColor black(TQt::black);
TQColor textColor = config.readColorEntry("textColor", &black);
@ -177,27 +162,21 @@ void KCMWeather::load()
TQString loc = config.readEntry( "report_location" );
mWidget->m_logFile->setURL( config.readPathEntry( "log_file_name" ) );
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 ) );
mWidget->m_iconTheme->setButton( config.readBoolEntry("use_icon_theme", true) ? 0 : 1 );
emit changed( false );
}
void KCMWeather::save()
void KCMWeatherApplet::save()
{
kdDebug() << "Save" << endl;
TDEConfig config( "weather_panelappletrc" );
config.setGroup( "General Options" );
config.writeEntry( "logging", mWidget->m_enableLog->isChecked() );
config.writeEntry( "log_file_name", mWidget->m_logFile->url() );
config.writeEntry( "textColor", mWidget->m_textColor->color() );
// Station idx to local idx; if nothing selected yet, keep it empty
@ -208,23 +187,17 @@ void KCMWeather::save()
config.writeEntry( "smallview_mode", mViewMode );
config.writeEntry( "use_icon_theme", mWidget->m_iconTheme->selectedId() == 0 );
config.sync();
emit changed( false );
}
void KCMWeather::defaults()
void KCMWeatherApplet::defaults()
{
mWidget->m_enableLog->setChecked( false );
enableLogWidgets( false );
mWidget->m_logFile->setURL( "" );
mWidget->m_reportLocation->setCurrentText( "" );
changeViewMode( dockwidget::ShowAll );
emit changed( true );
}
#include "kcmweather.moc"
#include "kcmweatherapplet.moc"

@ -1,15 +1,15 @@
[Desktop Entry]
Icon=configure
Icon=kicker
Type=Service
X-TDE-ServiceTypes=TDECModule
X-TDE-ModuleType=Library
X-TDE-Library=weather
X-TDE-FactoryName=weather
X-TDE-Library=weatherapplet
X-TDE-FactoryName=weatherapplet
X-TDE-ParentApp=weather_panelapplet
X-TDE-ParentComponents=weather_panelapplet
Name=Display
Comment=Display Setup
Keywords=kweather; weather; configure; settings; display;
Name=Applet
Comment=Applet Config
Keywords=kweather; weather; configure; settings; display; applet;
X-DocPath=kweather?anchor=configuring-kweather

@ -20,21 +20,20 @@
without including the source code for TQt in the source distribution.
*/
#ifndef KCMWEATHER_H
#define KCMWEATHER_H
#ifndef KCMWEATHERAPPLET_H
#define KCMWEATHERAPPLET_H
#include <tdecmodule.h>
class prefsDialogData;
class appletConfig;
class KCMWeather : public TDECModule
class KCMWeatherApplet : public TDECModule
{
Q_OBJECT
public:
KCMWeather( TQWidget *parent = 0, const char *name = 0 );
~KCMWeather();
KCMWeatherApplet( TQWidget *parent = 0, const char *name = 0 );
~KCMWeatherApplet();
virtual void load();
virtual void save();
@ -45,13 +44,12 @@ class KCMWeather : public TDECModule
virtual void showEvent( TQShowEvent * );
private slots:
void enableLogWidgets( bool value );
void changeViewMode( int mode );
void reportLocationChanged();
void textColorChanged(const TQColor &);
private:
prefsDialogData *mWidget;
appletConfig *mWidget;
WeatherService_stub *mWeatherService;
int mViewMode;
};

@ -21,19 +21,30 @@
without including the source code for TQt in the source distribution.
*/
#include <tqbuttongroup.h>
#include <tqcheckbox.h>
#include <tqlabel.h>
#include <tqlayout.h>
#include <tdeaboutdata.h>
#include <tdeapplication.h>
#include <tdeconfig.h>
#include <kdebug.h>
#include <tdelocale.h>
#include <kurlrequester.h>
#include <kcombobox.h>
#include <kcolorbutton.h>
#include "serviceconfigwidget.h"
#include "dockwidget.h"
#include "serviceconfig.h"
#include "kcmweatherservice.h"
#include "weatherservice_stub.h"
extern "C"
{
KDE_EXPORT TDECModule *create_weatherservice( TQWidget *parent, const char * ) {
KDE_EXPORT TDECModule *create_weatherservice( TQWidget *parent, const char * )
{
return new KCMWeatherService( parent, "kweather" );
}
}
@ -41,14 +52,22 @@ extern "C"
KCMWeatherService::KCMWeatherService( TQWidget *parent, const char *name )
: TDECModule( parent, name )
{
mWeatherService = new WeatherService_stub( "KWeatherService",
"WeatherService" );
TQVBoxLayout *layout = new TQVBoxLayout( this );
mWidget = new ServiceConfigWidget( this );
// not needed, as a change immediately changes the service
//connect(mWidget, TQT_SIGNAL(changed(bool)), this, TQT_SIGNAL(changed(bool)));
mWidget = new serviceConfig( this );
layout->addWidget( mWidget );
TDEAboutData *about = new TDEAboutData( "kcmweatherservice",
layout->addStretch();
load();
connect( mWidget->m_enableLog, TQT_SIGNAL( toggled( bool ) ),
TQT_SLOT( enableLogWidgets( bool ) ) );
connect( mWidget->m_iconTheme, TQT_SIGNAL( released( int ) ),
TQT_SLOT( changed() ) );
TDEAboutData *about = new TDEAboutData(
I18N_NOOP( "kcmweatherservice" ),
I18N_NOOP( "KWeather Configure Dialog" ),
0, 0, TDEAboutData::License_GPL,
I18N_NOOP( "(c), 2003 Tobias Koenig" ) );
@ -57,16 +76,61 @@ KCMWeatherService::KCMWeatherService( TQWidget *parent, const char *name )
setAboutData(about);
}
KCMWeatherService::~KCMWeatherService()
{
delete mWeatherService;
}
void KCMWeatherService::enableLogWidgets( bool value )
{
mWidget->m_logFile->setEnabled( value );
mWidget->m_labelLogFile->setEnabled( value );
emit changed( true );
}
void KCMWeatherService::load()
{
kdDebug() << "Load" << endl;
TDEConfig config( "weather_panelappletrc" );
config.setGroup( "General Options" );
bool enabled = config.readBoolEntry( "logging", false );
mWidget->m_enableLog->setChecked( enabled );
enableLogWidgets( enabled );
mWidget->m_logFile->setURL( config.readPathEntry( "log_file_name" ) );
mWidget->m_iconTheme->setButton( config.readBoolEntry("use_icon_theme", true) ? 0 : 1 );
emit changed( false );
}
void KCMWeatherService::save()
{
kdDebug() << "Save" << endl;
TDEConfig config( "weather_panelappletrc" );
config.setGroup( "General Options" );
config.writeEntry( "logging", mWidget->m_enableLog->isChecked() );
config.writeEntry( "log_file_name", mWidget->m_logFile->url() );
config.writeEntry( "use_icon_theme", mWidget->m_iconTheme->selectedId() == 0 );
config.sync();
emit changed( false );
}
void KCMWeatherService::defaults()
{
mWidget->m_enableLog->setChecked( false );
enableLogWidgets( false );
mWidget->m_logFile->setURL( "" );
mWidget->m_iconTheme->setButton(0);
emit changed( true );
}
#include "kcmweatherservice.moc"

@ -1,5 +1,5 @@
[Desktop Entry]
Icon=kweather
Icon=gear
Type=Service
X-TDE-ServiceTypes=TDECModule
@ -10,7 +10,7 @@ X-TDE-ParentApp=weather_panelapplet
X-TDE-ParentComponents=weather_panelapplet,kontact_weatherplugin
X-TDE-CfgDlgHierarchy=KontactSummary
Name=Weather Service
Comment=Weather Service Setup
Keywords=kweather; weather service; configure; settings;
X-DocPath=kweather?anchor=weather-service
Name=Service
Comment=Weather Service Config
Keywords=kweather; weather service; configure; settings; service;
X-DocPath=kweather?anchor=configuring-kweather

@ -15,7 +15,6 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
As a special exception, permission is given to link this program
with any edition of TQt, and distribute the resulting executable,
without including the source code for TQt in the source distribution.
@ -26,22 +25,27 @@
#include <tdecmodule.h>
class ServiceConfigWidget;
class serviceConfig;
class KCMWeatherService : public TDECModule
{
Q_OBJECT
public:
KCMWeatherService( TQWidget *parent = 0, const char *name = 0 );
~KCMWeatherService();
virtual void load();
virtual void save();
virtual void defaults();
private slots:
void enableLogWidgets( bool value );
private:
ServiceConfigWidget *mWidget;
serviceConfig *mWidget;
WeatherService_stub *mWeatherService;
int mViewMode;
};
#endif

@ -0,0 +1,72 @@
/*
This file is part of KWeather.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
As a special exception, permission is given to link this program
with any edition of TQt, and distribute the resulting executable,
without including the source code for TQt in the source distribution.
*/
#include <tqlayout.h>
#include <tdeaboutdata.h>
#include <kdebug.h>
#include <tdelocale.h>
#include "stationsconfigwidget.h"
#include "kcmweatherstations.h"
extern "C"
{
KDE_EXPORT TDECModule *create_weatherstations( TQWidget *parent, const char * ) {
return new KCMWeatherStations( parent, "kweather" );
}
}
KCMWeatherStations::KCMWeatherStations( TQWidget *parent, const char *name )
: TDECModule( parent, name )
{
TQVBoxLayout *layout = new TQVBoxLayout( this );
mWidget = new StationsConfigWidget( this );
// not needed, as a change immediately changes the service
//connect(mWidget, TQT_SIGNAL(changed(bool)), this, TQT_SIGNAL(changed(bool)));
layout->addWidget( mWidget );
TDEAboutData *about = new TDEAboutData( "kcmweatherstations",
I18N_NOOP( "KWeather Configure Dialog" ),
0, 0, TDEAboutData::License_GPL,
I18N_NOOP( "(c), 2003 Tobias Koenig" ) );
about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" );
setAboutData(about);
}
void KCMWeatherStations::load()
{
}
void KCMWeatherStations::save()
{
}
void KCMWeatherStations::defaults()
{
}
#include "kcmweatherstations.moc"

@ -0,0 +1,16 @@
[Desktop Entry]
Icon=kweather
Type=Service
X-TDE-ServiceTypes=TDECModule
X-TDE-ModuleType=Library
X-TDE-Library=weatherstations
X-TDE-FactoryName=weatherstations
X-TDE-ParentApp=weather_panelapplet
X-TDE-ParentComponents=weather_panelapplet,kontact_weatherplugin
X-TDE-CfgDlgHierarchy=KontactSummary
Name=Stations
Comment=Weather Stations Config
Keywords=kweather; weather service; configure; settings; stations;
X-DocPath=kweather?anchor=weather-service

@ -0,0 +1,47 @@
/*
This file is part of KWeather.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
As a special exception, permission is given to link this program
with any edition of TQt, and distribute the resulting executable,
without including the source code for TQt in the source distribution.
*/
#ifndef KCMWEATHERSTATIONS_H
#define KCMWEATHERSTATIONS_H
#include <tdecmodule.h>
class StationsConfigWidget;
class KCMWeatherStations : public TDECModule
{
Q_OBJECT
public:
KCMWeatherStations( TQWidget *parent = 0, const char *name = 0 );
virtual void load();
virtual void save();
virtual void defaults();
private:
StationsConfigWidget *mWidget;
};
#endif

@ -161,7 +161,8 @@ void kweather::preferences()
settingsDialog = new KCMultiDialog( this );
connect( settingsDialog, TQT_SIGNAL( configCommitted() ), TQT_SLOT( slotPrefsAccepted() ) );
settingsDialog->addModule( "kcmweather.desktop" );
settingsDialog->addModule( "kcmweatherapplet.desktop" );
settingsDialog->addModule( "kcmweatherstations.desktop" );
settingsDialog->addModule( "kcmweatherservice.desktop" );
}

@ -0,0 +1,198 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>serviceConfig</class>
<author>ian reinhart geiser &lt;geiseri@kde.org&gt;</author>
<widget class="TQWidget">
<property name="name">
<cstring>serviceConfig</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>491</width>
<height>194</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>3</hsizetype>
<vsizetype>3</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="caption">
<string>serviceConfig</string>
</property>
<property name="focusPolicy">
<enum>TabFocus</enum>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQButtonGroup">
<property name="name">
<cstring>m_iconTheme</cstring>
</property>
<property name="title">
<string>Weather Icons</string>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQRadioButton">
<property name="name">
<cstring>m_systemIcons</cstring>
</property>
<property name="text">
<string>&amp;Use system theme</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="TQRadioButton">
<property name="name">
<cstring>m_kweatherIcons</cstring>
</property>
<property name="text">
<string>Use classic &amp;KWeather theme</string>
</property>
</widget>
</vbox>
</widget>
<widget class="TQGroupBox">
<property name="name">
<cstring>GroupBox1</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Logging Options</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQCheckBox" row="0" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>m_enableLog</cstring>
</property>
<property name="text">
<string>E&amp;nable logging</string>
</property>
</widget>
<spacer row="0" column="2">
<property name="name">
<cstring>Spacer6_2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>294</width>
<height>16</height>
</size>
</property>
</spacer>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>m_labelLogFile</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Log f&amp;ile:</string>
</property>
<property name="buddy" stdset="0">
<cstring>m_logFile</cstring>
</property>
</widget>
<widget class="KURLRequester" row="1" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>m_logFile</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>252</width>
<height>0</height>
</size>
</property>
<property name="toolTip" stdset="0">
<string>Enter the logfile name.</string>
</property>
<property name="whatsThis" stdset="0">
<string>Enter the full path and filename to enable logging in KWeather.</string>
</property>
</widget>
</grid>
</widget>
<spacer>
<property name="name">
<cstring>spacer4</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>111</height>
</size>
</property>
</spacer>
</vbox>
</widget>
<connections>
<connection>
<sender>m_enableLog</sender>
<signal>toggled(bool)</signal>
<receiver>m_labelLogFile</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>m_enableLog</sender>
<signal>toggled(bool)</signal>
<receiver>m_logFile</receiver>
<slot>setEnabled(bool)</slot>
</connection>
</connections>
<includes>
<include location="global" impldecl="in implementation">kcolorbutton.h</include>
<include location="global" impldecl="in implementation">kcombobox.h</include>
<include location="global" impldecl="in implementation">kdialog.h</include>
<include location="global" impldecl="in implementation">kurlrequester.h</include>
<include location="global" impldecl="in implementation">kpushbutton.h</include>
<include location="global" impldecl="in implementation">klineedit.h</include>
</includes>
<layoutdefaults spacing="3" margin="6"/>
<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
</UI>

@ -85,6 +85,7 @@ void sidebarwidget::slotConfigure()
settingsDialog = new KCMultiDialog(0);
connect( settingsDialog, TQT_SIGNAL( configCommitted() ), this, TQT_SLOT( slotRefresh() ) );
settingsDialog->addModule( "kcmweatherstations.desktop" );
settingsDialog->addModule( "kcmweatherservice.desktop" );
}

@ -1,9 +1,9 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>wsPrefs</class>
<class>stationsConfig</class>
<author>Ian Reinhart Geiser &lt;geiseri@kde.org&gt;</author>
<widget class="TQWidget">
<property name="name">
<cstring>wsPrefs</cstring>
<cstring>stationsConfig</cstring>
</property>
<property name="geometry">
<rect>
@ -201,31 +201,31 @@
<connection>
<sender>mAddButton</sender>
<signal>clicked()</signal>
<receiver>wsPrefs</receiver>
<receiver>stationsConfig</receiver>
<slot>addStation()</slot>
</connection>
<connection>
<sender>mRemoveButton</sender>
<signal>clicked()</signal>
<receiver>wsPrefs</receiver>
<receiver>stationsConfig</receiver>
<slot>removeStation()</slot>
</connection>
<connection>
<sender>mUpdate</sender>
<signal>clicked()</signal>
<receiver>wsPrefs</receiver>
<receiver>stationsConfig</receiver>
<slot>updateStations()</slot>
</connection>
<connection>
<sender>mExit</sender>
<signal>clicked()</signal>
<receiver>wsPrefs</receiver>
<receiver>stationsConfig</receiver>
<slot>exitWeatherService()</slot>
</connection>
<connection>
<sender>mSelectedStations</sender>
<signal>selectionChanged(TQListViewItem*)</signal>
<receiver>wsPrefs</receiver>
<receiver>stationsConfig</receiver>
<slot>selectionChanged(TQListViewItem*)</slot>
</connection>
</connections>

@ -31,7 +31,7 @@
#include <kpushbutton.h>
#include <kstandarddirs.h>
#include "serviceconfigwidget.h"
#include "stationsconfigwidget.h"
#include "weatherservice_stub.h"
class StationItem : public TQListViewItem
@ -55,8 +55,8 @@ class StationItem : public TQListViewItem
static void parseStationEntry( const TQString &line, TQString &name, TQString &uid );
ServiceConfigWidget::ServiceConfigWidget( TQWidget *parent, const char *name )
: wsPrefs( parent, name ), mService(0)
StationsConfigWidget::StationsConfigWidget( TQWidget *parent, const char *name )
: stationsConfig( parent, name ), mService(0)
{
mService = new WeatherService_stub( "KWeatherService", "WeatherService" );
connect( mAllStations, TQT_SIGNAL( doubleClicked ( TQListViewItem *, const TQPoint &, int ) ), TQT_SLOT( addStation() ) );
@ -67,12 +67,12 @@ ServiceConfigWidget::ServiceConfigWidget( TQWidget *parent, const char *name )
scanStations();
}
ServiceConfigWidget::~ServiceConfigWidget()
StationsConfigWidget::~StationsConfigWidget()
{
delete mService;
}
void ServiceConfigWidget::addStation()
void StationsConfigWidget::addStation()
{
if ( !dcopActive() )
return;
@ -87,7 +87,7 @@ void ServiceConfigWidget::addStation()
modified();
}
void ServiceConfigWidget::removeStation()
void StationsConfigWidget::removeStation()
{
if ( !dcopActive() )
return;
@ -102,7 +102,7 @@ void ServiceConfigWidget::removeStation()
modified();
}
void ServiceConfigWidget::updateStations()
void StationsConfigWidget::updateStations()
{
if ( !dcopActive() )
return;
@ -111,7 +111,7 @@ void ServiceConfigWidget::updateStations()
scanStations();
}
void ServiceConfigWidget::exitWeatherService()
void StationsConfigWidget::exitWeatherService()
{
if ( !dcopActive() )
return;
@ -120,7 +120,7 @@ void ServiceConfigWidget::exitWeatherService()
modified();
}
void ServiceConfigWidget::scanStations()
void StationsConfigWidget::scanStations()
{
if ( !dcopActive() )
return;
@ -145,23 +145,23 @@ void ServiceConfigWidget::scanStations()
}
}
void ServiceConfigWidget::selectionChanged( TQListViewItem *item )
void StationsConfigWidget::selectionChanged( TQListViewItem *item )
{
mRemoveButton->setEnabled( item != 0 );
}
void ServiceConfigWidget::modified()
void StationsConfigWidget::modified()
{
emit changed( true );
}
void ServiceConfigWidget::initGUI()
void StationsConfigWidget::initGUI()
{
mAllStations->header()->hide();
mSelectedStations->header()->hide();
}
void ServiceConfigWidget::loadLocations()
void StationsConfigWidget::loadLocations()
{
TDEConfig config( locate( "data", "kweatherservice/weather_stations.desktop" ) );
@ -201,7 +201,7 @@ void ServiceConfigWidget::loadLocations()
}
}
bool ServiceConfigWidget::dcopActive()
bool StationsConfigWidget::dcopActive()
{
TQString error;
TQCString appID;
@ -236,4 +236,4 @@ void parseStationEntry( const TQString &line, TQString &name, TQString &uid )
}
}
#include "serviceconfigwidget.moc"
#include "stationsconfigwidget.moc"

@ -17,22 +17,22 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SERVICECONFIGWIDGET_H
#define SERVICECONFIGWIDGET_H
#ifndef STATIONSCONFIGWIDGET_H
#define STATIONSCONFIGWIDGET_H
#include <serviceconfigdata.h>
#include <stationsconfig.h>
class TQListViewItem;
class WeatherService_stub;
class ServiceConfigWidget : public wsPrefs
class StationsConfigWidget : public stationsConfig
{
Q_OBJECT
public:
ServiceConfigWidget( TQWidget *parent, const char *name = 0 );
virtual ~ServiceConfigWidget();
StationsConfigWidget( TQWidget *parent, const char *name = 0 );
virtual ~StationsConfigWidget();
signals:
void changed( bool );
Loading…
Cancel
Save