From 2bda8f7717adf28da4af0d34fb82f63d2868c31d Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeutils@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- ksim/ksim.cpp | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 ksim/ksim.cpp (limited to 'ksim/ksim.cpp') diff --git a/ksim/ksim.cpp b/ksim/ksim.cpp new file mode 100644 index 0000000..86ea980 --- /dev/null +++ b/ksim/ksim.cpp @@ -0,0 +1,129 @@ +/* ksim - a system monitor for kde + * + * Copyright (C) 2001 Robbie Ward + * + * 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 2 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 "ksim.h" +#include "ksimview.h" +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +extern "C" +{ + KDE_EXPORT KPanelExtension *init(QWidget *parent, const QString &configFile) + { + KGlobal::locale()->insertCatalogue("ksim"); + return new KSim::PanelExtension(configFile, KPanelExtension::Normal, + KPanelExtension::About | KPanelExtension::Help | + KPanelExtension::Preferences | KPanelExtension::ReportBug, + parent, "ksim"); + } +} + +KSim::PanelExtension::PanelExtension(const QString &configFile, + Type type, int actions, QWidget *parent, const char *name) + : KPanelExtension(configFile, type, actions, parent, name) +{ + m_dcopClient = new DCOPClient; + m_view = new KSim::MainView(config(), true, this, "m_view"); + m_view->positionChange(orientation()); + + m_dcopClient->registerAs(name, false); + + m_aboutData = new KAboutData(name, I18N_NOOP("KSim"), KSIM_VERSION_STRING, + I18N_NOOP("A plugin based system monitor for KDE"), + KAboutData::License_GPL, I18N_NOOP("(C) 2001-2003 Robbie Ward\n(C) 2005 Reuben Sutton")); + m_aboutData->addAuthor("Reuben Sutton", I18N_NOOP("Maintainer"),"reuben.sutton@gmail.com"); + m_aboutData->addAuthor("Robbie Ward", I18N_NOOP("Original Author"), + "linuxphreak@gmx.co.uk"); + m_aboutData->addAuthor("Jason Katz-Brown", I18N_NOOP("Developer"), + "jason@katzbrown.com"); + m_aboutData->addAuthor("Heitham Omar", I18N_NOOP("Some FreeBSD ports"), + "super_ice@ntlworld.com"); + m_aboutData->addAuthor("Otto Bruggeman", I18N_NOOP("Testing, Bug fixing and some help"), + "bruggie@home.nl"); +} + +KSim::PanelExtension::~PanelExtension() +{ + delete m_aboutData; + delete m_dcopClient; +} + +QSize KSim::PanelExtension::sizeHint(Position p, QSize maxSize) const +{ + return m_view->sizeHint(p, maxSize); +} + +void KSim::PanelExtension::resizeEvent(QResizeEvent *) +{ + m_view->resize(size()); +} + +KPanelExtension::Position KSim::PanelExtension::preferedPosition() const +{ + return KPanelExtension::Right; +} + +void KSim::PanelExtension::reparse() +{ + emit updateLayout(); +} + +void KSim::PanelExtension::show() +{ + KPanelExtension::show(); + + reparse(); +} + +void KSim::PanelExtension::about() +{ + KAboutApplication(m_aboutData).exec(); +} + +void KSim::PanelExtension::help() +{ +} + +void KSim::PanelExtension::preferences() +{ + m_view->preferences(); +} + +void KSim::PanelExtension::reportBug() +{ + KBugReport(this, true, m_aboutData).exec(); +} + +void KSim::PanelExtension::positionChange(Position) +{ + m_view->positionChange(orientation()); +} + +#include "ksim.moc" -- cgit v1.2.1