]> git.lyx.org Git - features.git/commitdiff
avoid deprecated functions on Mac - use Qt instead
authorStephan Witt <switt@lyx.org>
Sun, 23 Sep 2012 13:27:36 +0000 (15:27 +0200)
committerStephan Witt <switt@lyx.org>
Sun, 23 Sep 2012 14:06:56 +0000 (16:06 +0200)
src/Makefile.am
src/support/Makefile.am
src/support/Package.cpp
src/support/os_unix.cpp
src/tex2lyx/CMakeLists.txt

index 43edb946221f4cd266928abb4ba0a0ecaaa93563..d3c52f5e90a30d5a4313f944ced70787dfd5630a 100644 (file)
@@ -40,7 +40,7 @@ if LYX_WIN_RESOURCE
 endif
 
 if INSTALL_MACOSX
-lyx_LDFLAGS = -framework AppKit
+lyx_LDFLAGS = -framework AppKit -framework ApplicationServices
 endif
 
 #lyx_LDFLAGS=-Wl,-O1
index f7fad7c4cdc8b02c4070e16232416ce43a9d7d31..2418168f0e735db29abd20f56ad2eb56da5d2d31 100644 (file)
@@ -28,7 +28,7 @@ liblyxsupport_a_DEPENDENCIES = $(MOCEDFILES)
 ##################################################################
 
 AM_CPPFLAGS += $(PCH_FLAGS) -I$(srcdir)/.. $(BOOST_INCLUDES)
-AM_CPPFLAGS += $(QT4_CPPFLAGS) $(QT4_CORE_INCLUDES) 
+AM_CPPFLAGS += $(QT4_CPPFLAGS) $(QT4_INCLUDES)
 
 liblyxsupport_a_SOURCES = \
        FileMonitor.h \
index ec08a55b7be91ff6058a6185a83ecea416f662f5..a158b49d3ae73d7167e672d68ea60ebfd91d6bd5 100644 (file)
@@ -36,7 +36,9 @@
 #endif
 
 #if defined (USE_MACOSX_PACKAGING)
-# include <CoreServices/CoreServices.h> // FSFindFolder, FSRefMakePath
+# include "support/qstring_helpers.h"
+# include <QDir>
+# include <QDesktopServices>
 #endif
 
 using namespace std;
@@ -169,6 +171,8 @@ FileName const & Package::get_home_dir()
 {
 #if defined (USE_WINDOWS_PACKAGING)
        static FileName const home_dir(getEnv("USERPROFILE"));
+#elif defined (USE_MACOSX_PACKAGING)
+       static FileName const home_dir(fromqstr(QDir::homePath()));
 #else // Posix-like.
        static FileName const home_dir(getEnv("HOME"));
 #endif
@@ -370,6 +374,9 @@ FileName const get_document_dir(FileName const & home_dir)
        (void)home_dir; // Silence warning about unused variable.
        os::GetFolderPath win32_folder_path;
        return FileName(win32_folder_path(os::GetFolderPath::PERSONAL));
+#elif defined (USE_MACOSX_PACKAGING)
+       (void)home_dir; // Silence warning about unused variable.
+       return FileName(fromqstr(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation)));
 #else // Posix-like.
        return home_dir;
 #endif
@@ -635,23 +642,7 @@ FileName const get_default_user_support_dir(FileName const & home_dir)
 
 #elif defined (USE_MACOSX_PACKAGING)
        (void)home_dir; // Silence warning about unused variable.
-
-       FSRef fsref;
-       OSErr const error_code =
-               FSFindFolder(kUserDomain, kApplicationSupportFolderType,
-                            kDontCreateFolder, &fsref);
-       if (error_code != 0)
-               return FileName();
-
-       // FSRefMakePath returns the result in utf8
-       char store[PATH_MAX + 1];
-       OSStatus const status_code =
-               FSRefMakePath(&fsref,
-                             reinterpret_cast<UInt8*>(store), PATH_MAX);
-       if (status_code != 0)
-               return FileName();
-
-       return FileName(addPath(reinterpret_cast<char const *>(store), PACKAGE));
+       return FileName(addPath(fromqstr(QDesktopServices::storageLocation(QDesktopServices::DataLocation)), PACKAGE));
 
 #else // USE_POSIX_PACKAGING
        return FileName(addPath(home_dir.absFileName(), string(".") + PACKAGE));
index bb6a86b709f299231025dc227e42cd2defa20190..495bb2cf8a5eeda74ad94ac442278cf0d8c660c9 100644 (file)
@@ -26,7 +26,7 @@
 #include <stdlib.h>
 
 #ifdef __APPLE__
-#include <Carbon/Carbon.h>
+#include <CoreServices/CoreServices.h>
 #endif
 
 using namespace std;
index f032d4d36b6d9ab4faff971e8818d00e5e8a770c..1952a81251ba7410e78e63759d652e844149ed99 100644 (file)
@@ -49,6 +49,7 @@ target_link_libraries(${_tex2lyx}
        support
        ${Lyx_Boost_Libraries}
        ${QT_QTCORE_LIBRARY}
+       ${QT_QTGUI_LIBRARY}
        ${LIBINTL_LIBRARIES}
        ${ICONV_LIBRARY})