diff options
author | Slávek Banko <[email protected]> | 2018-10-26 04:07:01 +0200 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2018-10-27 13:36:02 +0200 |
commit | 42673b0179d00e2b5a05fb48438577b923f00b8b (patch) | |
tree | c42ef21f0799c5e73ae1ccb6ed439d690ec9e59c /src/interface.cpp | |
parent | 0e396d6b00651d811959f8d4c7ccad9ff868a1a1 (diff) | |
download | knetstats-42673b0179d00e2b5a05fb48438577b923f00b8b.tar.gz knetstats-42673b0179d00e2b5a05fb48438577b923f00b8b.zip |
Fix structure of directories
Signed-off-by: Slávek Banko <[email protected]>
(cherry picked from commit 06772a369f2beef80bb291ded30cbe125a24af56)
Diffstat (limited to 'src/interface.cpp')
-rw-r--r-- | src/interface.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/interface.cpp b/src/interface.cpp new file mode 100644 index 0000000..1ac98a8 --- /dev/null +++ b/src/interface.cpp @@ -0,0 +1,57 @@ +// +// C++ Implementation: interface +// +// Description: +// +// +// Author: Hugo Parente Lima <[email protected]>, (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); +} + |