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.
58 lines
1.2 KiB
58 lines
1.2 KiB
15 years ago
|
//
|
||
|
// 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"
|
||
12 years ago
|
#include <tdeapplication.h>
|
||
15 years ago
|
#include <kapp.h>
|
||
12 years ago
|
#include <tdeconfig.h>
|
||
15 years ago
|
|
||
13 years ago
|
Interface::Interface(KNetStats* parent, const TQString& name) : mName(name), mView(0), mParent(parent) {
|
||
15 years ago
|
update();
|
||
|
}
|
||
|
|
||
|
void Interface::update() {
|
||
|
bool defaultVisibility = !(mName == "lo" || mName == "sit0");
|
||
|
|
||
12 years ago
|
TDEConfig* cfg = kapp->config();
|
||
|
TDEConfigGroupSaver groupSaver(cfg, mName);
|
||
15 years ago
|
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;
|
||
|
}
|
||
|
}
|
||
|
|
||
13 years ago
|
void Interface::say(const TQString& message) {
|
||
15 years ago
|
if (mView)
|
||
|
mView->say(message);
|
||
|
}
|
||
|
|