(*** This bug was imported into bugs.kde.org ***) Package: kcminfo Version: KDE 3.0.0 Severity: wishlist Installed from: Compiler: gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110) OS: Linux (i686) release 2.4.18-5 OS/Compiler notes: The CDROM information would be good to have available from the Control Centre GUI. Information such as the maximum write speed and capabilities would be good. The information can be derived from the following file: /proc/sys/dev/cdrom/info An example: CD-ROM information Id: cdrom.c 3.12 2000/10/18 drive name: sr0 drive speed: 24 drive # of slots: 1 Can close tray: 1 Can open tray: 1 Can lock tray: 1 Can change speed: 1 Can select disk: 0 Can read multisession: 1 Can read MCN: 1 Reports media changed: 1 Can play audio: 1 Can write CD-R: 1 Can write CD-RW: 1 Can read DVD: 1 Can write DVD-R: 0 Can write DVD-RAM: 0 (Submitted via bugs.kde.org) (Called from KBugReport dialog)
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