plasma-simpleweatherforecast-1.3-kde-4.3.80/0000700000036100001450000000000011312706027020354 5ustar karthiklibuuidplasma-simpleweatherforecast-1.3-kde-4.3.80/plasma-simpleweatherforecast.h0000600000036100001450000000713011143143230026374 0ustar karthiklibuuid/*************************************************************************** * By Karthik Paithankar * * A lot of code was used from weatherplasmoid. Thanks to * * Vinnie Futia * * * Credits to Vinnie Futia * * 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 3 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 . * ***************************************************************************/ // Here we avoid loading the header multiple times #ifndef Plasma_Weather_HEADER #define Plasma_Weather_HEADER // We need the Plasma Applet headers #include #include #include #include //#include #include "ui_config.h" #include "config.h" class QSizeF; class QTimer; class Plasma_Weather : public Plasma::Applet { Q_OBJECT public: // Basic Create/Destroy Plasma_Weather(QObject *parent, const QVariantList &args); ~Plasma_Weather(); // The paintInterface procedure paints the applet to screen void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option, const QRect& contentsRect); void init(); QSizeF contentSizeHint() const; Qt::Orientations expandingDirections() const; public slots: void refresh(); void configAccepted(); void configRejected(); protected: void createConfigurationInterface(KConfigDialog *parent); private: // void paintImage(QPainter *p, const QRect &contentsRect); void collectData(); void readConfigData(); void parseData(); QString region; QString country; QString city; QString tempType; QString chill; QString temperature; QString tomorrow_day; QString tomorrow_code; QString d_a_t; QString d_a_t_low; QString d_a_t_high; QString d_a_t_condition; QString d_a_t_code; QString attribution_text; QString temperature_tomorrow_low; QString temperature_tomorrow_high; QString temperature_tomorrow_condition; QString condition; QString humidity; QString iconTheme; QString zip; QString today_code; QString updateFrequency; QTimer* timer; QFont font; // QFont titleFont; // QFont tempFont; ConfigDialog* conf; }; // This is the command that links your applet to the .desktop file K_EXPORT_PLASMA_APPLET(simpleweatherforecast, Plasma_Weather) #endif plasma-simpleweatherforecast-1.3-kde-4.3.80/README0000600000036100001450000000416611143151131021235 0ustar karthiklibuuid Plasmoid Weather Widget *********************************************** This KDE4 plasmoid displays weather data for a specified zip code. This widget used the Yahoo! Weather API to collect data so credit is due there. This Software is published under the terms of the GNU GPL V3 and comes without any warranty. Feel free to change or distribute this software. New icon set for the Weather Widget created by painkiller101. Thanks so much for the great work!! :-) (old) and Short installation instruction: # tar -jxvf plasma-weatherforecast-0.5.tar.bz2 # cd plasma-weatherforecast-0.5 # mkdir build # cd build # cmake --release -DCMAKE_INSTALL_PREFIX=`kde-config --prefix` ../ # make # sudo make install If you have any dependency problems see sudo apt-get build-dep kdeplasma-addons http://www.kde-look.org/content/show.php/weatherforecast?content=92149 DELETE or UNINSTALL THIS PLASMOID: The plasmoid installs 3 files only; just delete them. /usr/lib/kde4/plasma_applet_simpleweatherforecast.so /usr/share/kde4/services/plasma-applet-simpleweatherforecast.desktop /usr/share/kde4/apps/desktoptheme/default/widgets/plasma-simpleweatherforecast.svg (my prefix is $> kde4-config --prefix or kde-config --prefix /usr ). Look for your prefix and then delete these files ATTENTION INTERNATIONAL USERS: *********************************************** If you want to make this plasmoid work and don't have a zip code, use the following steps: 1. Go to http://weather.yahoo.com/ 2. Type in your city, country and click Go 3. Copy the 8 character location ID from the URL on the next page (ie for Hong Kong, China it is CHXX0049) 4. Paste the location ID into the widgets zip code field Creating Icon Themes *********************************************** In order to create and icon theme, you must create an SVG icon for every weather condition in the conditionscodes.txt file included in this package. The object name for the icon must correspond to the condition code in the conditionscodes.txt file. Changelog *********************************************** See webpage http://www.kde-look.org/content/show.php/weatherforecast?content=92149 plasma-simpleweatherforecast-1.3-kde-4.3.80/config.h0000600000036100001450000000331111141162500021762 0ustar karthiklibuuid/*************************************************************************** * * Credits to Vinnie Futia * * * Copyright (C) 2008 by Karthik Paithankar * * * * * 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 3 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 . * ***************************************************************************/ #ifndef config_h #define config_h #include "ui_config.h" class ConfigDialog : public QWidget, public Ui::config { Q_OBJECT public: ConfigDialog(); public slots: void getIconTheme(); void getFont(); public: QFont font; }; #endif plasma-simpleweatherforecast-1.3-kde-4.3.80/CTestTestfile.cmake0000600000036100001450000000070011125666720024106 0ustar karthiklibuuid# CMake generated Testfile for # Source directory: /home/mark/src/kde/trunk/playground/base/plasma/applets/wifi-signal-strength # Build directory: /home/mark/src/kde/trunk/playground/base/plasma/applets/wifi-signal-strength # # This file replicates the SUBDIRS() and ADD_TEST() commands from the source # tree CMakeLists.txt file, skipping any SUBDIRS() or ADD_TEST() commands # that are excluded by CMake control structures, i.e. IF() commands. plasma-simpleweatherforecast-1.3-kde-4.3.80/plasma-simpleweatherforecast.cpp0000600000036100001450000004667711312705603026760 0ustar karthiklibuuid/*************************************************************************** * By Karthik Paithankar * * A lot of code was used from weatherplasmoid. Thanks to * * Vinnie Futia * * Thanks to Yannig, Joe Istead for the help * 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 3 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 . * ***************************************************************************/ #include "plasma-simpleweatherforecast.h" #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include Plasma_Weather::Plasma_Weather( QObject *parent, const QVariantList &args ) : Plasma::Applet(parent, args) { timer = new QTimer(this); // setBackgroundHints(DefaultBackground); // resize(390, 350); resize(195, 195); setHasConfigurationInterface(true); // setAspectRatioMode(Plasma::IgnoreAspectRatio); connect(timer, SIGNAL(timeout()), this, SLOT(refresh())); } Plasma_Weather::~Plasma_Weather() { timer->stop(); delete timer; } void Plasma_Weather::init() { refresh(); } void Plasma_Weather::refresh() { bool error = false; readConfigData(); collectData(); parseData(); update(); timer->stop(); timer->setInterval(updateFrequency.toInt(&error) * 60 * 1000); timer->start(); } void Plasma_Weather::readConfigData() { KConfigGroup cg = config(); iconTheme = cg.readEntry("iconTheme", iconTheme); zip = cg.readEntry("zip", "UKXX0106"); tempType = cg.readEntry("tempType", "C"); updateFrequency = cg.readEntry("updateFrequency", "55"); font.fromString( cg.readEntry("font", QFont(KGlobalSettings::smallestReadableFont()).toString()) ); } void Plasma_Weather::collectData() { // proxy support // proxy support // proxy support // QString proxy_xml_file = "http://weather.yahooapis.com/forecastrss?p=" + zip; // if(tempType == "C") // { // proxy_xml_file.append("&u=c"); // } //The next line clears cache for the file // KIO::http_update_cache(proxy_xml_file, true, 0); // proxy support: for some crazy reason the update does not happen properly ! // so I have enabled both wget and proxy support // FIX ME KIO::file_delete(QDir::homePath() + "/.weather.xml", KIO::HideProgressInfo ); // KIO::file_copy(proxy_xml_file, QDir::homePath() + "/.weather.xml", -1, KIO::Overwrite | KIO::HideProgressInfo); // // Now the normal wget... // Now the normal wget... // Now the normal wget... QProcess* process = new QProcess(this); QString wget_xml_command = "wget -q -t 4 --random-wait -O " + QDir::homePath() + "/.weather.xml http://weather.yahooapis.com/forecastrss?p=" + zip; if(tempType == "C") { wget_xml_command.append("&u=c"); } process->start(wget_xml_command); process->waitForFinished(); delete process; } void Plasma_Weather::parseData() { //get the invidual elements from the XML file QDomDocument doc("weather"); QFile file(QDir::homePath() + "/.weather.xml"); //read the data into the XML parser and close the file doc.setContent(&file); file.close(); QDomElement root = doc.documentElement(); QDomNode n = root.firstChild(); n = root.firstChild(); n = n.firstChild(); while(!n.isNull()) { QDomElement e = n.toElement(); if(!e.isNull()) { if(e.tagName() == "yweather:location") { city = e.attribute("city", ""); region = e.attribute("region", ""); country = e.attribute("country", ""); } else if(e.tagName() == "yweather:wind") { temperature = e.attribute("chill", ""); } else if(e.tagName() == "yweather:atmosphere") { humidity = e.attribute("humidity", ""); } else if(e.tagName() == "item") { n = n.firstChild(); while(!n.isNull()) { QDomElement e = n.toElement(); if(!e.isNull()) { if(e.tagName() == "yweather:condition") { condition = e.attribute("text", ""); today_code = e.attribute("code", ""); temperature = e.attribute("temp",""); // works code = "10"; // no code = "11"; // no code = "12"; // works code = "13"; // all should work as we have changed the icon } if(e.tagName() == "yweather:forecast") { tomorrow_day = e.attribute("day",""); temperature_tomorrow_low = e.attribute("low",""); temperature_tomorrow_high = e.attribute("high",""); temperature_tomorrow_condition = e.attribute("text",""); tomorrow_code = e.attribute("code",""); n = n.nextSibling(); QDomElement e = n.toElement(); if(e.tagName() == "yweather:forecast") { // d_a_t means day after tomorrow d_a_t = e.attribute("day",""); d_a_t_low = e.attribute("low",""); d_a_t_high = e.attribute("high",""); d_a_t_condition = e.attribute("text",""); d_a_t_code = e.attribute("code",""); } } } n = n.nextSibling(); } n = n.parentNode(); } } n = n.nextSibling(); } } void Plasma_Weather::paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, const QRect &contentsRect) { Q_UNUSED( option ); // this one is the main forecast OXF // QRect textRect(contentsRect.left(), contentsRect.top()+(int)contentsRect.height()/12,contentsRect.left() + (int)(contentsRect.width() / 2.0), (int)contentsRect.top() + (int)contentsRect.height()/3); QRect textRect_city_name(contentsRect.left(), contentsRect.top()+(int)contentsRect.height()/27,contentsRect.left() + (int)(contentsRect.width() / 2.0), (int)contentsRect.top() + (int)contentsRect.height()/3); // 8 -> 7.5 QRect textRect_temperature(contentsRect.left(), contentsRect.top()+(int)contentsRect.height()/7,contentsRect.left() + (int)(contentsRect.width() / 2.0), (int)contentsRect.top() + (int)contentsRect.height()/3); // this one is the main forecast _description_ 5-> 4.5 QRect textRect_main_description(contentsRect.left(), contentsRect.top()+(int)contentsRect.height()/4,contentsRect.left() + (int)(contentsRect.width() / 2.0), (int)contentsRect.top() + (int)contentsRect.height()/3); // this is for the image in the right top quadrant QRect imageRect(contentsRect.left()+(int)contentsRect.width() / 1.8, contentsRect.top(), (int)contentsRect.width()/2.5, (int)contentsRect.height()/2.5); // QRect imageRect_tomorrow(contentsRect.left()+(int)contentsRect.width()/12, contentsRect.top()+(int)contentsRect.height()/1.5, (int)contentsRect.width()/2.5, (int)contentsRect.height()/2.5); QRect imageRect_tomorrow(contentsRect.left()+(int)contentsRect.width()/6, contentsRect.top()+(int)contentsRect.height()/1.6, (int)contentsRect.width()/3.5, (int)contentsRect.height()/3.5); QRect imageRect_d_a_t(contentsRect.right() - (int)contentsRect.width() /2.6, contentsRect.top()+(int)contentsRect.height()/1.6, (int)contentsRect.width()/3.5, (int)contentsRect.height()/3.5); // this is for the LOW and HIGH tag // QRect textRect1(contentsRect.left(), (int)contentsRect.bottom()-(int)contentsRect.height()/2, (int)contentsRect.width()/2, (int)contentsRect.height()/2); // WORKS NOW QRect textRect_high_low_tag(contentsRect.left(), (int)contentsRect.top()+(int)contentsRect.height()/2.2, (int)contentsRect.width()/2, (int)contentsRect.height()/2); QRect textRect_low_tag(contentsRect.left(), (int)contentsRect.top()+(int)contentsRect.height()/2.3, (int)contentsRect.width()/2, (int)contentsRect.height()/2); QRect textRect_high_tag(contentsRect.left(), (int)contentsRect.top()+(int)contentsRect.height()/1.9, (int)contentsRect.width()/2, (int)contentsRect.height()/2); // this is for tomorrow forecast // QRect textRect3(contentsRect.left()+(int)contentsRect.width()/24, (int)contentsRect.bottom()-(int)contentsRect.height()*1/3, (int)contentsRect.width()/2, (int)contentsRect.height()/2); QRect textRect_tomorrow_day(contentsRect.left()+(int)contentsRect.width()/24, contentsRect.top()+(int)contentsRect.height()/2.8,contentsRect.left() + (int)(contentsRect.width() / 2.0), (int)contentsRect.top() + (int)contentsRect.height()/3); // WORKS FINE QRect textRect_tomorrow_temp(contentsRect.left()+(int)contentsRect.width()/24, contentsRect.top()+(int)contentsRect.height()/2.2,contentsRect.left() + (int)(contentsRect.width() / 2.0), (int)contentsRect.top() + (int)contentsRect.height()/3); QRect textRect_tomorrow_temp_low(contentsRect.left()+(int)contentsRect.width()/24, contentsRect.top()+(int)contentsRect.height()/2.3,contentsRect.left() + (int)(contentsRect.width() / 2.0), (int)contentsRect.top() + (int)contentsRect.height()/3); QRect textRect_tomorrow_temp_high(contentsRect.left()+(int)contentsRect.width()/24, contentsRect.top()+(int)contentsRect.height()/1.9,contentsRect.left() + (int)(contentsRect.width() / 2.0), (int)contentsRect.top() + (int)contentsRect.height()/3); QRect textRect_tomorrow_condition(contentsRect.left(), contentsRect.top()+(int)contentsRect.height()/1.15,contentsRect.left() + (int)(contentsRect.width() / 2.0), (int)contentsRect.top() + (int)contentsRect.height()/3); // this is for day-after-tomorrow forecast textRect2 QRect textRect_d_a_t_day(contentsRect.right() - (int)(contentsRect.width() /2), contentsRect.top()+(int)contentsRect.height()/2.8, (int)contentsRect.width()/2, (int)contentsRect.height()/2); // WORKS FINE QRect textRect_d_a_t_temp(contentsRect.right() - (int)(contentsRect.width() /2), contentsRect.top()+(int)contentsRect.height()/2.2, (int)contentsRect.width()/2, (int)contentsRect.height()/2); QRect textRect_d_a_t_temp_low(contentsRect.right() - (int)(contentsRect.width() /2), contentsRect.top()+(int)contentsRect.height()/2.3, (int)contentsRect.width()/2, (int)contentsRect.height()/2); QRect textRect_d_a_t_temp_high(contentsRect.right() - (int)(contentsRect.width() /2), contentsRect.top()+(int)contentsRect.height()/1.9, (int)contentsRect.width()/2, (int)contentsRect.height()/2); QRect textRect_d_a_t_condition(contentsRect.right() - (int)contentsRect.width() /2, contentsRect.top()+(int)contentsRect.height()/1.15,contentsRect.left() + (int)(contentsRect.width() / 2.0), (int)contentsRect.top() + (int)contentsRect.height()/3); // attribution text for Yahoo ! QRect textRect_attribution_text(contentsRect.left(), contentsRect.top()+(int)contentsRect.height()/1.05,contentsRect.left() + (int)(contentsRect.width() / 1.0), (int)contentsRect.top() + (int)contentsRect.height()/3); p->setRenderHint(QPainter::SmoothPixmapTransform); p->setRenderHint(QPainter::Antialiasing); // We place the icon and text // int width = (int)contentsRect.width(); // int height = (int)contentsRect.height(); // paintImage(p, imageRect); p->save(); // p->setPen(Qt::white); p->setPen(Qt::NoPen); p->setPen(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor)); p->setFont(font); // titleFont = QFont("FreeSans", height/16, false); // p->setFont(titleFont); // if(region != "") // { // p->drawText(textRect_city_name, // Qt::AlignTop | Qt::AlignHCenter, // city + ", " + region); // } // else // { p->drawText(textRect_city_name, Qt::AlignTop| Qt::AlignHCenter , city); // city + ", " + country); // } // do not display is there is no update // show the image if(today_code != ""){ // p->drawText(textRect, // Qt::AlignVCenter | Qt::AlignHCenter, // temperature + char(176) + tempType); // p->drawText(textRect, Qt::AlignLeft, tr("\n")+ temperature + char(176) + tempType); p->drawText(textRect_temperature, Qt::AlignHCenter|Qt::AlignTop, temperature + char(176) + tempType); // the next line just works TM // p->drawText(textRect_high_low_tag,Qt::AlignLeft|Qt::AlignTop,tr("Low: ")+tr("\nHigh: ")); // WORKS NOW p->drawText(textRect_high_low_tag,Qt::AlignLeft|Qt::AlignTop,i18n("Low: ")+i18n("\nHigh: ")); p->drawText(textRect_low_tag,Qt::AlignLeft|Qt::AlignTop,i18n("Low: ")); p->drawText(textRect_high_tag,Qt::AlignLeft|Qt::AlignTop,i18n("High: ")); p->drawText(textRect_tomorrow_day,Qt::AlignHCenter|Qt::AlignTop,tomorrow_day); p->drawText(textRect_d_a_t_day,Qt::AlignHCenter|Qt::AlignTop,d_a_t); // the code below adds a small space to the temp. if it is single digit to make it // center aligned if(temperature_tomorrow_high>0 && temperature_tomorrow_high.size()==1){ temperature_tomorrow_high=" "+temperature_tomorrow_high; } if(temperature_tomorrow_low>0 && temperature_tomorrow_low.size()==1){ temperature_tomorrow_low=" "+temperature_tomorrow_low; } if(d_a_t_high>0 && d_a_t_high.size()==1){ d_a_t_high=" "+d_a_t_high; } if(d_a_t_low>0 && d_a_t_low.size()==1){ d_a_t_low=" "+d_a_t_low; } // p->drawText(textRect_tomorrow_temp, // Qt::AlignHCenter|Qt::AlignTop,temperature_tomorrow_low+char(176)+ tempType +("\n")+temperature_tomorrow_high+char(176)+ tempType+("\n")); p->drawText(textRect_tomorrow_temp_low, Qt::AlignHCenter|Qt::AlignTop,temperature_tomorrow_low+char(176)+ tempType +("\n")); p->drawText(textRect_tomorrow_temp_high, Qt::AlignHCenter|Qt::AlignTop,temperature_tomorrow_high+char(176)+ tempType +("\n")); // p->drawText(textRect_d_a_t_temp, // Qt::AlignHCenter|Qt::AlignTop,d_a_t_low+char(176)+ tempType +("\n")+d_a_t_high+char(176)+ tempType+("\n")); p->drawText(textRect_d_a_t_temp_low, Qt::AlignHCenter|Qt::AlignTop,d_a_t_low+char(176)+ tempType +("\n")); p->drawText(textRect_d_a_t_temp_high, Qt::AlignHCenter|Qt::AlignTop,d_a_t_high+char(176)+ tempType +("\n")); // titleFont = QFont(KGlobalSettings::smallestReadableFont()); p->setFont(QFont(KGlobalSettings::smallestReadableFont())); p->drawText(textRect_main_description,Qt::AlignHCenter|Qt::AlignTop, i18n("%1",condition)); p->drawText(textRect_d_a_t_condition,Qt::AlignHCenter|Qt::AlignTop,i18n("%1",d_a_t_condition)); p->drawText(textRect_tomorrow_condition,Qt::AlignHCenter|Qt::AlignTop,i18n("%1",temperature_tomorrow_condition)); p->drawText(textRect_attribution_text,Qt::AlignTop| Qt::AlignHCenter,"Data from Yahoo! Weather"); // paintImage(p, imageRect); // paintImage(p2, imageRect_d_a_t); QString svg_file = QString(); if(iconTheme == "") { svg_file = "widgets/plasma-simpleweatherforecast"; } else { svg_file = iconTheme; } Plasma::Svg* svg; svg = new Plasma::Svg(this); svg->setImagePath( svg_file ); svg->setContainsMultipleImages(true); svg->resize(imageRect.width(), imageRect.height()); svg->resize(imageRect_tomorrow.width(), imageRect_tomorrow.height()); svg->resize(imageRect_d_a_t.width(), imageRect_d_a_t.height()); svg->paint(p,imageRect, today_code); svg->paint(p,imageRect_tomorrow, tomorrow_code); svg->paint(p,imageRect_d_a_t, d_a_t_code); } else{ // show busy widget now QString svg_file = QString(); svg_file = "widgets/busywidget"; Plasma::Svg* svg; svg = new Plasma::Svg(this); svg->setImagePath( svg_file ); QRect imageRect(contentsRect.left()+(int)contentsRect.width()/4, contentsRect.top()+(int)contentsRect.height()/4, (int)contentsRect.width()/2, (int)contentsRect.height()/2); svg->resize(imageRect.width(), imageRect.height()); svg->paint(p,imageRect); p->setFont(QFont(KGlobalSettings::smallestReadableFont())); // using the string temperature_tomorrow_condition for displaying the text - network not reachable QRect textRect_tomorrow_condition(contentsRect.left(), contentsRect.top()+(int)contentsRect.height()/1.2,contentsRect.left() + (int)(contentsRect.width() ), (int)contentsRect.top() + (int)contentsRect.height()/3); temperature_tomorrow_condition = "Network not reachable"; p->drawText(textRect_tomorrow_condition, Qt::AlignHCenter|Qt::AlignTop,i18n("%1",temperature_tomorrow_condition)); } p->restore(); } //void Plasma_Weather::paintImage( QPainter *p, const QRect &imageRect) //void Plasma_Weather::paintImage( QPainter *p, const QRect &image1Rect) //{ // QString svg_file = QString(); // if(iconTheme == "") // { // svg_file = "widgets/weather"; // } // else // { // svg_file = iconTheme; // } // Plasma::Svg* svg; // svg = new Plasma::Svg(this); // svg->setImagePath( svg_file ); // svg->setContainsMultipleImages(true); // svg->resize(image1Rect.width(), image1Rect.height()); // svg->paint(p,imageRect, d_a_t_code); // svg->paint(p,image1Rect, today_code); //} void Plasma_Weather::createConfigurationInterface(KConfigDialog* parent) { bool error = false; conf = new ConfigDialog(); parent->setButtons(KDialog::Ok | KDialog::Cancel | KDialog::Apply); parent->addPage(conf, parent->windowTitle(), icon()); conf->zipText->setText(zip); conf->iconThemeText->setText(iconTheme); conf->freqChooser->setValue(updateFrequency.toInt(&error)); conf->font = font; if(tempType == "F") { conf->fahrenheitSelect->setChecked(true); } else { conf->celsiusSelect->setChecked(true); } connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted())); connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted())); connect(parent, SIGNAL(cancelClicked()), this, SLOT(configRejected())); } void Plasma_Weather::configAccepted() { KConfigGroup cg = config(); cg.writeEntry("zip", conf->zipText->text()); if(conf->fahrenheitSelect->isChecked()) { cg.writeEntry("tempType", "F"); } else { cg.writeEntry("tempType", "C"); } cg.writeEntry("iconTheme", conf->iconThemeText->text()); cg.writeEntry("updateFrequency", updateFrequency.setNum(conf->freqChooser->value())); cg.writeEntry("font", conf->font.toString()); emit configNeedsSaving(); refresh(); delete conf; } void Plasma_Weather::configRejected() { delete conf; } Qt::Orientations Plasma_Weather::expandingDirections() const { // no use of additional space in any direction return 0; } #include "plasma-simpleweatherforecast.moc" plasma-simpleweatherforecast-1.3-kde-4.3.80/CMakeLists.txt0000600000036100001450000000251011141160274023112 0ustar karthiklibuuid# Project Needs a name ofcourse project(plasma-weatherforecast) #set(CMAKE_BACKWARDS_COMPATIBILITY 2.2) # Find the required Libaries find_package(KDE4 REQUIRED) include(KDE4Defaults) #find_package(Plasma REQUIRED) add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${QT_QTTEST_INCLUDE_DIR} ) # We add our source code here set(weather_SRCS plasma-simpleweatherforecast.cpp config.cpp) # Now make sure all files get to the right place kde4_add_ui_files(weather_SRCS config.ui) kde4_add_plugin(plasma_applet_simpleweatherforecast ${weather_SRCS}) target_link_libraries(plasma_applet_simpleweatherforecast ${QT_QTXML_LIBRARY} ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS}) # Build the tests #kde4_add_unit_test( test_plasma_wifi test_plasma-wifi-signal.cpp ) #target_link_libraries( test_plasma_wifi plasma_applet_wifi_signal # ${PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${QT_QTTEST_LIBRARY} ) install(TARGETS plasma_applet_simpleweatherforecast DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES plasma-applet-simpleweatherforecast.desktop DESTINATION ${SERVICES_INSTALL_DIR}) install(FILES plasma-simpleweatherforecast.svg DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/default/widgets/) plasma-simpleweatherforecast-1.3-kde-4.3.80/config.ui0000600000036100001450000001471411141163421022164 0ustar karthiklibuuid config 0 0 440 199 440 199 440 199 Form 300 60 100 31 Select font Select the units for temperature display 120 60 98 25 Fahrenheit false 10 60 111 20 Select the units for temperature display Units: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 120 80 88 25 Celsius 120 20 113 31 You can get the city code by visiting http://weather.yahoo.com. Paste the 8 digit alphanumeric code here 30 5 351 16 For example http://weather.yahoo.com/forecast/GMXX1273.html. So code GMXX1273 is for the city Berlin i18n("Visit http://weather.yahoo.com to get the city code") Qt::AlignLeft|Qt::AlignTrailing|Qt::AlignVCenter 50 30 71 16 For example http://weather.yahoo.com/forecast/GMXX1273.html. So code GMXX1273 is for the city Berlin City Code: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 17 160 91 20 Get themes from http://www.kde-look.org/content/show.php/Weather+Plasmoid?content=84251 Icon Theme: Qt::AlignRight 120 150 181 31 Get themes from http://www.kde-look.org/content/show.php/Weather+Plasmoid?content=84251 true 360 150 61 31 Browse... 300 150 61 31 Default 20 120 101 20 Fetch Updates: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 120 110 91 31 minutes 1 360 defaultButton clicked() iconThemeText clear() 315 125 200 125 plasma-simpleweatherforecast-1.3-kde-4.3.80/plasma-applet-simpleweatherforecast.desktop0000600000036100001450000000125011312706027031105 0ustar karthiklibuuid[Desktop Entry] Encoding=UTF-8 Name=Simple Weather Forecast Comment=A simple weather widget for plasma Icon=weather-clear Type=Service X-KDE-ServiceTypes=Plasma/Applet X-KDE-Library=plasma_applet_simpleweatherforecast X-KDE-PluginInfo-Author=Karthik Paithankar, Yannig, Joe Istead X-KDE-PluginInfo-Email=http://www.kde-look.org/content/show.php?content=92149 X-KDE-PluginInfo-Name=simpleweatherforecast X-KDE-PluginInfo-Version=1.3 X-KDE-PluginInfo-Website=http://www.kde-look.org/content/show.php?content=92149 X-KDE-PluginInfo-Category= X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true X-PlasmoidCategory=Environment and Weather plasma-simpleweatherforecast-1.3-kde-4.3.80/install0000700000036100001450000000022411312705734021752 0ustar karthiklibuuid#!/bin/sh mkdir build cd build cmake --release -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` ../ make echo "Now cd build; run sudo make install " plasma-simpleweatherforecast-1.3-kde-4.3.80/plasma-simpleweatherforecast.svg0000600000036100001450000262412211125666720026772 0ustar karthiklibuuid image/svg+xml plasma-simpleweatherforecast-1.3-kde-4.3.80/conditionscodes.txt0000600000036100001450000000154311125666720024320 0ustar karthiklibuuidCode Description 0 tornado 1 tropical storm 2 hurricane 3 severe thunderstorms 4 thunderstorms 5 mixed rain and snow 6 mixed rain and sleet 7 mixed snow and sleet 8 freezing drizzle 9 drizzle 10 freezing rain 11 showers 12 showers 13 snow flurries 14 light snow showers 15 blowing snow 16 snow 17 hail 18 sleet 19 dust 20 foggy 21 haze 22 smoky 23 blustery 24 windy 25 cold 26 cloudy 27 mostly cloudy (night) 28 mostly cloudy (day) 29 partly cloudy (night) 30 partly cloudy (day) 31 clear (night) 32 sunny 33 fair (night) 34 fair (day) 35 mixed rain and hail 36 hot 37 isolated thunderstorms 38 scattered thunderstorms 39 scattered thunderstorms 40 scattered showers 41 heavy snow 42 scattered snow showers 43 heavy snow 44 partly cloudy 45 thundershowers 46 snow showers 47 isolated thundershowers 3200 not availableplasma-simpleweatherforecast-1.3-kde-4.3.80/COPYING0000600000036100001450000002400011125666720021414 0ustar karthiklibuuid GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along witplasma-simpleweatherforecast-1.3-kde-4.3.80/config.cpp0000600000036100001450000000407711141162306022333 0ustar karthiklibuuid/*************************************************************************** * Credits to Vinnie Futia * * Copyright (C) 2008 by Karthik Paithankar * * * * * * 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 3 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 . * ***************************************************************************/ #include "config.h" #include "QFileDialog" #include ConfigDialog::ConfigDialog() : QWidget() { setupUi(this); connect(browseButton, SIGNAL(clicked()), this, SLOT(getIconTheme())); connect(fontButton, SIGNAL(clicked()), this, SLOT(getFont())); } void ConfigDialog::getIconTheme() { QString s = QFileDialog::getOpenFileName(this, "Select a Weather Theme", QDir::homePath(), "SVG Files (*.svg)"); iconThemeText->setText(s); } void ConfigDialog::getFont() { // If user "cancels" dialog, do not change font bool ok = false; QFont newFont = QFontDialog::getFont(&ok, this); if(ok) font = newFont; }