From: Stephan Witt Date: Sun, 23 Sep 2012 13:27:36 +0000 (+0200) Subject: avoid deprecated functions on Mac - use Qt instead X-Git-Tag: 2.1.0beta1~1509 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=273ebbef19dda5621986c036670c9ed7119bfb7b;p=features.git avoid deprecated functions on Mac - use Qt instead --- diff --git a/src/Makefile.am b/src/Makefile.am index 43edb94622..d3c52f5e90 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 diff --git a/src/support/Makefile.am b/src/support/Makefile.am index f7fad7c4cd..2418168f0e 100644 --- a/src/support/Makefile.am +++ b/src/support/Makefile.am @@ -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 \ diff --git a/src/support/Package.cpp b/src/support/Package.cpp index ec08a55b7b..a158b49d3a 100644 --- a/src/support/Package.cpp +++ b/src/support/Package.cpp @@ -36,7 +36,9 @@ #endif #if defined (USE_MACOSX_PACKAGING) -# include // FSFindFolder, FSRefMakePath +# include "support/qstring_helpers.h" +# include +# include #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(store), PATH_MAX); - if (status_code != 0) - return FileName(); - - return FileName(addPath(reinterpret_cast(store), PACKAGE)); + return FileName(addPath(fromqstr(QDesktopServices::storageLocation(QDesktopServices::DataLocation)), PACKAGE)); #else // USE_POSIX_PACKAGING return FileName(addPath(home_dir.absFileName(), string(".") + PACKAGE)); diff --git a/src/support/os_unix.cpp b/src/support/os_unix.cpp index bb6a86b709..495bb2cf8a 100644 --- a/src/support/os_unix.cpp +++ b/src/support/os_unix.cpp @@ -26,7 +26,7 @@ #include #ifdef __APPLE__ -#include +#include #endif using namespace std; diff --git a/src/tex2lyx/CMakeLists.txt b/src/tex2lyx/CMakeLists.txt index f032d4d36b..1952a81251 100644 --- a/src/tex2lyx/CMakeLists.txt +++ b/src/tex2lyx/CMakeLists.txt @@ -49,6 +49,7 @@ target_link_libraries(${_tex2lyx} support ${Lyx_Boost_Libraries} ${QT_QTCORE_LIBRARY} + ${QT_QTGUI_LIBRARY} ${LIBINTL_LIBRARIES} ${ICONV_LIBRARY})