[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: [patch] shows weather report...sent wrong file
From: Martin =?iso-8859-15?q?K=F6bele?= <martin () mkoebele ! de>
Date: 2004-03-16 13:38:40
Message-ID: 200403161438.40463.martin () mkoebele ! de
[Download RAW message or body]
I apologize. one file was wrong.
here again both files, to keep it complete.
Martin
["kdetoys_kweather_dcop_report.patch" (text/x-diff)]
? Doxyfile
? kdetoys_kweather_dcop_report.patch
? kweather.kdevelop
? kweather.kdevelop.pcs
? kweather.kdevses
? kweathersummaryplugin.kdevelop
? kweathersummaryplugin.kdevelop.pcs
? kweathersummaryplugin.kdevses
? weather_toys.diff
Index: Makefile.am
===================================================================
RCS file: /home/kde/kdetoys/kweather/Makefile.am,v
retrieving revision 1.36
diff -u -p -r1.36 Makefile.am
--- Makefile.am 16 Feb 2004 01:20:28 -0000 1.36
+++ Makefile.am 15 Mar 2004 22:24:15 -0000
@@ -41,8 +41,8 @@ kcm_weatherservice_la_LIBADD = $(LIB_KDE
#globaladd_DATA = weatherbar_add.desktop
kweatherservice_LDFLAGS = $(all_libraries) $(KDE_RPATH)
-kweatherservice_LDADD = $(LIB_KIO)
-kweatherservice_SOURCES = main.cpp weatherlib.cpp weatherservice.cpp \
weatherservice.skel stationdatabase.cpp sun.cpp weatherservice.stub \
+kweatherservice_LDADD = $(LIB_KIO) $(LIB_KHTML) +kweatherservice_SOURCES = main.cpp \
weatherlib.cpp weatherservice.cpp weatherservice.skel stationdatabase.cpp sun.cpp \
weatherservice.stub reportview.cpp
service_DATA = kweatherservice.desktop
servicedir = $(kde_servicesdir)
Index: reportview.cpp
===================================================================
RCS file: /home/kde/kdetoys/kweather/reportview.cpp,v
retrieving revision 1.43
diff -u -p -r1.43 reportview.cpp
--- reportview.cpp 14 Mar 2004 03:41:25 -0000 1.43
+++ reportview.cpp 15 Mar 2004 22:24:15 -0000
@@ -28,7 +28,7 @@
#include "reportview.h"
#include "weatherservice_stub.h"
-reportView::reportView(QString reportLocation)
+reportView::reportView(const QString reportLocation)
: KDialogBase( (QWidget *)0, "report", false, QString::null, Close ) {
m_locationCode = reportLocation;
QVBox *vbox = makeVBoxMainWidget();
Index: reportview.h
===================================================================
RCS file: /home/kde/kdetoys/kweather/reportview.h,v
retrieving revision 1.16
diff -u -p -r1.16 reportview.h
--- reportview.h 14 Mar 2004 03:41:25 -0000 1.16
+++ reportview.h 15 Mar 2004 22:24:15 -0000
@@ -33,7 +33,7 @@ class reportView : public KDialogBase {
Q_OBJECT
public:
- reportView(QString reportLocation);
+ reportView(const QString reportLocation);
~reportView();
void render();
Index: weatherservice.cpp
===================================================================
RCS file: /home/kde/kdetoys/kweather/weatherservice.cpp,v
retrieving revision 1.34
diff -u -p -r1.34 weatherservice.cpp
--- weatherservice.cpp 13 Mar 2004 19:36:02 -0000 1.34
+++ weatherservice.cpp 15 Mar 2004 22:24:15 -0000
@@ -10,8 +10,9 @@
#include "weatherservice.h"
#include "stationdatabase.h"
#include "sun.h"
+#include "reportview.h"
-WeatherService::WeatherService(QObject *parent, const char *name) : QObject (parent, \
name), DCOPObject("WeatherService") +WeatherService::WeatherService(QObject *parent, \
const char *name) : QObject (parent, name), DCOPObject("WeatherService"), \
m_reportView( 0 ) {
kdDebug(12006) << "Starting new service... " << endl;
@@ -305,6 +306,21 @@ QString WeatherService::civilTwilightEnd
return getTime(stationID, CIVIL_END);
}
+void WeatherService::showReport(const QString &stationID)
+{
+ if (m_reportView == 0 )
+ {
+ m_reportView= new reportView(stationID);
+ connect( m_reportView, SIGNAL( finished() ), SLOT( slotReportFinished() ) );
+ }
+ m_reportView->show();
+ m_reportView->raise();
+}
+void WeatherService::slotReportFinished()
+{
+ m_reportView->delayedDestruct();
+ m_reportView = 0;
+}
#include "weatherservice.moc"
Index: weatherservice.h
===================================================================
RCS file: /home/kde/kdetoys/kweather/weatherservice.h,v
retrieving revision 1.25
diff -u -p -r1.25 weatherservice.h
--- weatherservice.h 13 Mar 2004 19:36:02 -0000 1.25
+++ weatherservice.h 15 Mar 2004 22:24:15 -0000
@@ -6,8 +6,11 @@
#include <dcopobject.h>
#include <qpixmap.h>
+
+
class WeatherLib;
class StationDatabase;
+class reportView;
class WeatherService : public QObject, public DCOPObject
{
@@ -21,6 +24,7 @@ class WeatherService : public QObject, p
void updated(const QString &stationID);
void updating(const QString &stationID);
void slotStationRemoved(const QString &stationID);
+ void slotReportFinished();
public:
WeatherService(QObject *parent, const char *name);
@@ -67,6 +71,7 @@ class WeatherService : public QObject, p
void addStation(const QString &stationID);
QStringList listStations();
void exit();
+ void showReport(const QString &stationID);
private:
enum TimeType
@@ -80,5 +85,7 @@ class WeatherService : public QObject, p
void saveSettings();
QString getTime(const QString &stationID, TimeType timeType);
StationDatabase *stationDB;
+
+ reportView* m_reportView;
};
#endif
["kontact_plugin_weather_report.patch" (text/x-diff)]
? Doxyfile
? kontact_plugin_weather_report.patch
? kweathersummaryplugin.kdevelop
? weather.diff
Index: summarywidget.cpp
===================================================================
RCS file: /home/kde/kdepim/kontact/plugins/weather/summarywidget.cpp,v
retrieving revision 1.19
diff -u -p -r1.19 summarywidget.cpp
--- summarywidget.cpp 13 Mar 2004 15:02:56 -0000 1.19
+++ summarywidget.cpp 15 Mar 2004 22:25:30 -0000
@@ -25,6 +25,7 @@
#include <qlabel.h>
#include <qlayout.h>
#include <qtooltip.h>
+#include <qpushbutton.h>
#include <dcopclient.h>
#include <dcopref.h>
@@ -34,6 +35,7 @@
#include <kglobalsettings.h>
#include <kiconloader.h>
#include <klocale.h>
+#include <kurllabel.h>
#include "summarywidget.h"
@@ -109,14 +111,19 @@ void SummaryWidget::updateView()
mLayout->addStretch( 10 );
mLayouts.append( layout );
- QLabel *label = new QLabel( this );
- label->setPixmap( img.smoothScale( 32, 32 ) );
- label->setMaximumSize(label->sizeHint());
- label->setAlignment(/* AlignRight |*/ AlignTop );
- layout->addMultiCellWidget( label, 0, 1, 0, 0 );
- mLabels.append( label );
-
- label = new QLabel( this );
+ KURLLabel* urlLabel = new KURLLabel(this);
+ urlLabel->installEventFilter(this);
+ urlLabel->setURL((*it).stationID());
+ urlLabel->setPixmap( img.smoothScale( 32, 32 ) );
+ urlLabel->setMaximumSize(urlLabel->sizeHint());
+ urlLabel->setAlignment(/* AlignRight |*/ AlignTop );
+ layout->addMultiCellWidget( urlLabel, 0, 1, 0, 0 );
+ mLabels.append( urlLabel );
+
+ connect (urlLabel, SIGNAL(leftClickedURL( const QString&) ),
+ this, SLOT(slotShowReport(const QString& )));
+
+ QLabel* label = new QLabel( this );
label->setText( QString( "%1 (%2)" ).arg( (*it).name() ).arg( \
(*it).temperature() ) ); QFont font = label->font();
font.setBold( true );
@@ -167,6 +174,7 @@ void SummaryWidget::refresh( QString sta
mWeatherMap[ station ].setTemperature( dcopCall.call( "temperature(QString)", \
station, true ) ); mWeatherMap[ station ].setWindSpeed( dcopCall.call( \
"wind(QString)", station, true ) ); mWeatherMap[ station ].setRelativeHumidity( \
dcopCall.call( "relativeHumidity(QString)", station, true ) ); + mWeatherMap[ \
station ].setStationID(station);
updateView();
}
@@ -182,4 +190,10 @@ QStringList SummaryWidget::configModules
return QStringList( "kcmweatherservice.desktop" );
}
+void SummaryWidget::slotShowReport(const QString &stationID)
+{
+ DCOPRef dcopCall( "KWeatherService", "WeatherService" );
+ DCOPReply reply = dcopCall.call( "showReport(QString)", stationID, true );
+}
+
#include "summarywidget.moc"
Index: summarywidget.h
===================================================================
RCS file: /home/kde/kdepim/kontact/plugins/weather/summarywidget.h,v
retrieving revision 1.10
diff -u -p -r1.10 summarywidget.h
--- summarywidget.h 22 Jan 2004 22:16:36 -0000 1.10
+++ summarywidget.h 15 Mar 2004 22:25:30 -0000
@@ -60,6 +60,9 @@ class WeatherData
void setRelativeHumidity( const QString &relativeHumidity ) { mRelativeHumidity \
= relativeHumidity; } QString relativeHumidity() const { return mRelativeHumidity; }
+ void setStationID(const QString &station) { mStationID = station;}
+ QString stationID() { return mStationID; }
+
bool operator< ( const WeatherData &data )
{
return ( QString::localeAwareCompare( mName, data.mName ) < 0 );
@@ -72,6 +75,7 @@ class WeatherData
QString mTemperature;
QString mWindSpeed;
QString mRelativeHumidity;
+ QString mStationID;
};
class SummaryWidget : public Kontact::Summary, public DCOPObject
@@ -90,6 +94,7 @@ class SummaryWidget : public Kontact::Su
private slots:
void updateView();
void timeout();
+ void slotShowReport(const QString&);
private:
QStringList mStations;
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic