Bug 47242 - JJ: CDROM info not available from Control Centre
Summary: JJ: CDROM info not available from Control Centre
Status: RESOLVED FIXED
Alias: None
Product: kcontrol
Classification: Miscellaneous
Component: kcminfo (show other bugs)
Version: unspecified
Platform: unspecified Linux
: LO wishlist
Target Milestone: ---
Assignee: Helge Deller
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-08-30 21:48 UTC by Unknown
Modified: 2006-06-15 23:15 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Edited files (kdebase-3.5.3 SVN) for bug. (7.64 KB, application/x-tbz)
2006-06-14 08:40 UTC, Jahshan Bhatti
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bugzilla Maintainers 2002-08-30 21:33:57 UTC
(*** 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)
Comment 1 Helge Deller 2003-11-02 00:32:19 UTC
maybe after KDE 3.2.....
Comment 2 Stephan Kulow 2004-05-25 09:25:54 UTC
Replaced pdugal@nortelnetworks.com with null@kde.org due to bounces by reporter
Comment 3 Helge Deller 2006-02-19 13:51:23 UTC
Junior Job ?
Comment 4 Jahshan Bhatti 2006-06-14 08:40:25 UTC
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
Comment 5 Helge Deller 2006-06-15 14:32:32 UTC
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
+  }
+
 }
Comment 6 Jahshan Bhatti 2006-06-15 23:15:41 UTC
Cool!
Never knew about KStdGuiItem class (making mental note).

~Jahshan