[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    [kdebase trunk] linuxcdpooling: replace Q3CString with QByteArray
From:       Dave Rowe <dave () roweware ! com>
Date:       2005-10-26 3:13:49
Message-ID: 200510252213.49635.dave () roweware ! com
[Download RAW message or body]

Hello,

Attached is a (trivial) patch replacing Q3CString with QByteArray for the 
following files:

linuxcdpooling.cpp
linuxcdpooling.h

Thanks,
Dave
dave@roweware.com

["linuxcdpolling.patch" (text/x-diff)]

Index: linuxcdpolling.h
===================================================================
--- linuxcdpolling.h	(revision 474321)
+++ linuxcdpolling.h	(working copy)
@@ -22,7 +22,9 @@
 #include "backendbase.h"
 
 #include <qobject.h>
-#include <q3cstring.h>
+// Replacing Q3CString with QByteArray as noted
+// in the Trolltech documentation
+#include <qbytearray.h>
 #include <qmap.h>
 
 class DiscType
@@ -63,7 +65,7 @@
 	 * @param current the current known state of the drive
 	 * @return the disc type
 	 */
-	static DiscType identifyDiscType(const Q3CString &devNode,
+	static DiscType identifyDiscType(const QByteArray &devNode,
 		 const DiscType &current = DiscType::Unknown);
 
 private slots:
@@ -75,7 +77,7 @@
 private:
 	void applyType(DiscType type, const Medium *medium);
 
-	static bool hasDirectory(const Q3CString &devNode, const Q3CString &dir);
+	static bool hasDirectory(const QByteArray &devNode, const QByteArray &dir);
 
 	QMap<QString, PollingThread*> m_threads;
 	QStringList m_excludeNotification;
Index: linuxcdpolling.cpp
===================================================================
--- linuxcdpolling.cpp	(revision 474321)
+++ linuxcdpolling.cpp	(working copy)
@@ -25,8 +25,9 @@
 #include <qmutex.h>
 #include <qtimer.h>
 #include <qfile.h>
-//Added by qt3to4:
-#include <Q3CString>
+// Replacing Q3CString with QByteArray as noted
+// in the Trolltech documentation
+#include <QByteArray>
 
 #include <kdebug.h>
 
@@ -116,7 +117,7 @@
 class PollingThread : public QThread
 {
 public:
-	PollingThread(const Q3CString &devNode) : m_dev(devNode)
+	PollingThread(const QByteArray &devNode) : m_dev(devNode)
 	{
 		kdDebug(1219) << "PollingThread::PollingThread("
 		          << devNode << ")" << endl;
@@ -170,7 +171,7 @@
 private:
 	QMutex m_mutex;
 	bool m_stop;
-	const Q3CString m_dev;
+	const QByteArray m_dev;
 	DiscType m_currentType;
 	DiscType m_lastPollType;
 };
@@ -227,7 +228,7 @@
 	{
 		m_excludeNotification.append( id );
 		
-		Q3CString dev = QFile::encodeName( medium->deviceNode() ).data();
+		QByteArray dev = QFile::encodeName( medium->deviceNode() ).data();
 		PollingThread *thread = new PollingThread(dev);
 		m_threads[id] = thread;
 		thread->start();
@@ -266,7 +267,7 @@
 		// It is just a mount state change, no need to notify
 		m_excludeNotification.append( id );
 		
-		Q3CString dev = QFile::encodeName( medium->deviceNode() ).data();
+		QByteArray dev = QFile::encodeName( medium->deviceNode() ).data();
 		PollingThread *thread = new PollingThread(dev);
 		m_threads[id] = thread;
 		thread->start();
@@ -399,7 +400,7 @@
 	}
 }
 
-DiscType LinuxCDPolling::identifyDiscType(const Q3CString &devNode,
+DiscType LinuxCDPolling::identifyDiscType(const QByteArray &devNode,
                                           const DiscType &current)
 {
 	//kdDebug(1219) << "LinuxCDPolling::identifyDiscType("
@@ -472,7 +473,7 @@
 	}
 }
 
-bool LinuxCDPolling::hasDirectory(const Q3CString &devNode, const Q3CString &dir)
+bool LinuxCDPolling::hasDirectory(const QByteArray &devNode, const QByteArray &dir)
 {
 	bool ret = false; // return value
 	int fd = 0; // file descriptor for drive
@@ -484,7 +485,7 @@
 	char dirname[256]; // filename for the current path table entry
 	int pos = 0; // our position into the path table
 	int curr_record = 1; // the path table record we're on
-	Q3CString fixed_directory = dir.toUpper(); // the uppercase version of the "directory" parameter
+	QByteArray fixed_directory = dir.toUpper(); // the uppercase version of the "directory" parameter
 
 	// open the drive
 	fd = open(devNode, O_RDONLY | O_NONBLOCK);
@@ -552,7 +553,7 @@
 			break;
 		}
 		dirname[len_di] = 0;
-		qstrcpy(dirname, Q3CString(dirname).toUpper());
+		qstrcpy(dirname, QByteArray(dirname).toUpper());
 
 		// if we found a folder that has the root as a parent, and the directory name matches
 		// then return success


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic