Branch: master

7cd4adc9 2014-10-05 15:59:23 Timothy Pearson
Add proper refcounting option to TDEMainWindow
This relates to the discussion at:
http://lists.kde.org/?l=kde-core-devel&m=107208785431497&w=2
Clean up a few minor code formatting issues
M tdecore/ksock.cpp
M tdecore/ksock.h
M tdeui/kguiitem.cpp
M tdeui/kguiitem.h
M tdeui/tdemainwindow.cpp
M tdeui/tdemainwindow.h
diff --git a/tdecore/ksock.cpp b/tdecore/ksock.cpp
index 57bfc26..3f4886b 100644
--- a/tdecore/ksock.cpp
+++ b/tdecore/ksock.cpp
@@ -20,8 +20,6 @@
  *  Boston, MA 02110-1301, USA.
  **/
 
-#define KSOCK_INTERNAL_C_COMPILATION 1
-
 #include <config.h>
 
 #include <sys/types.h>
@@ -42,7 +40,12 @@
 
 #define KSOCK_NO_BROKEN
 #include "kdebug.h"
+// FIXME
+// FOR BINARY COMPATIBILITY ONLY
+// REMOVE WHEN PRACTICAL!
+#define TDESOCKET_BINARY_COMPAT_HACK 1
 #include "ksock.h"
+#undef TDESOCKET_BINARY_COMPAT_HACK
 #include "kextsock.h"
 #include "ksockaddr.h"
 
diff --git a/tdecore/ksock.h b/tdecore/ksock.h
index 422e69b..31ca099 100644
--- a/tdecore/ksock.h
+++ b/tdecore/ksock.h
@@ -342,10 +342,10 @@
     int sock;
 
 private:
-    // DEPRECATED
-#ifdef KSOCK_INTERNAL_C_COMPILATION
+    // HACK
+#ifdef TDESOCKET_BINARY_COMPAT_HACK
     KDE_EXPORT bool bindAndListen();
-#endif // KSOCK_INTERNAL_C_COMPILATION
+#endif // TDESOCKET_BINARY_COMPAT_HACK
 
     TDEServerSocket(const TDEServerSocket&);
     TDEServerSocket& operator=(const TDEServerSocket&);
diff --git a/tdeui/kguiitem.cpp b/tdeui/kguiitem.cpp
index dd30e1f..9d623bb 100644
--- a/tdeui/kguiitem.cpp
+++ b/tdeui/kguiitem.cpp
@@ -155,7 +155,7 @@
     {
         if( !d->m_iconName.isEmpty())
         {
-// some caching here would(?) come handy
+            // some caching here would(?) come handy
             return instance->iconLoader()->loadIconSet( d->m_iconName, group, size, true, false );
         }
         else
@@ -164,7 +164,9 @@
         }
     }
     else
+    {
         return TQIconSet();
+    }
 }
 
 TQString KGuiItem::iconName() const
diff --git a/tdeui/kguiitem.h b/tdeui/kguiitem.h
index 538275f..c2ab867 100644
--- a/tdeui/kguiitem.h
+++ b/tdeui/kguiitem.h
@@ -46,7 +46,7 @@
     // It gives the wrong impression that you just change the text.
     KGuiItem( const TQString &text, 
               const TQString &iconName  = TQString::null,
-              const TQString &toolTip   = TQString::null, 
+              const TQString &toolTip   = TQString::null,
               const TQString &whatsThis = TQString::null );
 
     KGuiItem( const TQString &text, const TQIconSet &iconSet, 
diff --git a/tdeui/tdemainwindow.cpp b/tdeui/tdemainwindow.cpp
index 51d873b..225b910 100644
--- a/tdeui/tdemainwindow.cpp
+++ b/tdeui/tdemainwindow.cpp
@@ -66,6 +66,7 @@
     bool autoSaveWindowSize:1;
     bool care_about_geometry:1;
     bool shuttingDown:1;
+    bool newStyleRefCounting:1;
     TQString autoSaveGroup;
     TDEAccel * tdeaccel;
     TDEMainWindowInterface *m_interface;
@@ -245,7 +246,7 @@
     d->shuttingDown = false;
     if ((d->care_about_geometry = being_first)) {
         being_first = false;
-        if ( kapp->geometryArgument().isNull() ) // if there is no geometry, it doesn't mater
+        if ( kapp->geometryArgument().isNull() ) // if there is no geometry, it doesn't matter
             d->care_about_geometry = false;
         else
             parseGeometry(false);
@@ -257,6 +258,14 @@
     else
         d->m_interface = new TDEMainWindowInterface(this);
 
+    if ( cflags & NewRefCountMode ) {
+        d->newStyleRefCounting = true;
+        kapp->ref();
+    }
+    else {
+        d->newStyleRefCounting = false;
+    }
+
     if (!kapp->authorize("movable_toolbars"))
         setDockWindowsMovable(false);
 }
diff --git a/tdeui/tdemainwindow.h b/tdeui/tdemainwindow.h
index f2898ab..856590a 100644
--- a/tdeui/tdemainwindow.h
+++ b/tdeui/tdemainwindow.h
@@ -151,7 +151,8 @@
      */
     enum CreationFlags
     {
-        NoDCOPObject = 1
+        NoDCOPObject = 1,
+        NewRefCountMode = 2
     };
 
     /**
03518d63 2014-10-05 16:00:42 Timothy Pearson
Merge branch 'master' of https://scm.trinitydesktop.org/scm/git/tdelibs
M CMakeLists.txt
M tdecore/CMakeLists.txt
M tdecore/kpty.cpp
M tdecore/network/kresolver.cpp
M tdecore/network/kresolver_p.h
M tdecore/tdeapplication.cpp
M tdeio/tdeio/connection.cpp
M tdeio/tdeio/kurlcompletion.cpp
M tdeioslave/file/file.cc
M tdeprint/cups/cupsdconf2/cupsddialog.cpp
M tdeprint/cups/kmcupsmanager.cpp
M tdestyles/kthemestyle/CMakeLists.txt
M tdeui/ksconfig.cpp
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7ee04b5..52ee5c1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -181,6 +181,12 @@
 check_include_file( "ndir.h" HAVE_NDIR_H )
 check_include_file( "netinet/in.h" HAVE_NETINET_IN_H )
 check_include_file( "net/if.h" HAVE_NET_IF_H )
+if( NOT HAVE_NET_IF_H )
+  find_path( NET_IF_PATH "net/if.h" )
+  if( NET_IF_PATH )
+    set( HAVE_NET_IF_H "1" )
+  endif( )
+endif( )
 check_include_file( "paths.h" HAVE_PATHS_H )
 check_include_file( "pty.h" HAVE_PTY_H )
 check_include_file( "stdint.h" HAVE_STDINT_H )
@@ -197,6 +203,12 @@
 check_include_file( "sys/mntent.h" HAVE_SYS_MNTENT_H )
 check_include_file( "sys/mnttab.h" HAVE_SYS_MNTTAB_H )
 check_include_file( "sys/mount.h" HAVE_SYS_MOUNT_H )
+if( NOT HAVE_SYS_MOUNT_H )
+  find_path( SYS_MOUNT_PATH "sys/mount.h" )
+  if( SYS_MOUNT_PATH )
+    set( HAVE_SYS_MOUNT_H "1" )
+  endif( )
+endif( )
 check_include_file( "sys/ndir.h" HAVE_SYS_NDIR_H )
 check_include_file( "sys/param.h" HAVE_SYS_PARAM_H )
 check_include_file( "sys/prctl.h" HAVE_SYS_PRCTL_H )
@@ -206,6 +218,12 @@
 check_include_file( "sys/stropts.h" HAVE_SYS_STROPTS_H )
 check_include_file( "sys/types.h" HAVE_SYS_TYPES_H )
 check_include_file( "sys/ucred.h" HAVE_SYS_UCRED_H )
+if( NOT HAVE_SYS_UCRED_H )
+  find_path( SYS_UCRED_PATH "sys/ucred.h" )
+  if( SYS_UCRED_PATH )
+    set( HAVE_SYS_UCRED_H "1" )
+  endif( )
+endif( )
 check_include_file( "sys/xattr.h" HAVE_SYS_XATTR_H )
 check_include_file( "termios.h" HAVE_TERMIOS_H )
 check_include_file( "termio.h" HAVE_TERMIO_H )
@@ -263,7 +281,7 @@
 check_symbol_exists( mkstemps "stdlib.h" HAVE_MKSTEMPS_PROTO )
 
 check_function_exists( initgroups HAVE_INITGROUPS )
-check_symbol_exists( initgroups "grp.h" HAVE_INITGROUPS_PROTO )
+check_symbol_exists( initgroups "grp.h;unistd.h" HAVE_INITGROUPS_PROTO )
 
 check_function_exists( strlcat HAVE_STRLCAT )
 check_symbol_exists( strlcat "string.h" HAVE_STRLCAT_PROTO )
@@ -305,6 +323,9 @@
 else (HAVE_ALLOCA_H )
   check_symbol_exists( alloca "stdlib.h" HAVE_ALLOCA )
 endif (HAVE_ALLOCA_H )
+if( ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" )
+  set( HAVE_ALLOCA 1 )
+endif( )
 
 check_function_exists( getmntinfo HAVE_GETMNTINFO )
 check_function_exists( getnameinfo HAVE_GETNAMEINFO )
@@ -475,10 +496,15 @@
 
 ##### check for libdl ###########################
 
-find_library( HAVE_LIBDL dl )
-if( NOT HAVE_LIBDL-NOTFOUND )
-  set( DL_LIBRARIES dl )
-endif( NOT HAVE_LIBDL-NOTFOUND )
+set( DL_LIBRARIES dl )
+check_library_exists( ${DL_LIBRARIES} dlopen /lib HAVE_LIBDL )
+if( NOT HAVE_LIBDL )
+  unset( DL_LIBRARIES )
+  check_function_exists( dlopen HAVE_DLOPEN )
+  if( HAVE_DLOPEN )
+    set( HAVE_LIBDL 1 )
+  endif( HAVE_DLOPEN )
+endif( NOT HAVE_LIBDL )
 
 
 ##### check for utempter ########################
diff --git a/tdecore/CMakeLists.txt b/tdecore/CMakeLists.txt
index 5133be8..508ca85 100644
--- a/tdecore/CMakeLists.txt
+++ b/tdecore/CMakeLists.txt
@@ -131,7 +131,7 @@
   EMBED tdecorenetwork-static tdehw-static
   LINK ltdlc-static ${KDESVGICONS} DCOP-shared tdefx-shared ${ZLIB_LIBRARIES}
     ${LIBIDN_LIBRARIES} ${XCOMPOSITE_LIBRARIES} ICE SM ${GAMIN_LIBRARIES}
-    ${LIBBFD_LIBRARIES}
+    ${LIBBFD_LIBRARIES} util
   DEPENDENCIES dcopidl dcopidl2cpp
   DESTINATION ${LIB_INSTALL_DIR}
 )
diff --git a/tdecore/kpty.cpp b/tdecore/kpty.cpp
index a942042..7f27f02 100644
--- a/tdecore/kpty.cpp
+++ b/tdecore/kpty.cpp
@@ -305,6 +305,17 @@
   if (d->masterFd >= 0)
     return true;
 
+#if defined(__OpenBSD__)
+  char cpty[16];
+
+  if (openpty(&d->masterFd, &d->slaveFd, cpty, NULL, &d->winSize) == 0) {
+    d->ttyName = cpty;
+  } else {
+    kdWarning(175) << "Can't open slave pseudo teletype" << endl;
+    return false;
+  }
+#else
+
   TQCString ptyName;
 
   // Find a master pty that we can open ////////////////////////////////
@@ -379,6 +390,7 @@
 
   kdWarning(175) << "KPty::open(): " << "Can't open a pseudo teletype" << endl;
 ** Diff limit reached (max: 250 lines) **