summaryrefslogtreecommitdiffstats
path: root/kweather/sidebarwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kweather/sidebarwidget.cpp')
-rw-r--r--kweather/sidebarwidget.cpp98
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"
-