6f33e60eef
Option to build kompmgr - from Sergey Svishchev improved kdeeject script - from Sergey Svishchev ksysguard tidyup, improved handling of process list. infocenter tidyup Add NetBSD support to kicker/applets/naughty (finally fixing PR 25052) Bump PKGREVISION.
110 lines
3.3 KiB
Text
110 lines
3.3 KiB
Text
$NetBSD: patch-af,v 1.9 2008/01/04 21:05:57 markd Exp $
|
|
|
|
--- kcontrol/info/info_netbsd.cpp.orig 2005-09-10 20:25:05.000000000 +1200
|
|
+++ kcontrol/info/info_netbsd.cpp
|
|
@@ -41,6 +41,7 @@
|
|
#include <qfontmetrics.h>
|
|
#include <qstrlist.h>
|
|
#include <qtextstream.h>
|
|
+#include <qregexp.h>
|
|
|
|
#include <kdebug.h>
|
|
#include <kio/global.h> /* for KIO::convertSize() */
|
|
@@ -123,7 +124,7 @@ static bool GetDmesgInfo(QListView *lBox
|
|
}
|
|
|
|
QListViewItem *olditem = NULL;
|
|
- while(!(s = t->readLine().local8Bit()).isEmpty()) {
|
|
+ while(!(s = t->readLine().local8Bit()).isNull()) {
|
|
if (!seencpu) {
|
|
if (s.contains("cpu"))
|
|
seencpu = true;
|
|
@@ -134,9 +135,7 @@ static bool GetDmesgInfo(QListView *lBox
|
|
s.contains("WARNING: old BSD partition ID!"))
|
|
break;
|
|
|
|
- if (!filter
|
|
- || (filter[0] == '^' && s.find(&filter[1]) == 0)
|
|
- || (filter[0] != '^' && s.contains(filter))) {
|
|
+ if (!filter || s.contains(QRegExp(filter))) {
|
|
if (func)
|
|
func(lBox, s);
|
|
else
|
|
@@ -163,7 +162,7 @@ AddIRQLine(QListView *lBox, QString s)
|
|
int pos, irqnum;
|
|
char numstr[3];
|
|
|
|
- pos = s.find(" irq ");
|
|
+ pos = s.find(QRegExp("[ (]irq "));
|
|
irqnum = (pos < 0) ? 0 : atoi(&s.ascii()[pos+5]);
|
|
if (irqnum)
|
|
snprintf(numstr, 3, "%02d", irqnum);
|
|
@@ -181,7 +180,7 @@ bool GetInfo_IRQ (QListView *lBox)
|
|
lBox->addColumn(i18n("Device"));
|
|
lBox->setSorting(0);
|
|
lBox->setShowSortIndicator(FALSE);
|
|
- (void) GetDmesgInfo(lBox, " irq ", AddIRQLine);
|
|
+ (void) GetDmesgInfo(lBox, "[ (]irq ", AddIRQLine);
|
|
return true;
|
|
}
|
|
|
|
@@ -265,9 +264,11 @@ bool GetInfo_SCSI (QListView *lbox)
|
|
bool GetInfo_Partitions (QListView *lbox)
|
|
{
|
|
int num; // number of mounts
|
|
- // FIXME: older pkgsrc patches checked ST_RDONLY for this declaration
|
|
- // what is ST_RDONLY and how does it affect getmntinfo?
|
|
+#ifdef HAVE_STATVFS
|
|
+ struct statvfs *mnt; // mount data pointer
|
|
+#else
|
|
struct statfs *mnt; // mount data pointer
|
|
+#endif
|
|
|
|
// get mount info
|
|
if (!(num=getmntinfo(&mnt, MNT_WAIT))) {
|
|
@@ -290,24 +291,31 @@ bool GetInfo_Partitions (QListView *lbox
|
|
unsigned long long big[2];
|
|
QString vv[5];
|
|
|
|
+#ifdef HAVE_STATVFS
|
|
+ big[0] = big[1] = mnt->f_frsize; // coerce the product
|
|
+#else
|
|
big[0] = big[1] = mnt->f_bsize; // coerce the product
|
|
+#endif
|
|
big[0] *= mnt->f_blocks;
|
|
big[1] *= mnt->f_bavail; // FIXME: use f_bfree if root?
|
|
|
|
// convert to strings
|
|
vv[0] = KIO::convertSize(big[0]);
|
|
- vv[1] = QString::fromLatin1("%1 (%2%%)")
|
|
+ vv[1] = QString("%1 (%2%)")
|
|
.arg(KIO::convertSize(big[1]))
|
|
.arg(mnt->f_blocks ? mnt->f_bavail*100/mnt->f_blocks : 0);
|
|
|
|
- // FIXME: these two are large enough to punctuate
|
|
- vv[2] = QString::number(mnt->f_files);
|
|
- vv[3] = QString::fromLatin1("%1 (%2%%) ")
|
|
+ vv[2] = QString("%L1").arg(mnt->f_files);
|
|
+ vv[3] = QString("%L1 (%2%) ")
|
|
.arg(mnt->f_ffree)
|
|
.arg(mnt->f_files ? mnt->f_ffree*100/mnt->f_files : 0);
|
|
|
|
vv[4] = QString::null;
|
|
+#ifdef HAVE_STATVFS
|
|
+#define MNTF(x) if (mnt->f_flag & ST_##x) vv[4] += QString::fromLatin1(#x " ");
|
|
+#else
|
|
#define MNTF(x) if (mnt->f_flags & MNT_##x) vv[4] += QString::fromLatin1(#x " ");
|
|
+#endif
|
|
MNTF(ASYNC)
|
|
MNTF(DEFEXPORTED)
|
|
MNTF(EXKERB)
|
|
@@ -316,7 +324,9 @@ bool GetInfo_Partitions (QListView *lbox
|
|
MNTF(EXPORTED)
|
|
MNTF(EXPUBLIC)
|
|
MNTF(EXRDONLY)
|
|
+#ifndef HAVE_STATVFS
|
|
MNTF(IGNORE)
|
|
+#endif
|
|
MNTF(LOCAL)
|
|
MNTF(NOATIME)
|
|
MNTF(NOCOREDUMP)
|