Summary: | JJ: CDROM info not available from Control Centre | ||
---|---|---|---|
Product: | [Unmaintained] kcontrol | Reporter: | Unknown <null> |
Component: | kcminfo | Assignee: | Helge Deller <deller> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | LO | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | Edited files (kdebase-3.5.3 SVN) for bug. |
Description
Bugzilla Maintainers
2002-08-30 21:33:57 UTC
maybe after KDE 3.2..... Replaced pdugal@nortelnetworks.com with null@kde.org due to bounces by reporter Junior Job ? Created attachment 16592 [details]
Edited files (kdebase-3.5.3 SVN) for bug.
Dear KDE Developer Team,
I am student who is new to programming. Since it is summer I wanted to try
open-source software and so far I have loved it. I have gone almost full Linux
and want to start developing, so I found Gentoo, KDE, KDevelop and the KDE Bug
System. I read the article on Junior Jobs, so I took this job today and added a
few pieces of code to KDE-3.5.3 (SVN) to hopefully satisfy this bug. I know its
not much, but I want to send it anyways.
Thanks,
~Jahshan
SVN commit 551707 by deller: submit patch by Jahshan Bhatti <jabhatti91@gmail.com> to fix Bug 47242: JJ: CDROM info not available from Control Centre Thanks a lot Jahshan !! FEATURE: 47242 A doc/kinfocenter/cdinfo (directory) A doc/kinfocenter/cdinfo/Makefile.am A doc/kinfocenter/cdinfo/index.docbook M +2 -1 kcontrol/info/Makefile.am A kcontrol/info/cdinfo.desktop M +1 -0 kcontrol/info/info.h M +7 -0 kcontrol/info/info_generic.cpp M +46 -1 kcontrol/info/info_linux.cpp M +10 -1 kcontrol/info/main.cpp --- branches/KDE/3.5/kdebase/kcontrol/info/Makefile.am #551706:551707 @@ -18,4 +18,5 @@ xdg_apps_DATA = memory.desktop processor.desktop dma.desktop \ interrupts.desktop ioports.desktop opengl.desktop pci.desktop sound.desktop \ - devices.desktop scsi.desktop partitions.desktop xserver.desktop + devices.desktop scsi.desktop partitions.desktop xserver.desktop \ + cdinfo.desktop --- branches/KDE/3.5/kdebase/kcontrol/info/info.h #551706:551707 @@ -29,6 +29,7 @@ bool GetInfo_SCSI( QListView *lBox ); bool GetInfo_Partitions( QListView *lBox ); bool GetInfo_XServer_and_Video( QListView *lBox ); +bool GetInfo_CD_ROM( QListView *lBox ); /* New CD-ROM Info */ extern bool GetInfo_OpenGL( QListView *lBox ); class KInfoListWidget : public KCModule --- branches/KDE/3.5/kdebase/kcontrol/info/info_generic.cpp #551706:551707 @@ -22,6 +22,7 @@ #define INFO_SCSI_AVAILABLE #define INFO_PARTITIONS_AVAILABLE #define INFO_XSERVER_AVAILABLE +#define INFO_CD_ROM_AVAILABLE /* all following functions should return TRUE, when the Information @@ -79,3 +80,9 @@ { return GetInfo_XServer_Generic( lBox ); } + +/* Generic GetInfo? ~Jahshan */ +bool GetInfo_CD_ROM(QListView * lBox) +{ + return false; +} --- branches/KDE/3.5/kdebase/kcontrol/info/info_linux.cpp #551706:551707 @@ -2,7 +2,8 @@ Linux-specific Information about the Hardware. - (C) Copyright 1998-2001 by Helge Deller <deller@gmx.de> + (C) Copyright 1998-2006 by Helge Deller <deller@gmx.de> + (C) Copyright 2006 by Jahshan Bhatti <jabhatti91@gmail.com> (CD-ROM Info) To do (maybe?): - include Information about XFree86 and/or Accelerated X @@ -39,6 +40,7 @@ #include <kapplication.h> #include <kiconloader.h> +#include <kstdguiitem.h> #define INFO_CPU_AVAILABLE #define INFO_CPU "/proc/cpuinfo" @@ -74,7 +76,10 @@ #define INFO_XSERVER_AVAILABLE +#define INFO_CD_ROM_AVAILABLE +#define INFO_CD_ROM "/proc/sys/dev/cdrom/info" /* Feature 47242 */ + #define MAXCOLUMNWIDTH 600 bool GetInfo_ReadfromFile(QListView * lbox, const char *FileName, @@ -548,3 +553,43 @@ { return GetInfo_XServer_Generic(lBox); } + +/* GetInfo for CD-ROM Info by Jahshan Bhatti */ +bool GetInfo_CD_ROM(QListView * lBox) +{ + QFile file(INFO_CD_ROM); + lBox->addColumn(i18n("Information")); + lBox->addColumn(i18n("Value")); + + if (file.exists() && file.open(IO_ReadOnly)) { + QRegExp rx("(.+):\\s+(\\S.*)"); + QTextStream stream(&file); + QString line; + QListViewItem *child = NULL; + + while (!stream.atEnd()) { + line = stream.readLine(); + if (!line.isEmpty()) { + if (-1 != rx.search(line)) { + QString text = rx.cap(1); + QString value = rx.cap(2); + if (!text.contains('#')) { + if (value == "0") + value = KStdGuiItem::no().plainText(); + if (value == "1") + value = KStdGuiItem::yes().plainText(); + } + child = new QListViewItem(lBox,child,text,value); + } + } else { + child = new QListViewItem(lBox,child,QString::null,QString::null); + } + } + file.close(); + } else { + return false; + } + + return true; +} + --- branches/KDE/3.5/kdebase/kcontrol/info/main.cpp #551706:551707 @@ -137,6 +137,15 @@ return 0; #endif } - +/* create_cdinfo function for CD-ROM Info ~Jahshan */ + KDE_EXPORT KCModule *create_cdinfo(QWidget *parent, const char * /*name*/) + { +#ifdef INFO_CD_ROM_AVAILABLE + return new KInfoListWidget(i18n("CD-ROM Info"), parent, "kcminfo", GetInfo_CD_ROM); +#else + return 0; +#endif + } + } Cool! Never knew about KStdGuiItem class (making mental note). ~Jahshan |