Removing kdecore/kde_file.h and replace it with qplatformdefs.h, a little bit of advice needed

Tim Beaulen tbscope at gmail.com
Sun Jan 15 16:04:01 GMT 2006


Hello,

I'm trying item 60 on the following todo list:
http://www.icebreaker.net/kde4libs-todo.pdf

Which is:
Remove kdecore/kde_file.h
Qt now has largefile support and defines similar macros in qplatformdefs.h


I need some advice on a few problems I'm facing.

1.
qplatfromdefs.h is different for each Qt mkspec and is defined in
$QTDIR/mkspecs/...

I'm assuming that $QTDIR/mkspecs/default will symlink to the correct mkspec.

To be able to use qplatformdefs.h, I need to add the correct include
path to the makefile.  Currently, I've added this path like in the
patch below, using the QTDIR environment variable.

Is QTDIR going to be required for KDE4 ?
If not, is there another way to get to the Qt dir ?

2.
kde_file.h defines a few macros that use file descriptors. Example: KDE_fdopen.
qplatformdefs.h does not.

It's used in kconfigbackend.cpp for example.

Should Trolltech add these macros to qplatformdefs.h ?

I'm also wondering if these macros can be included in QtGlobal ?




This is what I tried:

Index: Makefile.am
===================================================================
--- Makefile.am (revision 498026)
+++ Makefile.am (working copy)
@@ -19,7 +19,7 @@
 #    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 #    Boston, MA 02110-1301, USA.

-INCLUDES = -I$(top_srcdir)/kdefx -I$(top_srcdir)/kdecore/network
$(all_includes) $(AGG_CFLAGS)
+INCLUDES = -I$(top_srcdir)/kdefx -I$(top_srcdir)/kdecore/network
$(all_includes) $(AGG_CFLAGS) -I$(QTDIR)/mkspecs/default

 if with_agg
 SVGICONS=svgicons
Index: kconfigbackend.cpp
===================================================================
--- kconfigbackend.cpp  (revision 498026)
+++ kconfigbackend.cpp  (working copy)
@@ -40,6 +40,8 @@
 #include <qtextcodec.h>
 #include <qtextstream.h>

+#include <qplatformdefs.h>
+
 #include "kconfigbackend.h"

 #include "kapplication.h"
@@ -978,8 +980,8 @@
   int fileMode = -1;
   bool createNew = true;

-  KDE_struct_stat buf;
-  if (KDE_stat(QFile::encodeName(filename), &buf) == 0)
+  QT_STATBUF buf;
+  if (QT_STAT(QFile::encodeName(filename), &buf) == 0)
   {
      if (buf.st_uid == getuid())
      {
@@ -1021,7 +1023,7 @@
   {
      // Open existing file.
      // We use open() to ensure that we call without O_CREAT.
-     int fd = KDE_open( QFile::encodeName(filename), O_WRONLY | O_TRUNC );
+     int fd = QT_OPEN( QFile::encodeName(filename), O_WRONLY | O_TRUNC );
      if (fd < 0)
      {
         return bEntriesLeft;




More information about the kde-core-devel mailing list