diff options
author | Mavridis Philippe <mavridisf@gmail.com> | 2021-08-11 09:29:23 +0000 |
---|---|---|
committer | Mavridis Philippe <mavridisf@gmail.com> | 2021-08-29 10:18:55 +0000 |
commit | 8d99f539b8a8b43877973c8cabb9c44d9da01e36 (patch) | |
tree | a843ffe4bd9f2b1a1b2924ea1c707862ccb12af4 /kweather/sidebarwidget.cpp | |
parent | 064a406d4e72e1f00b6027e311bc228fa7be27e0 (diff) | |
download | tdetoys-8d99f539b8a8b43877973c8cabb9c44d9da01e36.tar.gz tdetoys-8d99f539b8a8b43877973c8cabb9c44d9da01e36.zip |
KWeather Konqueror sidebar revival
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
(cherry picked from commit 07171bc7a78a7c4d45372d8750e857d1da5d6173)
Diffstat (limited to 'kweather/sidebarwidget.cpp')
-rw-r--r-- | kweather/sidebarwidget.cpp | 98 |
1 files changed, 72 insertions, 26 deletions
diff --git a/kweather/sidebarwidget.cpp b/kweather/sidebarwidget.cpp index 0a7c080..45a97fd 100644 --- a/kweather/sidebarwidget.cpp +++ b/kweather/sidebarwidget.cpp @@ -1,4 +1,4 @@ - /* +/* * This file is part of the KDE project * Copyright (C) 2002 Ian Reinhart Geiser <geiseri@kde.org> * @@ -18,32 +18,78 @@ * * $Id$ */ - - #include "sidebarwidget.h" - #include <tqscrollview.h> - - sidebarwidget::sidebarwidget(TQWidget* parent, const char* name) : - sidebarwidgetbase(parent,name) - { - view = new TQVBox(reportGrid->viewport()); - reportGrid->addChild(view); - reportGrid->setResizePolicy(TQScrollView::AutoOneFit); - } - - sidebarwidget::~sidebarwidget() - { - - } - - void sidebarwidget::addWidget(TQWidget *w, const TQString &s) - { - w->setFixedWidth(reportGrid->visibleWidth ()); - } - - TQWidget *sidebarwidget::viewport() + +#include "sidebarwidget.h" +#include <tqscrollview.h> +#include <tqlayout.h> +#include <tqvbox.h> +#include <ksettings/dialog.h> +#include <ksettings/dispatcher.h> +#include <kcmultidialog.h> + +#include <kiconloader.h> +#include <tdetoolbar.h> +#include <tdeaction.h> +#include <tdelocale.h> +#include <dcopref.h> + +sidebarwidget::sidebarwidget(TQWidget* parent, const char* name) + : TQWidget(parent,name) +{ + mainLayout = new TQVBoxLayout(this); + + TDEToolBar *toolbar = new TDEToolBar(this); + toolbar->setLabel( i18n("Weather Sidebar") ); + toolbar->setSizePolicy(TQSizePolicy::Maximum, TQSizePolicy::Minimum); + + TDEAction *refresh = new TDEAction( i18n("Refresh"), SmallIcon("view-refresh"), + 0, TQT_TQOBJECT(this), TQT_SLOT(slotRefresh()), this, "refresh" ); + TDEAction *prefs = new TDEAction( i18n("Settings"), SmallIcon("configure"), + 0, TQT_TQOBJECT(this), TQT_SLOT(slotConfigure()), this, "preferences" ); + refresh->plug(toolbar); + prefs->plug(toolbar); + + reportGrid = new TQScrollView(this); + reportGrid->setResizePolicy(TQScrollView::AutoOneFit); + + layout = new TQVBoxLayout(reportGrid->viewport()); + view = new TQVBox(reportGrid->viewport()); + view->setSpacing(3); + layout->addWidget(view); + layout->addStretch(); + + mainLayout->addWidget(toolbar); + mainLayout->addWidget(reportGrid); + + dcopCall = new DCOPRef( "KWeatherService", "WeatherService" ); +} + +sidebarwidget::~sidebarwidget() +{ +} + +TQWidget *sidebarwidget::viewport() +{ + return view; +} + +void sidebarwidget::slotRefresh() +{ + dcopCall->send("updateAll()"); +} + +void sidebarwidget::slotConfigure() +{ + if ( settingsDialog == 0 ) { - return view; + settingsDialog = new KCMultiDialog(0); + connect( settingsDialog, TQT_SIGNAL( configCommitted() ), this, TQT_SLOT( slotRefresh() ) ); + + settingsDialog->addModule( "kcmweatherservice.desktop" ); } + settingsDialog->show(); + settingsDialog->raise(); +} + #include "sidebarwidget.moc" - |