diff options
Diffstat (limited to 'kicker/applets/naughty')
-rw-r--r-- | kicker/applets/naughty/NaughtyApplet.cpp | 35 | ||||
-rw-r--r-- | kicker/applets/naughty/NaughtyApplet.h | 4 | ||||
-rw-r--r-- | kicker/applets/naughty/NaughtyConfigDialog.h | 2 | ||||
-rw-r--r-- | kicker/applets/naughty/NaughtyProcessMonitor.cpp | 33 | ||||
-rw-r--r-- | kicker/applets/naughty/NaughtyProcessMonitor.h | 2 | ||||
-rw-r--r-- | kicker/applets/naughty/naughty-happy.png | bin | 391 -> 2094 bytes | |||
-rw-r--r-- | kicker/applets/naughty/naughty-sad.png | bin | 374 -> 2104 bytes |
7 files changed, 40 insertions, 36 deletions
diff --git a/kicker/applets/naughty/NaughtyApplet.cpp b/kicker/applets/naughty/NaughtyApplet.cpp index 1da45a350..83db26d12 100644 --- a/kicker/applets/naughty/NaughtyApplet.cpp +++ b/kicker/applets/naughty/NaughtyApplet.cpp @@ -67,29 +67,28 @@ NaughtyApplet::NaughtyApplet setBackgroundOrigin( AncestorOrigin ); button_ = new SimpleButton(this); - button_->setFixedSize(20, 20); TQVBoxLayout * layout = new TQVBoxLayout(this); layout->addWidget(button_); - monitor_ = new NaughtyProcessMonitor(2, 20, TQT_TQOBJECT(this)); + monitor_ = new NaughtyProcessMonitor(2, 20, this); connect ( - button_, TQT_SIGNAL(clicked()), - this, TQT_SLOT(slotPreferences()) + button_, TQ_SIGNAL(clicked()), + this, TQ_SLOT(slotPreferences()) ); connect ( - monitor_, TQT_SIGNAL(runawayProcess(ulong, const TQString &)), - this, TQT_SLOT(slotWarn(ulong, const TQString &)) + monitor_, TQ_SIGNAL(runawayProcess(ulong, const TQString &)), + this, TQ_SLOT(slotWarn(ulong, const TQString &)) ); connect ( - monitor_, TQT_SIGNAL(load(uint)), - this, TQT_SLOT(slotLoad(uint)) + monitor_, TQ_SIGNAL(load(uint)), + this, TQ_SLOT(slotLoad(uint)) ); loadSettings(); @@ -132,25 +131,15 @@ NaughtyApplet::slotWarn(ulong pid, const TQString & name) } } - int -NaughtyApplet::widthForHeight(int) const -{ - return 20; -} - - int -NaughtyApplet::heightForWidth(int) const -{ - return 20; -} void NaughtyApplet::slotLoad(uint l) { - if (l > monitor_->triggerLevel()) - button_->setPixmap(BarIcon("naughty-sad")); - else - button_->setPixmap(BarIcon("naughty-happy")); + button_->setPixmap(TDEGlobal::iconLoader()->loadIcon( + (l > monitor_->triggerLevel() ? "naughty-sad" : "naughty-happy"), + TDEIcon::Panel, + TQMIN(size().width(),size().height())-2 + )); } void diff --git a/kicker/applets/naughty/NaughtyApplet.h b/kicker/applets/naughty/NaughtyApplet.h index eb9850851..0ef796ea4 100644 --- a/kicker/applets/naughty/NaughtyApplet.h +++ b/kicker/applets/naughty/NaughtyApplet.h @@ -31,7 +31,7 @@ class TQPushButton; class NaughtyApplet : public KPanelApplet { - Q_OBJECT + TQ_OBJECT public: @@ -46,8 +46,6 @@ class NaughtyApplet : public KPanelApplet ~NaughtyApplet(); - virtual int widthForHeight(int h) const; - virtual int heightForWidth(int w) const; signals: diff --git a/kicker/applets/naughty/NaughtyConfigDialog.h b/kicker/applets/naughty/NaughtyConfigDialog.h index 4e428f00f..41be8344e 100644 --- a/kicker/applets/naughty/NaughtyConfigDialog.h +++ b/kicker/applets/naughty/NaughtyConfigDialog.h @@ -28,7 +28,7 @@ class KIntNumInput; class NaughtyConfigDialog : public KDialogBase { - Q_OBJECT + TQ_OBJECT public: diff --git a/kicker/applets/naughty/NaughtyProcessMonitor.cpp b/kicker/applets/naughty/NaughtyProcessMonitor.cpp index 09c02cbf9..63b634e59 100644 --- a/kicker/applets/naughty/NaughtyProcessMonitor.cpp +++ b/kicker/applets/naughty/NaughtyProcessMonitor.cpp @@ -39,6 +39,10 @@ #include <signal.h> #include <unistd.h> +#ifdef Q_OS_SOLARIS +#include <procfs.h> +#endif + #include <tqfile.h> #include <tqstring.h> #include <tqstringlist.h> @@ -107,7 +111,7 @@ NaughtyProcessMonitor::NaughtyProcessMonitor #ifdef __NetBSD__ d->kd = kvm_open(NULL, NULL, NULL, KVM_NO_FILES, "kvm_open"); #endif - connect(d->timer_, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotTimeout())); + connect(d->timer_, TQ_SIGNAL(timeout()), this, TQ_SLOT(slotTimeout())); } NaughtyProcessMonitor::~NaughtyProcessMonitor() @@ -210,7 +214,7 @@ NaughtyProcessMonitor::_process(ulong pid, uint load) bool NaughtyProcessMonitor::canKill(ulong pid) const { -#ifdef __linux__ +#ifdef Q_OS_LINUX TQFile f("/proc/" + TQString::number(pid) + "/status"); if (!f.open(IO_ReadOnly)) @@ -240,6 +244,17 @@ NaughtyProcessMonitor::canKill(ulong pid) const return false ; return geteuid () == d->uidMap_[pid] ; +#elif defined(Q_OS_SOLARIS) + TQFile f("/proc/" + TQString::number(pid) + "/psinfo"); + TQByteArray raw; + psinfo_t *inf; + + if (!f.open(IO_ReadOnly)) + return false; + raw = f.readAll(); + f.close(); + inf = (psinfo_t *)raw.data(); + return geteuid() == inf->pr_euid; #else Q_UNUSED( pid ); return false; @@ -249,8 +264,9 @@ NaughtyProcessMonitor::canKill(ulong pid) const TQString NaughtyProcessMonitor::processName(ulong pid) const { -#if defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__) -#ifdef __linux__ +#if defined(Q_OS_LINUX) || defined(__OpenBSD__) || defined(__NetBSD__) || \ + defined(Q_OS_SOLARIS) +#if defined(Q_OS_LINUX) || defined(Q_OS_SOLARIS) TQFile f("/proc/" + TQString::number(pid) + "/cmdline"); if (!f.open(IO_ReadOnly)) @@ -344,7 +360,7 @@ NaughtyProcessMonitor::processName(ulong pid) const uint NaughtyProcessMonitor::cpuLoad() const { -#ifdef __linux__ +#ifdef Q_OS_LINUX TQFile f("/proc/stat"); if (!f.open(IO_ReadOnly)) @@ -400,7 +416,7 @@ NaughtyProcessMonitor::cpuLoad() const TQValueList<ulong> NaughtyProcessMonitor::pidList() const { -#ifdef __linux__ +#if defined(Q_OS_LINUX) || defined(Q_OS_SOLARIS) TQStringList dl(TQDir("/proc").entryList()); TQValueList<ulong> pl; @@ -505,7 +521,7 @@ NaughtyProcessMonitor::pidList() const bool NaughtyProcessMonitor::getLoad(ulong pid, uint & load) const { -#ifdef __linux__ +#ifdef Q_OS_LINUX TQFile f("/proc/" + TQString::number(pid) + "/stat"); if (!f.open(IO_ReadOnly)) @@ -540,7 +556,8 @@ NaughtyProcessMonitor::getLoad(ulong pid, uint & load) const bool NaughtyProcessMonitor::kill(ulong pid) const { -#if defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__) +#if defined(Q_OS_LINUX) || defined(__OpenBSD__) || defined(__NetBSD__) ||\ + defined(Q_OS_SOLARIS) return 0 == ::kill(pid, SIGKILL); #else Q_UNUSED( pid ); diff --git a/kicker/applets/naughty/NaughtyProcessMonitor.h b/kicker/applets/naughty/NaughtyProcessMonitor.h index d66479964..3075bb9bd 100644 --- a/kicker/applets/naughty/NaughtyProcessMonitor.h +++ b/kicker/applets/naughty/NaughtyProcessMonitor.h @@ -27,7 +27,7 @@ class NaughtyProcessMonitorPrivate; class NaughtyProcessMonitor : public TQObject { - Q_OBJECT + TQ_OBJECT public: diff --git a/kicker/applets/naughty/naughty-happy.png b/kicker/applets/naughty/naughty-happy.png Binary files differindex 4c3505dfc..cbd451365 100644 --- a/kicker/applets/naughty/naughty-happy.png +++ b/kicker/applets/naughty/naughty-happy.png diff --git a/kicker/applets/naughty/naughty-sad.png b/kicker/applets/naughty/naughty-sad.png Binary files differindex ae6d727f2..82a8279f5 100644 --- a/kicker/applets/naughty/naughty-sad.png +++ b/kicker/applets/naughty/naughty-sad.png |