add more spacing
[personal-kdebase.git] / apps / kinfocenter / base / info_svr4.cpp
blobfa84836deb365b30e444dc41dc388a23763f2142
1 /*
2 info_svr4.cpp
4 UNIX System V Release 4 specific Information about the Hardware.
5 Appropriate for SCO OpenServer and UnixWare.
6 Written 20-Feb-99 by Ronald Joe Record (rr@sco.com)
7 Initially based on info_sgi.cpp
8 */
10 #define INFO_DEV_SNDSTAT "/dev/sndstat"
12 #include <sys/systeminfo.h>
14 /* all following functions should return true, when the Information
15 was filled into the lBox-Widget.
16 returning false indicates, that information was not available.
19 bool GetInfo_ReadfromFile(QListView *lBox, char *Name, char splitchar) {
20 QString str;
21 char buf[512];
23 QFile *file = new QFile(Name);
24 QListViewItem* olditem = 0;
26 if (!file->open(QIODevice::ReadOnly)) {
27 delete file;
28 return false;
31 while (file->readLine(buf, sizeof(buf)-1) > 0) {
32 if (strlen(buf)) {
33 char *p=buf;
34 if (splitchar!=0) /* remove leading spaces between ':' and the following text */
35 while (*p) {
36 if (*p==splitchar) {
37 *p++ = ' ';
38 while (*p==' ')
39 ++p;
40 *(--p) = splitchar;
41 ++p;
42 } else
43 ++p;
46 QString s1 = QString::fromLocal8Bit(buf);
47 QString s2 = s1.mid(s1.find(splitchar)+1);
49 s1.truncate(s1.find(splitchar));
50 if (!(s1.isEmpty() || s2.isEmpty()))
51 olditem = new QListViewItem(lBox, olditem, s1, s2);
54 file->close();
56 delete file;
57 return true;
60 bool GetInfo_CPU(QListView *lBox) {
61 char buf[256];
63 sysinfo(SI_ARCHITECTURE, buf, sizeof(buf));
64 new QListViewItem(lBox, QString::fromLocal8Bit(buf));
65 return true;
68 bool GetInfo_IRQ(QListView *) {
69 return false;
72 bool GetInfo_DMA(QListView *) {
73 return false;
76 bool GetInfo_PCI(QTreeWidget* tree) {
77 char buf[256];
79 sysinfo(SI_BUSTYPES, buf, sizeof(buf));
80 QStringList list;
81 list << QString::fromLocal8Bit(buf);
82 new QTreeWidgetItem(tree, list);
83 return true;
86 bool GetInfo_IO_Ports(QListView *) {
87 return false;
90 bool GetInfo_Sound(QListView *lBox) {
91 if (GetInfo_ReadfromFile(lBox, INFO_DEV_SNDSTAT, 0))
92 return true;
93 else
94 return false;
97 bool GetInfo_Devices(QListView *) {
98 return false;
101 bool GetInfo_SCSI(QListView *) {
102 return false;
105 bool GetInfo_Partitions(QListView *) {
106 return false;
109 bool GetInfo_XServer_and_Video(QListView *lBox) {
110 return GetInfo_XServer_Generic(lBox);