diff -Nurd kdelibs-3.5.9/darwin/kcmartsrc kdelibs-3.5.9-new/darwin/kcmartsrc
--- kdelibs-3.5.9/darwin/kcmartsrc	1969-12-31 19:00:00.000000000 -0500
+++ kdelibs-3.5.9-new/darwin/kcmartsrc	2008-02-13 21:00:34.000000000 -0500
@@ -0,0 +1,9 @@
+[Arts]
+Arguments=\s-F 10 -S 4096 -a esd -d -b 16 -s 60 -m artsmessage -c drkonqi -l 3 -f
+Bits=16
+FullDuplex=true
+AudioIO=esd
+NetworkTransparent=true
+StartRealtime=false
+StartServer=false
+SuspendTime=60
diff -Nurd kdelibs-3.5.9/darwin/kdeglobals kdelibs-3.5.9-new/darwin/kdeglobals
--- kdelibs-3.5.9/darwin/kdeglobals	1969-12-31 19:00:00.000000000 -0500
+++ kdelibs-3.5.9-new/darwin/kdeglobals	2008-02-13 21:00:34.000000000 -0500
@@ -0,0 +1,129 @@
+[$Version]
+update_info=kaccel.upd:kde3.3/r1,kded.upd:kde3.0,klippershortcuts.upd:04112002,kwin.upd:kde3.2Xinerama,socks.upd:kde3.0/r1
+
+[General]
+XftHintStyle=hintmedium
+XftSubPixel=
+fixed=Monaco CY,11,-1,5,50,0,0,0,0,0
+font=Baghdad,12,-1,5,50,0,0,0,0,0
+menuFont=Baghdad,12,-1,5,50,0,0,0,0,0
+taskbarFont=Baghdad,11,-1,5,50,0,0,0,0,0
+toolBarFont=Baghdad,10,-1,5,50,0,0,0,0,0
+
+[Global Shortcuts]
+Activate Window Demanding Attention=default(Alt+Ctrl+A)
+Defaults timestamp=Mar  1 200514:10:32
+Desktop Screenshot=default(Ctrl+Print)
+Enable/Disable Clipboard Actions=default(Alt+Ctrl+X)
+Halt without Confirmation=default(Alt+Ctrl+Shift+PageDown)
+Kill Window=default(Alt+Ctrl+Escape)
+Lock Session=default(Alt+Ctrl+L)
+Log Out=default(Alt+Ctrl+Delete)
+Log Out Without Confirmation=default(Alt+Ctrl+Shift+Delete)
+Manually Invoke Action on Current Clipboard=default(Alt+Ctrl+R)
+Mouse Emulation=default(Alt+F12)
+Next Taskbar Entry=none
+Popup Launch Menu=default(Alt+F1)
+Previous Taskbar Entry=none
+Reboot without Confirmation=default(Alt+Ctrl+Shift+PageUp)
+Run Command=default(Alt+F2)
+Setup Window Shortcut=none
+Show Klipper Popup-Menu=default(Alt+Ctrl+V)
+Show Taskmanager=default(Ctrl+Escape)
+Show Window List=default(Alt+F5)
+Switch One Desktop Down=none
+Switch One Desktop Up=none
+Switch One Desktop to the Left=none
+Switch One Desktop to the Right=none
+Switch User=default(Alt+Ctrl+Insert)
+Switch to Desktop 1=default(Ctrl+F1)
+Switch to Desktop 10=default(Ctrl+F10)
+Switch to Desktop 11=default(Ctrl+F11)
+Switch to Desktop 12=default(Ctrl+F12)
+Switch to Desktop 13=default(Ctrl+Shift+F1)
+Switch to Desktop 14=default(Ctrl+Shift+F2)
+Switch to Desktop 15=default(Ctrl+Shift+F3)
+Switch to Desktop 16=default(Ctrl+Shift+F4)
+Switch to Desktop 17=default(Ctrl+Shift+F5)
+Switch to Desktop 18=default(Ctrl+Shift+F6)
+Switch to Desktop 19=default(Ctrl+Shift+F7)
+Switch to Desktop 2=default(Ctrl+F2)
+Switch to Desktop 20=default(Ctrl+Shift+F8)
+Switch to Desktop 3=default(Ctrl+F3)
+Switch to Desktop 4=default(Ctrl+F4)
+Switch to Desktop 5=default(Ctrl+F5)
+Switch to Desktop 6=default(Ctrl+F6)
+Switch to Desktop 7=default(Ctrl+F7)
+Switch to Desktop 8=default(Ctrl+F8)
+Switch to Desktop 9=default(Ctrl+F9)
+Switch to Next Desktop=none
+Switch to Next Keyboard Layout=default(Alt+Ctrl+K)
+Switch to Previous Desktop=none
+Toggle Showing Desktop=default(Alt+Ctrl+D)
+Toggle Window Raise/Lower=none
+Walk Through Desktop List=default(Ctrl+Tab)
+Walk Through Desktop List (Reverse)=default(Ctrl+Shift+Tab)
+Walk Through Desktops=none
+Walk Through Desktops (Reverse)=none
+Walk Through Windows=default(Alt+Tab)
+Walk Through Windows (Reverse)=default(Alt+Shift+Tab)
+Window Above Other Windows=none
+Window Below Other Windows=none
+Window Close=default(Alt+F4)
+Window Fullscreen=none
+Window Grow Horizontal=none
+Window Grow Vertical=none
+Window Lower=none
+Window Maximize=none
+Window Maximize Horizontal=none
+Window Maximize Vertical=none
+Window Minimize=none
+Window Move=none
+Window No Border=none
+Window On All Desktops=none
+Window One Desktop Down=none
+Window One Desktop Up=none
+Window One Desktop to the Left=none
+Window One Desktop to the Right=none
+Window Operations Menu=default(Alt+F3)
+Window Pack Down=none
+Window Pack Left=none
+Window Pack Right=none
+Window Pack Up=none
+Window Raise=none
+Window Resize=none
+Window Screenshot=default(Alt+Print)
+Window Shade=none
+Window Shrink Horizontal=none
+Window Shrink Vertical=none
+Window to Desktop 1=none
+Window to Desktop 10=none
+Window to Desktop 11=none
+Window to Desktop 12=none
+Window to Desktop 13=none
+Window to Desktop 14=none
+Window to Desktop 15=none
+Window to Desktop 16=none
+Window to Desktop 17=none
+Window to Desktop 18=none
+Window to Desktop 19=none
+Window to Desktop 2=none
+Window to Desktop 20=none
+Window to Desktop 3=none
+Window to Desktop 4=none
+Window to Desktop 5=none
+Window to Desktop 6=none
+Window to Desktop 7=none
+Window to Desktop 8=none
+Window to Desktop 9=none
+Window to Next Desktop=none
+Window to Previous Desktop=none
+
+[KDE]
+ShowDeleteCommand=false
+
+[Paths]
+Trash=$HOME/Desktop/.Trash/
+
+[WM]
+activeFont=Baghdad,12,-1,5,50,0,0,0,0,0
diff -Nurd kdelibs-3.5.9/darwin/knotifyrc kdelibs-3.5.9-new/darwin/knotifyrc
--- kdelibs-3.5.9/darwin/knotifyrc	1969-12-31 19:00:00.000000000 -0500
+++ kdelibs-3.5.9-new/darwin/knotifyrc	2008-02-13 21:00:34.000000000 -0500
@@ -0,0 +1,5 @@
+[Misc]
+External player=@FINKPREFIX@/bin/mplayer
+LastConfiguredApp=knotify
+Use external player=false
+Volume=100
diff -Nurd kdelibs-3.5.9/darwin/konsolerc kdelibs-3.5.9-new/darwin/konsolerc
--- kdelibs-3.5.9/darwin/konsolerc	1969-12-31 19:00:00.000000000 -0500
+++ kdelibs-3.5.9-new/darwin/konsolerc	2008-02-13 21:00:34.000000000 -0500
@@ -0,0 +1,19 @@
+[Desktop Entry]
+ActiveSession=0
+AutoResizeTabs=false
+DefaultSession=shell.desktop
+DynamicTabHide=false
+Fullscreen=false
+Height 832=510
+TabViewMode=0
+Width 1280=927
+bellmode=0
+class=konsole-mainwindow#1
+defaultfont=Monaco CY,12,-1,5,50,0,0,0,0,0
+font=8
+history=1000
+historyenabled=true
+keytab=default
+schema=Linux.schema
+scrollbar=2
+tabbar=2
diff -Nurd kdelibs-3.5.9/dcop/dcopc.c kdelibs-3.5.9-new/dcop/dcopc.c
--- kdelibs-3.5.9/dcop/dcopc.c	2006-05-22 14:14:21.000000000 -0400
+++ kdelibs-3.5.9-new/dcop/dcopc.c	2008-02-13 21:00:34.000000000 -0500
@@ -674,6 +674,9 @@
   while((i = strchr(displayName, ':')) != NULL)
      *i = '_';
 
+  while((i = strchr(displayName, '/')) != NULL)
+     *i = '_';
+
   dcopServer = getenv("DCOPSERVER");
 
   if (NULL == dcopServer) {
diff -Nurd kdelibs-3.5.9/dcop/dcopclient.cpp kdelibs-3.5.9-new/dcop/dcopclient.cpp
--- kdelibs-3.5.9/dcop/dcopclient.cpp	2007-10-08 05:52:08.000000000 -0400
+++ kdelibs-3.5.9-new/dcop/dcopclient.cpp	2008-02-13 21:00:34.000000000 -0500
@@ -270,6 +270,8 @@
     {
         while( (i = disp.find(KPATH_SEPARATOR)) >= 0)
             disp[i] = '_';
+        while( (i = disp.find('/')) >= 0)
+            disp[i] = '_';
     }
 
     fName += "/.DCOPserver_";
diff -Nurd kdelibs-3.5.9/dcop/dcopserver_shutdown.c kdelibs-3.5.9-new/dcop/dcopserver_shutdown.c
--- kdelibs-3.5.9/dcop/dcopserver_shutdown.c	2005-10-10 11:06:13.000000000 -0400
+++ kdelibs-3.5.9-new/dcop/dcopserver_shutdown.c	2008-02-13 21:00:34.000000000 -0500
@@ -118,6 +118,8 @@
   strncat(dcop_file_old,display, n);
   while((i = strchr(display, ':')))
      *i = '_';
+  while((i = strchr(display, '/')))
+     *i = '_';
   strncat(dcop_file, display, n);
   free(display);
 
diff -Nurd kdelibs-3.5.9/kdecore/Makefile.am kdelibs-3.5.9-new/kdecore/Makefile.am
--- kdelibs-3.5.9/kdecore/Makefile.am	2006-10-01 13:33:38.000000000 -0400
+++ kdelibs-3.5.9-new/kdecore/Makefile.am	2008-02-13 21:00:34.000000000 -0500
@@ -24,7 +24,7 @@
 
 if include_SVGICONS
 SVGICONS=svgicons
-SVGICON_LIB=svgicons/libkdesvgicons.la
+SVGICON_LIB=svgicons/libkdesvgicons.la $(LIBZ)
 endif
 
 SUBDIRS = malloc network $(SVGICONS) . kconfig_compiler tests
@@ -116,7 +116,7 @@
 	kqiodevicegzip_p.cpp ktimezones.cpp
 
 libkdecore_la_LDFLAGS = $(QT_LDFLAGS) $(KDE_RPATH) $(KDE_MT_LDFLAGS) $(X_LDFLAGS) $(USER_LDFLAGS) -version-info 6:0:2 -no-undefined
-libkdecore_la_LIBADD = malloc/libklmalloc.la network/libkdecorenetwork.la $(SVGICON_LIB) ../dcop/libDCOP.la ../libltdl/libltdlc.la $(LIB_XEXT) $(LIBRESOLV) $(LIBUTIL) $(LIBART_LIBS) $(LIB_IDN) ../kdefx/libkdefx.la
+libkdecore_la_LIBADD = malloc/libklmalloc.la network/libkdecorenetwork.la $(SVGICON_LIB) ../dcop/libDCOP.la ../libltdl/libltdlc.la $(LIB_XEXT) $(LIBRESOLV) $(LIBUTIL) $(LIBART_LIBS) $(LIB_IDN) ../kdefx/libkdefx.la $(LIBZ)
 libkdecore_la_NMCHECK = $(srcdir)/libkdecore.nmcheck
 libkdecore_la_NMCHECKWEAK = $(srcdir)/libkdecore_weak.nmcheck $(srcdir)/libqt-mt_weak.nmcheck \
 	$(top_srcdir)/dcop/libDCOP_weak.nmcheck $(top_srcdir)/kdecore/standard_weak.nmcheck
diff -Nurd kdelibs-3.5.9/kdecore/kglobalsettings.cpp kdelibs-3.5.9-new/kdecore/kglobalsettings.cpp
--- kdelibs-3.5.9/kdecore/kglobalsettings.cpp	2005-10-10 11:06:03.000000000 -0400
+++ kdelibs-3.5.9-new/kdecore/kglobalsettings.cpp	2008-02-13 21:00:34.000000000 -0500
@@ -491,7 +491,7 @@
       s_desktopPath->append('/');
 
     // Trash Path - TODO remove in KDE4 (kio_trash can't use it for interoperability reasons)
-    *s_trashPath = *s_desktopPath + i18n("Trash") + "/";
+    *s_trashPath = *s_desktopPath + "." + i18n("Trash") + "/";
     *s_trashPath = g.readPathEntry( "Trash" , *s_trashPath);
     *s_trashPath = QDir::cleanDirPath( *s_trashPath );
     if ( !s_trashPath->endsWith("/") )
diff -Nurd kdelibs-3.5.9/kdecore/ksocks.cpp kdelibs-3.5.9-new/kdecore/ksocks.cpp
--- kdelibs-3.5.9/kdecore/ksocks.cpp	2005-10-10 11:06:03.000000000 -0400
+++ kdelibs-3.5.9-new/kdecore/ksocks.cpp	2008-02-13 21:00:34.000000000 -0500
@@ -480,7 +480,7 @@
                                                    ksocklen_t addrlen) {
    if (_useSocks && F_connect)
       return (*F_connect)(sockfd, serv_addr, addrlen);
-   else return ::connect(sockfd, (sockaddr*) serv_addr, (socklen_t)addrlen);
+   else return ::connect(sockfd, (sockaddr*) serv_addr, (ksocklen_t)addrlen);
 }
 
 
@@ -503,7 +503,7 @@
    if (_useSocks && F_recvfrom) {
       return (*F_recvfrom)(s, buf, len, flags, from, fromlen);
    } else {
-      socklen_t casted_len = (socklen_t) *fromlen;
+      kde_socklen_t casted_len = (kde_socklen_t) *fromlen;
       int rc = ::recvfrom(s, (char*) buf, len, flags, from, &casted_len);
       *fromlen = casted_len;
       return rc;
@@ -515,7 +515,7 @@
                              const sockaddr *to, ksocklen_t tolen) {
    if (_useSocks && F_sendto)
       return (*F_sendto)(s, msg, len, flags, to, tolen);
-   else return ::sendto(s, (char*) msg, len, flags, to, (socklen_t)tolen);
+   else return ::sendto(s, (char*) msg, len, flags, to, (ksocklen_t)tolen);
 }
 
 
@@ -537,7 +537,7 @@
    if (_useSocks && F_getsockname) {
       return (*F_getsockname)(s, name, namelen);
    } else {
-     socklen_t casted_len = *namelen;
+     kde_socklen_t casted_len = *namelen;
      int rc = ::getsockname(s, name, &casted_len);
      *namelen = casted_len;
      return rc;
@@ -549,7 +549,7 @@
    if (_useSocks && F_getpeername) {
       return (*F_getpeername)(s, name, namelen);
    } else {
-      socklen_t casted_len = *namelen;
+      kde_socklen_t casted_len = *namelen;
       int rc = ::getpeername(s, name, &casted_len);
       *namelen = casted_len;
       return rc;
@@ -561,7 +561,7 @@
    if (_useSocks && F_accept) {
      return (*F_accept)(s, addr, addrlen);
    } else {
-      socklen_t casted_len = *addrlen;
+      kde_socklen_t casted_len = *addrlen;
       int rc = ::accept(s, addr, &casted_len);
       *addrlen = casted_len;
       return rc;
@@ -587,13 +587,13 @@
 int KSocks::bind (int sockfd, const sockaddr *my_addr, ksocklen_t addrlen) {
    if (_useSocks && F_bind)
       return (*F_bind)(sockfd, my_addr, addrlen);
-   else return ::bind(sockfd, my_addr, (socklen_t)addrlen);
+   else return ::bind(sockfd, my_addr, (ksocklen_t)addrlen);
 }
 
 int KSocks::bind (int sockfd, sockaddr *my_addr, ksocklen_t addrlen) {
    if (_useSocks && F_bind)
       return (*F_bind)(sockfd, my_addr, addrlen);
-   else return ::bind(sockfd, my_addr, (socklen_t)addrlen);
+   else return ::bind(sockfd, my_addr, (ksocklen_t)addrlen);
 }
 
 
diff -Nurd kdelibs-3.5.9/kdecore/kstandarddirs.cpp kdelibs-3.5.9-new/kdecore/kstandarddirs.cpp
--- kdelibs-3.5.9/kdecore/kstandarddirs.cpp	2008-02-13 04:41:08.000000000 -0500
+++ kdelibs-3.5.9-new/kdecore/kstandarddirs.cpp	2008-02-13 21:00:34.000000000 -0500
@@ -1021,7 +1021,7 @@
     if (!strcmp(type, "data"))
 	return "share/apps/";
     if (!strcmp(type, "html"))
-	return "share/doc/HTML/";
+	return "share/doc/kde/";
     if (!strcmp(type, "icon"))
 	return "share/icons/";
     if (!strcmp(type, "config"))
diff -Nurd kdelibs-3.5.9/kdecore/kuniqueapplication.cpp kdelibs-3.5.9-new/kdecore/kuniqueapplication.cpp
--- kdelibs-3.5.9/kdecore/kuniqueapplication.cpp	2005-11-08 17:39:22.000000000 -0500
+++ kdelibs-3.5.9-new/kdecore/kuniqueapplication.cpp	2008-02-13 21:00:34.000000000 -0500
@@ -59,6 +59,10 @@
 #  endif
 #endif
 
+#ifdef __APPLE__
+#include <crt_externs.h>
+#endif
+
 bool KUniqueApplication::s_nofork = false;
 bool KUniqueApplication::s_multipleInstances = false;
 bool KUniqueApplication::s_uniqueTestDone = false;
@@ -123,7 +127,7 @@
         startKdeinit();
         if(dcopClient()->registerAs(appName, false).isEmpty()) {
            kdError() << "KUniqueApplication: Can't setup DCOP communication." << endl;
-           ::exit(255);
+           ::_exit(255);
         }           
      }
 #endif
@@ -131,19 +135,52 @@
      // We'll call newInstance in the constructor. Do nothing here.
      return true;
   }
+
+#ifdef Q_OS_DARWIN
+  else {
+    // we need to reexec ourselves because of stupid OSX crap crappity crap
+    int argc = *_NSGetArgc();
+    char ** argv = *_NSGetArgv();
+    char * newargv[argc+2];
+
+    for (int i = 0; i < argc; i++) {
+      newargv[i] = argv[i];
+    }
+    newargv[argc] = "--nofork";
+    newargv[argc+1] = NULL;
+
+    int fork_result = fork();
+    switch(fork_result) {
+      case -1:
+        kdError() << "KUniqueAPplication: Mac OS X workaround fork() failed!" << endl;
+        ::_exit(255);
+        break;
+      case 0:
+        // Child
+        execvp(argv[0], newargv);
+        break;
+      default:
+        // Parent
+        _exit(0);
+        break;
+    }
+  }
+#endif
+
   DCOPClient *dc;
   int fd[2];
   signed char result;
   if (0 > pipe(fd))
   {
      kdError() << "KUniqueApplication: pipe() failed!" << endl;
-     ::exit(255);
+     ::_exit(255);
   }
+
   int fork_result = fork();
   switch(fork_result) {
   case -1:
      kdError() << "KUniqueApplication: fork() failed!" << endl;
-     ::exit(255);
+     ::_exit(255);
      break;
   case 0:
      // Child
@@ -161,7 +198,7 @@
               kdError() << "KUniqueApplication: Can't determine DISPLAY. Aborting." << endl;
               result = -1; // Error
               ::write(fd[1], &result, 1);
-              ::exit(255);
+              ::_exit(255);
            }
 
            // Try to launch kdeinit.
@@ -173,7 +210,7 @@
               result = -1;
               delete dc;	// Clean up DCOP commmunication
               ::write(fd[1], &result, 1);
-              ::exit(255);
+              ::_exit(255);
            }
         }
         if (regName != appName)
@@ -247,25 +284,25 @@
        if (n == 0)
        {
           kdError() << "KUniqueApplication: Pipe closed unexpectedly." << endl;
-          ::exit(255);
+          ::_exit(255);
        }
        if (errno != EINTR)
        {
           kdError() << "KUniqueApplication: Error reading from pipe." << endl;
-          ::exit(255);
+          ::_exit(255);
        }
      }
      ::close(fd[0]);
 
      if (result != 0)
-        ::exit(result); // Error occurred in child.
+        ::_exit(result); // Error occurred in child.
 
      dc = new DCOPClient();
      if (!dc->attach())
      {
         kdError() << "KUniqueApplication: Parent process can't attach to DCOP." << endl;
         delete dc;	// Clean up DCOP commmunication
-        ::exit(255);
+        ::_exit(255);
      }
      if (!dc->isApplicationRegistered(appName)) {
         kdError() << "KUniqueApplication: Registering failed!" << endl;
@@ -294,20 +331,20 @@
      {
         kdError() << "Communication problem with " << KCmdLineArgs::about->appName() << ", it probably crashed." << endl;
         delete dc;	// Clean up DCOP commmunication
-        ::exit(255);
+        ::_exit(255);
      }
      dc->setPriorityCall(false);
      if (replyType != "int")
      {
         kdError() << "KUniqueApplication: DCOP communication error!" << endl;
         delete dc;	// Clean up DCOP commmunication
-        ::exit(255);
+        ::_exit(255);
      }
      QDataStream rs(reply, IO_ReadOnly);
      int exitCode;
      rs >> exitCode;
      delete dc;	// Clean up DCOP commmunication
-     ::exit(exitCode);
+     ::_exit(exitCode);
      break;
   }
   return false; // make insure++ happy
@@ -361,7 +398,7 @@
   }
   if( !start())
          // Already running
-      ::exit( 0 );
+      ::_exit( 0 );
   return inst;
 }
 
diff -Nurd kdelibs-3.5.9/kdecore/network/ksocketdevice.cpp kdelibs-3.5.9-new/kdecore/network/ksocketdevice.cpp
--- kdelibs-3.5.9/kdecore/network/ksocketdevice.cpp	2007-01-15 06:34:17.000000000 -0500
+++ kdelibs-3.5.9-new/kdecore/network/ksocketdevice.cpp	2008-02-13 21:00:34.000000000 -0500
@@ -316,7 +316,7 @@
     }
 
   struct sockaddr sa;
-  socklen_t len = sizeof(sa);
+  kde_socklen_t len = sizeof(sa);
   int newfd = kde_accept(m_sockfd, &sa, &len);
   if (newfd == -1)
     {
@@ -390,7 +390,7 @@
 
 static int do_read_common(int sockfd, char *data, Q_ULONG maxlen, KSocketAddress* from, ssize_t &retval, bool peek = false)
 {
-  socklen_t len;
+  kde_socklen_t len;
   if (from)
     {
       from->setLength(len = 128); // arbitrary length
@@ -535,7 +535,7 @@
   if (d->local.family() != AF_UNSPEC)
     return d->local;
 
-  socklen_t len;
+  kde_socklen_t len;
   KSocketAddress localAddress;
   localAddress.setLength(len = 32);	// arbitrary value
   if (kde_getsockname(m_sockfd, localAddress.address(), &len) == -1)
@@ -571,7 +571,7 @@
   if (d->peer.family() != AF_UNSPEC)
     return d->peer;
 
-  socklen_t len;
+  kde_socklen_t len;
   KSocketAddress peerAddress;
   peerAddress.setLength(len = 32);	// arbitrary value
   if (kde_getpeername(m_sockfd, peerAddress.address(), &len) == -1)
diff -Nurd kdelibs-3.5.9/kdecore/network/syssocket.h kdelibs-3.5.9-new/kdecore/network/syssocket.h
--- kdelibs-3.5.9/kdecore/network/syssocket.h	2005-09-10 04:27:10.000000000 -0400
+++ kdelibs-3.5.9-new/kdecore/network/syssocket.h	2008-02-13 21:00:34.000000000 -0500
@@ -53,7 +53,7 @@
   }
 
   // bind
-  inline int kde_bind(int fd, const struct sockaddr* sa, socklen_t len)
+  inline int kde_bind(int fd, const struct sockaddr* sa, kde_socklen_t len)
   {
     return ::bind(fd, sa, len);
   }
@@ -65,25 +65,25 @@
   }
 
   // connect
-  inline int kde_connect(int fd, const struct sockaddr* sa, socklen_t len)
+  inline int kde_connect(int fd, const struct sockaddr* sa, kde_socklen_t len)
   {
     return ::connect(fd, (struct sockaddr*)sa, len);
   }
 
   // accept
-  inline int kde_accept(int fd, struct sockaddr* sa, socklen_t* len)
+  inline int kde_accept(int fd, struct sockaddr* sa, kde_socklen_t* len)
   {
     return ::accept(fd, sa, len);
   }
 
   // getpeername
-  inline int kde_getpeername(int fd, struct sockaddr* sa, socklen_t* len)
+  inline int kde_getpeername(int fd, struct sockaddr* sa, kde_socklen_t* len)
   {
     return ::getpeername(fd, sa, len);
   }
 
   // getsockname
-  inline int kde_getsockname(int fd, struct sockaddr* sa, socklen_t* len)
+  inline int kde_getsockname(int fd, struct sockaddr* sa, kde_socklen_t* len)
   {
     return ::getsockname(fd, sa, len);
   }
diff -Nurd kdelibs-3.5.9/kded/Makefile.am kdelibs-3.5.9-new/kded/Makefile.am
--- kdelibs-3.5.9/kded/Makefile.am	2005-10-10 11:06:29.000000000 -0400
+++ kdelibs-3.5.9-new/kded/Makefile.am	2008-02-13 21:00:34.000000000 -0500
@@ -58,7 +58,10 @@
 servicetype_DATA = kdedmodule.desktop
 servicetypedir = $(kde_servicetypesdir)
 
-xdg_menu_DATA = applications.menu
+kde-applications.menu: applications.menu
+	cat applications.menu > kde-applications.menu
+
+xdg_menu_DATA = kde-applications.menu
 
 update_DATA = kded.upd
 updatedir = $(kde_datadir)/kconf_update
diff -Nurd kdelibs-3.5.9/kded/kbuildsycoca.cpp kdelibs-3.5.9-new/kded/kbuildsycoca.cpp
--- kdelibs-3.5.9/kded/kbuildsycoca.cpp	2007-05-14 03:52:43.000000000 -0400
+++ kdelibs-3.5.9-new/kded/kbuildsycoca.cpp	2008-02-13 21:00:34.000000000 -0500
@@ -379,7 +379,11 @@
      connect(g_vfolder, SIGNAL(newService(const QString &, KService **)),
              this, SLOT(slotCreateEntry(const QString &, KService **)));
              
-     VFolderMenu::SubMenu *kdeMenu = g_vfolder->parseMenu("applications.menu", true);
+     VFolderMenu::SubMenu *kdeMenu;
+     if ( QFile::exists( "@FINKPREFIX@/etc/xdg/menus/kde-applications.menu" ) )
+       kdeMenu = g_vfolder->parseMenu("kde-applications.menu", true);
+     else
+       kdeMenu = g_vfolder->parseMenu("applications.menu", true);
 
      KServiceGroup *entry = g_bsgf->addNew("/", kdeMenu->directoryFile, 0, false);
      entry->setLayoutInfo(kdeMenu->layoutList);
diff -Nurd kdelibs-3.5.9/kdeprint/configure.in.in kdelibs-3.5.9-new/kdeprint/configure.in.in
--- kdelibs-3.5.9/kdeprint/configure.in.in	2005-09-10 04:27:43.000000000 -0400
+++ kdelibs-3.5.9-new/kdeprint/configure.in.in	2008-02-13 21:00:34.000000000 -0500
@@ -80,7 +80,7 @@
 
       dnl check if CUPS is at least 1.1.20
       ac_have_new_cups="no"
-      AC_CHECK_CUPS_VERSION(1.0120)
+      AC_CHECK_CUPS_VERSION(1.0121)
       if test "$ac_have_new_cups" = "yes"; then
  	AC_DEFINE(HAVE_CUPS_NO_PWD_CACHE, 1, CUPS doesn't have password caching)
       fi
diff -Nurd kdelibs-3.5.9/kdeprint/cups/Makefile.am kdelibs-3.5.9-new/kdeprint/cups/Makefile.am
--- kdelibs-3.5.9/kdeprint/cups/Makefile.am	2006-10-02 06:46:55.000000000 -0400
+++ kdelibs-3.5.9-new/kdeprint/cups/Makefile.am	2008-02-13 21:00:34.000000000 -0500
@@ -14,8 +14,8 @@
 				  imagepreview.cpp imageposition.cpp kpimagepage.cpp \
 				  kptextpage.cpp kphpgl2page.cpp cupsaddsmb2.cpp kmwother.cpp ippreportdlg.cpp \
 				  kptagspage.cpp
-kdeprint_cups_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined
-kdeprint_cups_la_LIBADD = $(top_builddir)/kdeprint/management/libkdeprint_management.la $(LIB_KIO) $(LIB_CUPS) $(top_builddir)/kdecore/libkdefakes.la
+kdeprint_cups_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined $(LIB_CUPS)
+kdeprint_cups_la_LIBADD = $(top_builddir)/kdeprint/management/libkdeprint_management.la $(LIB_KIO) $(top_builddir)/kdecore/libkdefakes.la
 kdeprint_cups_la_METASOURCES = AUTO
 
 noinst_HEADERS = cupsinfos.h ipprequest.h kmcupsjobmanager.h kmcupsmanager.h kmcupsuimanager.h \
diff -Nurd kdelibs-3.5.9/kdeprint/cups/cupsdconf2/Makefile.am kdelibs-3.5.9-new/kdeprint/cups/cupsdconf2/Makefile.am
--- kdelibs-3.5.9/kdeprint/cups/cupsdconf2/Makefile.am	2005-09-10 04:27:41.000000000 -0400
+++ kdelibs-3.5.9-new/kdeprint/cups/cupsdconf2/Makefile.am	2008-02-13 21:00:34.000000000 -0500
@@ -14,8 +14,8 @@
 			  locationdialog.cpp addressdialog.cpp cups-util.c \
 			  qdirmultilineedit.cpp sizewidget.cpp main.cpp
 cupsdconf_la_METASOURCES = AUTO
-cupsdconf_la_LDFLAGS = -avoid-version -module $(all_libraries) $(KDE_RPATH)
-cupsdconf_la_LIBADD = $(LIB_KIO) $(LIB_CUPS)
+cupsdconf_la_LDFLAGS = -avoid-version -module $(all_libraries) $(KDE_RPATH) $(LIB_CUPS)
+cupsdconf_la_LIBADD = $(LIB_KIO)
 
 noinst_HEADERS = cupsdconf.h cupsdpage.h cupsddialog.h cupsdcomment.h cupsdsplash.h \
 		 cupsdserverpage.h cupsdlogpage.h cupsdjobspage.h cupsdfilterpage.h \
diff -Nurd kdelibs-3.5.9/kdeui/Makefile.am kdelibs-3.5.9-new/kdeui/Makefile.am
--- kdelibs-3.5.9/kdeui/Makefile.am	2007-10-08 05:52:12.000000000 -0400
+++ kdelibs-3.5.9-new/kdeui/Makefile.am	2008-02-13 21:00:34.000000000 -0500
@@ -27,10 +27,10 @@
 AM_LDFLAGS = $(LDFLAGS_AS_NEEDED) $(LDFLAGS_NEW_DTAGS)
 
 lib_LTLIBRARIES = libkdeui.la libkspell.la
-libkdeui_la_LDFLAGS = $(KDE_MT_LDFLAGS) -no-undefined -version-info 6:0:2
+libkdeui_la_LDFLAGS = $(KDE_MT_LDFLAGS) $(all_libraries) -no-undefined -version-info 6:0:2
 libkdeui_la_LIBADD = ../kdecore/libkdecore.la
 
-libkspell_la_LDFLAGS = $(KDE_MT_LDFLAGS) -version-info 6:0:2 -no-undefined
+libkspell_la_LDFLAGS = $(KDE_MT_LDFLAGS) $(all_libraries) -version-info 6:0:2 -no-undefined
 libkspell_la_LIBADD = libkdeui.la
 libkspell_la_SOURCES = dummy.cpp
 
diff -Nurd kdelibs-3.5.9/kimgio/Makefile.am kdelibs-3.5.9-new/kimgio/Makefile.am
--- kdelibs-3.5.9/kimgio/Makefile.am	2005-09-10 04:26:42.000000000 -0400
+++ kdelibs-3.5.9-new/kimgio/Makefile.am	2008-02-13 21:00:34.000000000 -0500
@@ -21,7 +21,7 @@
              kimg_pcx.la kimg_tga.la kimg_rgb.la kimg_xcf.la kimg_dds.la $(KIMGIO_EXR_MODULES) \
 			 kimg_psd.la kimg_hdr.la
 
-KIMGIO_PLUGIN = -avoid-version -export-symbols-regex 'kimgio_.*_(read|write)'
+KIMGIO_PLUGIN = -avoid-version
 
 kimg_tiff_la_SOURCES = tiffr.cpp
 kimg_tiff_la_LDFLAGS = -module $(KIMGIO_PLUGIN) -no-undefined $(all_libraries)
diff -Nurd kdelibs-3.5.9/kinit/Makefile.am kdelibs-3.5.9-new/kinit/Makefile.am
--- kdelibs-3.5.9/kinit/Makefile.am	2007-10-08 05:52:03.000000000 -0400
+++ kdelibs-3.5.9-new/kinit/Makefile.am	2008-02-13 21:00:34.000000000 -0500
@@ -15,7 +15,7 @@
 #    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 #    Boston, MA 02110-1301, USA.
 
-INCLUDES = -I$(srcdir)/../libltdl/ $(all_includes) $(KDEINIT_XFT_INCLUDES)
+INCLUDES = -I$(srcdir)/../libltdl/ $(KDEINIT_XFT_INCLUDES) $(all_includes)
 
 SUBDIRS = . tests
 
diff -Nurd kdelibs-3.5.9/kinit/kinit.cpp kdelibs-3.5.9-new/kinit/kinit.cpp
--- kdelibs-3.5.9/kinit/kinit.cpp	2007-10-08 05:52:03.000000000 -0400
+++ kdelibs-3.5.9-new/kinit/kinit.cpp	2008-02-13 21:00:34.000000000 -0500
@@ -593,6 +593,11 @@
      if ( getenv("KDE_IS_PRELINKED") && !execpath.isEmpty() && !launcher)
          libpath.truncate(0);
 
+#ifdef Q_OS_DARWIN
+     if (!execpath.isEmpty())
+         libpath.truncate(0);
+#endif
+
      if ( !libpath.isEmpty() )
      {
        d.handle = lt_dlopen( QFile::encodeName(libpath) );
diff -Nurd kdelibs-3.5.9/kinit/start_kdeinit_wrapper.c kdelibs-3.5.9-new/kinit/start_kdeinit_wrapper.c
--- kdelibs-3.5.9/kinit/start_kdeinit_wrapper.c	2008-02-13 04:41:06.000000000 -0500
+++ kdelibs-3.5.9-new/kinit/start_kdeinit_wrapper.c	2008-02-13 21:01:39.000000000 -0500
@@ -50,9 +50,9 @@
          close( 0 ); /* stdin */
          dup2( pipes[ 0 ], 0 );
          close( pipes[ 0 ] );
-         argv[ 0 ] = (char*)"start_kdeinit";
-         execvp("start_kdeinit", argv);
-         perror("start_kdeinit");
+         argv[ 0 ] = (char*)"@FINKPREFIX@/bin/start_kdeinit";
+         execvp("@FINKPREFIX@/bin/start_kdeinit", argv);
+         perror("@FINKPREFIX@/bin/start_kdeinit");
          return 1;
       case 0: { /* child, pass env and exit */
          extern char** environ;
@@ -84,9 +84,9 @@
 {
    if(argc == 0)
       return 1;
-   argv[0] = "start_kdeinit";
-   execvp("start_kdeinit",argv);
-   perror("start_kdeinit");
+   argv[0] = "@FINKPREFIX@/bin/start_kdeinit";
+   execvp("@FINKPREFIX@/bin/start_kdeinit",argv);
+   perror("@FINKPREFIX@/bin/start_kdeinit");
    return 1;
 }
 #endif
diff -Nurd kdelibs-3.5.9/kio/kssl/kopenssl.cc kdelibs-3.5.9-new/kio/kssl/kopenssl.cc
--- kdelibs-3.5.9/kio/kssl/kopenssl.cc	2006-07-22 04:16:39.000000000 -0400
+++ kdelibs-3.5.9-new/kio/kssl/kopenssl.cc	2008-02-13 21:00:34.000000000 -0500
@@ -323,6 +323,7 @@
              #elif defined(_AIX)
              << "libssl.a(libssl.so.0)"
 	     #elif defined(__APPLE__)
+	     << "libssl.0.9.7.dylib"
 	     << "libssl.dylib"
 	     << "libssl.0.9.dylib"
              #else
@@ -340,6 +341,7 @@
              #elif defined(_AIX)
              << "libcrypto.a(libcrypto.so.0)"
 	     #elif defined(__APPLE__)
+	     << "libcrypto.0.9.7.dylib"
 	     << "libcrypto.dylib"
 	     << "libcrypto.0.9.dylib"
 	     #else
diff -Nurd kdelibs-3.5.9/kio/misc/kpac/Makefile.am kdelibs-3.5.9-new/kio/misc/kpac/Makefile.am
--- kdelibs-3.5.9/kio/misc/kpac/Makefile.am	2005-09-10 04:26:47.000000000 -0400
+++ kdelibs-3.5.9-new/kio/misc/kpac/Makefile.am	2008-02-13 21:00:34.000000000 -0500
@@ -10,7 +10,7 @@
 kded_proxyscout_la_SOURCES = proxyscout.skel proxyscout.cpp script.cpp \
                              downloader.cpp discovery.cpp
 kded_proxyscout_la_LDFLAGS = $(all_libraries) -module -avoid-version
-kded_proxyscout_la_LIBADD = $(LIB_KIO) $(top_builddir)/kjs/libkjs.la $(LIB_KDED)
+kded_proxyscout_la_LIBADD = $(LIB_KIO) $(top_builddir)/kjs/libkjs.la $(LIB_KDED) $(LIBRESOLV)
 
 kpac_dhcp_helper_SOURCES = kpac_dhcp_helper.c
 kpac_dhcp_helper_CFLAGS = $(KDE_USE_FPIE)
