コード例 #1
0
void SummaryWidget::timeout()
{
  mTimer.stop();

  DCOPRef dcopCall( "KWeatherService", "WeatherService" );
  dcopCall.send( "updateAll()" );

  mTimer.start( 15 * 60000 );
}
コード例 #2
0
ファイル: weatherbar.cpp プロジェクト: Fat-Zer/tdetoys
void KonqSidebarWeather::refresh(TQString stationID)
{
	kdDebug() << "refresh " << stationID << endl;
	if(m_widgets.find(stationID))
	{
		DCOPRef dcopCall( "KWeatherService", "WeatherService" );
		m_widgets[stationID]->setWeatherIcon(dcopCall.call("currentIcon(TQString)", stationID ,true ));
		m_widgets[stationID]->setTemperature(dcopCall.call("temperature(TQString)", stationID,true ));
		m_widgets[stationID]->setPressure(dcopCall.call("pressure(TQString)", stationID,true ));
		m_widgets[stationID]->setWind(dcopCall.call("wind(TQString)", stationID,true ));
		m_widgets[stationID]->showWeather();
	}
	else
		update();
}
コード例 #3
0
void SummaryWidget::refresh( QString station )
{
  DCOPRef dcopCall( "KWeatherService", "WeatherService" );

  mWeatherMap[ station ].setIcon( dcopCall.call( "currentIcon(QString)", station, true ) );
  mWeatherMap[ station ].setName( dcopCall.call( "stationName(QString)", station, true ) );
  mWeatherMap[ station ].setCover( dcopCall.call( "cover(QString)", station, true ) );
  mWeatherMap[ station ].setDate( dcopCall.call( "date(QString)", station, true ) );
  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();
}
コード例 #4
0
ファイル: weatherbar.cpp プロジェクト: Fat-Zer/tdetoys
KonqSidebarWeather::KonqSidebarWeather(TDEInstance* inst, TQObject* parent,
                                         TQWidget* widgetParent,
                                         TQString& desktopName, const char* name)

    : KonqSidebarPlugin(inst, parent, widgetParent, desktopName, name),
    DCOPObject(name)
{

	m_container = new sidebarwidget(widgetParent,"sidebarwidget");

	kdDebug() << "Calling Get Widget" << endl;

	kdDebug() << "Get weatherstation list... " << endl;

	if (!connectDCOPSignal(0,0,
		"fileUpdate(TQString)",
		"refresh(TQString)",false))
		kdDebug() << "Could not attach signal..." << endl;
	else
		kdDebug() << "attached dcop signals..." << endl;

	DCOPRef dcopCall( "KWeatherService", "WeatherService" );
	DCOPReply reply = dcopCall.call("listStations()", true );
	if ( reply.isValid() ) {
		TQStringList replyList = reply;
		for(int i = 0; i < replyList.size(); i++)
		{
			dockwidget *d = new dockwidget(m_container->viewport(), replyList[i].latin1());
			m_container->addWidget(d, replyList[i].latin1());
			d->resizeView(80,48);
			d->show();
			m_widgets.insert(replyList[i], d);
			dcopCall.send("update(TQString)", replyList[i]);
		}
	}

	timeOut = new TQTimer(this, "timeOut" );
	timeOut->changeInterval(15*60000);
	connect(timeOut, TQT_SIGNAL(timeout()), this, TQT_SLOT(update()));
   // m_widgets.append(new dockwidget(widgetParent));
}
コード例 #5
0
ファイル: weatherbar.cpp プロジェクト: Fat-Zer/tdetoys
void KonqSidebarWeather::update()
{
	timeOut->stop();
	DCOPRef dcopCall( "KWeatherService", "WeatherService" );
	DCOPReply reply = dcopCall.call("listStations()", true );
	if ( reply.isValid() ) {
		TQStringList replyList = reply;
		for(int i = 0; i < replyList.size(); i++)
		{
			if(!m_widgets.find(replyList[i]))
			{
				dockwidget *d = new dockwidget(m_container->viewport(), replyList[i].latin1());
				m_container->addWidget(d, replyList[i].latin1());
				d->show();
				m_widgets.insert(replyList[i], d);
			}
			dcopCall.send("update(TQString)", replyList[i]);
		}
	}
    	timeOut->start(15*60000);
}
コード例 #6
0
SummaryWidget::SummaryWidget( QWidget *parent, const char *name )
  : Kontact::Summary( parent, name ),
    DCOPObject( "WeatherSummaryWidget" ), mProc( 0 )
{
  mLayout = new QVBoxLayout( this, 3, 3 );
  mLayout->setAlignment( Qt::AlignTop );

  QPixmap icon = KGlobal::iconLoader()->loadIcon( "kweather", KIcon::Desktop, KIcon::SizeMedium );
  QWidget *header = createHeader( this, icon, i18n( "Weather Service" ) );
  mLayout->addWidget( header );

  QString error;
  QCString appID;
  bool serviceAvailable = true;
  if ( !kapp->dcopClient()->isApplicationRegistered( "KWeatherService" ) ) {
    if ( KApplication::startServiceByDesktopName( "kweatherservice", QStringList(), &error, &appID ) ) {
      QLabel *label = new QLabel( i18n( "No weather dcop service available;\nyou need KWeather to use this plugin." ), this );
      mLayout->addWidget( label, Qt::AlignHCenter | AlignVCenter );
      serviceAvailable = false;
    }
  }

  if ( serviceAvailable ) {
    connectDCOPSignal( 0, 0, "fileUpdate(QString)", "refresh(QString)", false );
    connectDCOPSignal( 0, 0, "stationRemoved(QString)", "stationRemoved(QString)", false );

    DCOPRef dcopCall( "KWeatherService", "WeatherService" );
    DCOPReply reply = dcopCall.call( "listStations()", true );
    if ( reply.isValid() ) {
      mStations = reply;

      connect( &mTimer, SIGNAL( timeout() ), this, SLOT( timeout() ) );
      mTimer.start( 0 );
    } else {
      kdDebug(5602) << "ERROR: dcop reply not valid..." << endl;
    }
  }
}