You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
knetstats/src/interface.cpp

58 lines
1.2 KiB

//
// C++ Implementation: interface
//
// Description:
//
//
// Author: Hugo Parente Lima <hugo.pl@gmail.com>, (C) 2006
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "interface.h"
#include <tdeapplication.h>
#include <kapp.h>
#include <tdeconfig.h>
Interface::Interface(KNetStats* parent, const TQString& name) : mName(name), mView(0), mParent(parent) {
update();
}
void Interface::update() {
bool defaultVisibility = !(mName == "lo" || mName == "sit0");
TDEConfig* cfg = kapp->config();
TDEConfigGroupSaver groupSaver(cfg, mName);
bool visible = cfg->readBoolEntry("Monitoring", defaultVisibility);
if (!visible)
setVisible(false);
else if (visible && !mView)
setVisible(true);
else if (visible && mView)
mView->updateViewOptions();
}
void Interface::setVisible(bool visible) {
if (!visible) {
delete mView;
mView = 0;
} else if (visible && !mView)
mView = new KNetStatsView(mParent, mName);
}
KNetStatsView::Options Interface::options() {
if (mView)
return mView->options();
else {
KNetStatsView::Options opt;
KNetStatsView::readOptions(mName, &opt, false);
return opt;
}
}
void Interface::say(const TQString& message) {
if (mView)
mView->say(message);
}