Initial changes to also build on Qt5, doesn't compile yet

This commit is contained in:
Daniel Molkentin 2013-08-24 14:57:55 +02:00
parent 58f4f3623f
commit 73da086964
12 changed files with 392 additions and 42 deletions

View file

@ -23,6 +23,7 @@ include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_CURRENT_BINARY_D
include(GNUInstallDirs) include(GNUInstallDirs)
include(DefineInstallationPaths) include(DefineInstallationPaths)
include(QtVersionAbstraction)
include(GetGitRevisionDescription) include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1) get_git_head_revision(GIT_REFSPEC GIT_SHA1)
@ -66,10 +67,10 @@ endif()
#### ####
#### find libs #### find libs
find_package(Qt4 4.7.0 COMPONENTS QtCore QtGui QtXml QtNetwork QtTest QtWebkit REQUIRED ) #find_package(Qt4 4.7.0 COMPONENTS QtCore QtGui QtXml QtNetwork QtTest QtWebkit REQUIRED )
if( UNIX AND NOT APPLE ) # Fdo notifications #if( UNIX AND NOT APPLE ) # Fdo notifications
find_package(Qt4 4.7.0 COMPONENTS QtDBus REQUIRED ) # find_package(Qt4 4.7.0 COMPONENTS QtDBus REQUIRED )
endif() #endif()
find_package(Csync REQUIRED) find_package(Csync REQUIRED)
if(UNIX) if(UNIX)
find_package(INotify REQUIRED) find_package(INotify REQUIRED)

View file

@ -0,0 +1,157 @@
# This file defines the Feature Logging macros.
#
# MACRO_LOG_FEATURE(VAR FEATURE DESCRIPTION URL [REQUIRED [MIN_VERSION [COMMENTS]]])
# Logs the information so that it can be displayed at the end
# of the configure run
# VAR : TRUE or FALSE, indicating whether the feature is supported
# FEATURE: name of the feature, e.g. "libjpeg"
# DESCRIPTION: description what this feature provides
# URL: home page
# REQUIRED: TRUE or FALSE, indicating whether the featue is required
# MIN_VERSION: minimum version number. empty string if unneeded
# COMMENTS: More info you may want to provide. empty string if unnecessary
#
# MACRO_DISPLAY_FEATURE_LOG()
# Call this to display the collected results.
# Exits CMake with a FATAL error message if a required feature is missing
#
# Example:
#
# INCLUDE(MacroLogFeature)
#
# FIND_PACKAGE(JPEG)
# MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "Support JPEG images" "http://www.ijg.org" TRUE "3.2a" "")
# ...
# MACRO_DISPLAY_FEATURE_LOG()
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
# Copyright (c) 2006, Allen Winter, <winter@kde.org>
# Copyright (c) 2009, Sebastian Trueg, <trueg@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
IF (NOT _macroLogFeatureAlreadyIncluded)
SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
IF (EXISTS ${_file})
FILE(REMOVE ${_file})
ENDIF (EXISTS ${_file})
SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
IF (EXISTS ${_file})
FILE(REMOVE ${_file})
ENDIF (EXISTS ${_file})
SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
IF (EXISTS ${_file})
FILE(REMOVE ${_file})
ENDIF (EXISTS ${_file})
SET(_macroLogFeatureAlreadyIncluded TRUE)
INCLUDE(FeatureSummary)
ENDIF (NOT _macroLogFeatureAlreadyIncluded)
MACRO(MACRO_LOG_FEATURE _var _package _description _url ) # _required _minvers _comments)
STRING(TOUPPER "${ARGV4}" _required)
SET(_minvers "${ARGV5}")
SET(_comments "${ARGV6}")
IF (${_var})
SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
ELSE (${_var})
IF ("${_required}" STREQUAL "TRUE")
SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
ELSE ("${_required}" STREQUAL "TRUE")
SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
ENDIF ("${_required}" STREQUAL "TRUE")
ENDIF (${_var})
SET(_logtext " * ${_package}")
IF (NOT ${_var})
IF (${_minvers} MATCHES ".*")
SET(_logtext "${_logtext} (${_minvers} or higher)")
ENDIF (${_minvers} MATCHES ".*")
SET(_logtext "${_logtext} <${_url}>\n ")
ELSE (NOT ${_var})
SET(_logtext "${_logtext} - ")
ENDIF (NOT ${_var})
SET(_logtext "${_logtext}${_description}")
IF (NOT ${_var})
IF (${_comments} MATCHES ".*")
SET(_logtext "${_logtext}\n ${_comments}")
ENDIF (${_comments} MATCHES ".*")
# SET(_logtext "${_logtext}\n") #double-space missing features?
ENDIF (NOT ${_var})
FILE(APPEND "${_LOGFILENAME}" "${_logtext}\n")
IF(COMMAND SET_PACKAGE_INFO) # in FeatureSummary.cmake since CMake 2.8.3
SET_PACKAGE_INFO("${_package}" "\"${_description}\"" "${_url}" "\"${_comments}\"")
ENDIF(COMMAND SET_PACKAGE_INFO)
ENDMACRO(MACRO_LOG_FEATURE)
MACRO(MACRO_DISPLAY_FEATURE_LOG)
IF(COMMAND FEATURE_SUMMARY) # in FeatureSummary.cmake since CMake 2.8.3
FEATURE_SUMMARY(FILENAME ${CMAKE_CURRENT_BINARY_DIR}/FindPackageLog.txt
WHAT ALL)
ENDIF(COMMAND FEATURE_SUMMARY)
SET(_missingFile ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
SET(_enabledFile ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
SET(_disabledFile ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
IF (EXISTS ${_missingFile} OR EXISTS ${_enabledFile} OR EXISTS ${_disabledFile})
SET(_printSummary TRUE)
ENDIF (EXISTS ${_missingFile} OR EXISTS ${_enabledFile} OR EXISTS ${_disabledFile})
IF(_printSummary)
SET(_missingDeps 0)
IF (EXISTS ${_enabledFile})
FILE(READ ${_enabledFile} _enabled)
FILE(REMOVE ${_enabledFile})
SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following external packages were located on your system.\n-- This installation will have the extra features provided by these packages.\n-----------------------------------------------------------------------------\n${_enabled}")
ENDIF (EXISTS ${_enabledFile})
IF (EXISTS ${_disabledFile})
SET(_missingDeps 1)
FILE(READ ${_disabledFile} _disabled)
FILE(REMOVE ${_disabledFile})
SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following OPTIONAL packages could NOT be located on your system.\n-- Consider installing them to enable more features from this software.\n-----------------------------------------------------------------------------\n${_disabled}")
ENDIF (EXISTS ${_disabledFile})
IF (EXISTS ${_missingFile})
SET(_missingDeps 1)
FILE(READ ${_missingFile} _requirements)
SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following REQUIRED packages could NOT be located on your system.\n-- You must install these packages before continuing.\n-----------------------------------------------------------------------------\n${_requirements}")
FILE(REMOVE ${_missingFile})
SET(_haveMissingReq 1)
ENDIF (EXISTS ${_missingFile})
IF (NOT ${_missingDeps})
SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- Congratulations! All external packages have been found.")
ENDIF (NOT ${_missingDeps})
MESSAGE(${_summary})
MESSAGE("-----------------------------------------------------------------------------\n")
IF(_haveMissingReq)
MESSAGE(FATAL_ERROR "Exiting: Missing Requirements")
ENDIF(_haveMissingReq)
ENDIF(_printSummary)
ENDMACRO(MACRO_DISPLAY_FEATURE_LOG)

View file

@ -0,0 +1,47 @@
# - MACRO_OPTIONAL_FIND_PACKAGE() combines FIND_PACKAGE() with an OPTION()
# MACRO_OPTIONAL_FIND_PACKAGE( <name> [QUIT] )
# This macro is a combination of OPTION() and FIND_PACKAGE(), it
# works like FIND_PACKAGE(), but additionally it automatically creates
# an option name WITH_<name>, which can be disabled via the cmake GUI.
# or via -DWITH_<name>=OFF
# The standard <name>_FOUND variables can be used in the same way
# as when using the normal FIND_PACKAGE()
# Copyright (c) 2006-2010 Alexander Neundorf, <neundorf@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
# This is just a helper macro to set a bunch of variables empty.
# We don't know whether the package uses UPPERCASENAME or CamelCaseName, so we try both:
macro(_MOFP_SET_EMPTY_IF_DEFINED _name _var)
if(DEFINED ${_name}_${_var})
set(${_name}_${_var} "")
endif(DEFINED ${_name}_${_var})
string(TOUPPER ${_name} _nameUpper)
if(DEFINED ${_nameUpper}_${_var})
set(${_nameUpper}_${_var} "")
endif(DEFINED ${_nameUpper}_${_var})
endmacro(_MOFP_SET_EMPTY_IF_DEFINED _package _var)
macro (MACRO_OPTIONAL_FIND_PACKAGE _name )
option(WITH_${_name} "Search for ${_name} package" ON)
if (WITH_${_name})
find_package(${_name} ${ARGN})
else (WITH_${_name})
string(TOUPPER ${_name} _nameUpper)
set(${_name}_FOUND FALSE)
set(${_nameUpper}_FOUND FALSE)
_mofp_set_empty_if_defined(${_name} INCLUDE_DIRS)
_mofp_set_empty_if_defined(${_name} INCLUDE_DIR)
_mofp_set_empty_if_defined(${_name} INCLUDES)
_mofp_set_empty_if_defined(${_name} LIBRARY)
_mofp_set_empty_if_defined(${_name} LIBRARIES)
_mofp_set_empty_if_defined(${_name} LIBS)
_mofp_set_empty_if_defined(${_name} FLAGS)
_mofp_set_empty_if_defined(${_name} DEFINITIONS)
endif (WITH_${_name})
endmacro (MACRO_OPTIONAL_FIND_PACKAGE)

View file

@ -0,0 +1,107 @@
include (MacroOptionalFindPackage)
include (MacroLogFeature)
option(BUILD_WITH_QT4 "Build with Qt4 no matter if Qt5 was found" ON)
if( NOT BUILD_WITH_QT4 )
find_package(Qt5Core QUIET)
if( Qt5Core_DIR )
find_package(Qt5Widgets QUIET)
find_package(Qt5Quick QUIET)
find_package(Qt5PrintSupport QUIET)
find_package(Qt5WebKit QUIET)
find_package(Qt5Location QUIET)
find_package(Qt5Network QUIET)
find_package(Qt5Sensors QUIET)
# find_package(Qt5WebKitWidgets QUIET)
message(STATUS "Using Qt 5!")
include_directories(${Qt5Widgets_INCLUDES})
add_definitions(${Qt5Widgets_DEFINITIONS})
set(CMAKE_CXX_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
# We need this to find the paths to qdbusxml2cpp and co
find_package(Qt5DBus REQUIRED)
macro(qt_wrap_ui)
qt5_wrap_ui(${ARGN})
endmacro()
macro(qt_add_resources)
qt5_add_resources(${ARGN})
endmacro()
# find_package(Qt5LinguistTools REQUIRED)
macro(qt_add_translation)
# qt5_add_translation(${ARGN})
endmacro()
macro(qt_add_dbus_interface)
qt5_add_dbus_interface(${ARGN})
endmacro()
macro(qt_add_dbus_adaptor)
qt5_add_dbus_adaptor(${ARGN})
endmacro()
macro(setup_qt)
endmacro()
set(QT_RCC_EXECUTABLE "${Qt5Core_RCC_EXECUTABLE}")
endif()
endif()
if( NOT Qt5Core_DIR )
message(STATUS "Could not find Qt5, searching for Qt4 instead...")
set(NEEDED_QT4_COMPONENTS "QtCore" "QtXml" "QtNetwork" "QtGui" "QtWebkit")
if( BUILD_TESTS )
list(APPEND NEEDED_QT4_COMPONENTS "QtTest")
endif()
include(${QT_USE_FILE})
macro_optional_find_package(Qt4 4.7.0 COMPONENTS ${NEEDED_QT4_COMPONENTS} )
macro_log_feature(QT4_FOUND "Qt" "A cross-platform application and UI framework" "http://qt.nokia.com" TRUE "" "If you see this, although libqt4-devel is installed, check whether the \n qtwebkit-devel package and whatever contains QtUiTools is installed too")
macro(qt5_use_modules)
endmacro()
macro(qt_wrap_ui)
qt4_wrap_ui(${ARGN})
endmacro()
macro(qt_add_resources)
qt4_add_resources(${ARGN})
endmacro()
macro(qt_add_translation)
qt4_add_translation(${ARGN})
endmacro()
macro(qt_add_dbus_interface)
qt4_add_dbus_interface(${ARGN})
endmacro()
macro(qt_add_dbus_adaptor)
qt4_add_dbus_adaptor(${ARGN})
endmacro()
macro(setup_qt)
set(QT_DONT_USE_QTGUI TRUE)
set(QT_USE_QTSQL TRUE)
set(QT_USE_QTNETWORK TRUE)
set(QT_USE_QTXML TRUE)
set(QT_USE_QTWEBKIT TRUE)
include( ${QT_USE_FILE} )
endmacro()
endif()
if( Qt5Core_DIR )
set( HAVE_QT5 TRUE )
else( Qt5Core_DIR )
set( HAVE_QT5 FALSE )
endif( Qt5Core_DIR )

View file

@ -1,34 +1,16 @@
include(${QT_USE_FILE})
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
QT4_ADD_RESOURCES ( MIRALL_RC_SRC ../mirall.qrc) qt_add_resources(MIRALL_RC_SRC ../mirall.qrc)
if ( IS_DIRECTORY ${OEM_THEME_DIR} ) if ( IS_DIRECTORY ${OEM_THEME_DIR} )
QT4_ADD_RESOURCES ( MIRALL_RC_SRC ${OEM_THEME_DIR}/theme.qrc) qt_add_resources(MIRALL_RC_SRC ${OEM_THEME_DIR}/theme.qrc)
set(theme_dir ${OEM_THEME_DIR}/theme) set(theme_dir ${OEM_THEME_DIR}/theme)
else() else()
QT4_ADD_RESOURCES ( MIRALL_RC_SRC ../theme.qrc) qt_add_resources(MIRALL_RC_SRC ../theme.qrc)
set(theme_dir ${CMAKE_CURRENT_SOURCE_DIR}/../theme) set(theme_dir ${CMAKE_CURRENT_SOURCE_DIR}/../theme)
endif() endif()
set(synclib_NAME ${APPLICATION_EXECUTABLE}sync) set(synclib_NAME ${APPLICATION_EXECUTABLE}sync)
set(mirall_UI
mirall/folderwizardsourcepage.ui
mirall/folderwizardtargetpage.ui
mirall/sslerrordialog.ui
mirall/settingsdialog.ui
mirall/generalsettings.ui
mirall/networksettings.ui
mirall/accountsettings.ui
mirall/ignorelisteditor.ui
mirall/itemprogressdialog.ui
wizard/owncloudsetupnocredspage.ui
wizard/owncloudhttpcredspage.ui
wizard/owncloudwizardresultpage.ui
wizard/owncloudadvancedsetuppage.ui
)
set(3rdparty_SRC set(3rdparty_SRC
3rdparty/qtsingleapplication/qtsingleapplication.cpp 3rdparty/qtsingleapplication/qtsingleapplication.cpp
3rdparty/qtsingleapplication/qtlocalpeer.cpp 3rdparty/qtsingleapplication/qtlocalpeer.cpp
@ -45,7 +27,7 @@ set(3rdparty_HEADER
3rdparty/fancylineedit/fancylineedit.h 3rdparty/fancylineedit/fancylineedit.h
3rdparty/QProgressIndicator/QProgressIndicator.h 3rdparty/QProgressIndicator/QProgressIndicator.h
) )
qt4_wrap_cpp(3rdparty_MOC ${3rdparty_HEADER}) qt_wrap_cpp(3rdparty_MOC ${3rdparty_HEADER})
if(NOT WIN32) if(NOT WIN32)
list(APPEND 3rdparty_SRC 3rdparty/qtlockedfile/qtlockedfile_unix.cpp) list(APPEND 3rdparty_SRC 3rdparty/qtlockedfile/qtlockedfile_unix.cpp)
@ -60,8 +42,6 @@ set(3rdparty_INC
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/fancylineedit ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/fancylineedit
) )
qt4_wrap_ui(mirall_UI_SRCS ${mirall_UI})
set(libsync_SRCS set(libsync_SRCS
mirall/folderman.cpp mirall/folderman.cpp
mirall/folder.cpp mirall/folder.cpp
@ -135,7 +115,7 @@ IF( APPLE )
ENDIF() ENDIF()
qt4_wrap_cpp(syncMoc ${libsync_HEADERS}) qt_wrap_cpp(syncMoc ${libsync_HEADERS})
list(APPEND libsync_LINK_TARGETS list(APPEND libsync_LINK_TARGETS
${QT_LIBRARIES} ${QT_LIBRARIES}
@ -149,6 +129,9 @@ if(QTKEYCHAIN_FOUND)
endif() endif()
add_library(${synclib_NAME} SHARED ${libsync_SRCS} ${syncMoc}) add_library(${synclib_NAME} SHARED ${libsync_SRCS} ${syncMoc})
qt5_use_modules(${synclib_NAME} Widgets Network Xml Quick WebKitWidgets)
set_target_properties( ${synclib_NAME} PROPERTIES set_target_properties( ${synclib_NAME} PROPERTIES
VERSION ${VERSION} VERSION ${VERSION}
SOVERSION ${SOVERSION} SOVERSION ${SOVERSION}
@ -175,6 +158,24 @@ else()
install(TARGETS ${synclib_NAME} DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/MacOS) install(TARGETS ${synclib_NAME} DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/MacOS)
endif() endif()
set(mirall_UI
mirall/folderwizardsourcepage.ui
mirall/folderwizardtargetpage.ui
mirall/sslerrordialog.ui
mirall/settingsdialog.ui
mirall/generalsettings.ui
mirall/networksettings.ui
mirall/accountsettings.ui
mirall/ignorelisteditor.ui
mirall/itemprogressdialog.ui
wizard/owncloudsetupnocredspage.ui
wizard/owncloudhttpcredspage.ui
wizard/owncloudwizardresultpage.ui
wizard/owncloudadvancedsetuppage.ui
)
qt_wrap_ui(mirall_UI_SRCS ${mirall_UI})
set(mirall_SRCS set(mirall_SRCS
mirall/application.cpp mirall/application.cpp
mirall/systray.cpp mirall/systray.cpp
@ -234,9 +235,9 @@ endif()
include_directories(${CSYNC_INCLUDE_DIR}/csync ${CSYNC_INCLUDE_DIR} ${CSYNC_BUILD_PATH}/src) include_directories(${CSYNC_INCLUDE_DIR}/csync ${CSYNC_INCLUDE_DIR} ${CSYNC_BUILD_PATH}/src)
include_directories(${3rdparty_INC}) include_directories(${3rdparty_INC})
qt4_wrap_cpp(mirallMoc ${mirall_HEADERS}) qt_wrap_cpp(mirallMoc ${mirall_HEADERS})
qt4_add_translation(mirall_I18N ${TRANSLATIONS}) qt_add_translation(mirall_I18N ${TRANSLATIONS})
set( final_src set( final_src
${mirall_HEADERS} ${mirall_HEADERS}
@ -276,7 +277,7 @@ endif(NOT WIN32)
# add_executable( ${APPLICATION_EXECUTABLE} main.cpp ${final_src}) # add_executable( ${APPLICATION_EXECUTABLE} main.cpp ${final_src})
add_executable( ${APPLICATION_EXECUTABLE} WIN32 main.cpp ${final_src}) add_executable( ${APPLICATION_EXECUTABLE} WIN32 main.cpp ${final_src})
qt5_use_modules(${APPLICATION_EXECUTABLE} Widgets Network Xml)
else() else()
set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
include(DeployQt4) include(DeployQt4)
@ -286,6 +287,7 @@ else()
# we must add MACOSX_BUNDLE only if building a bundle # we must add MACOSX_BUNDLE only if building a bundle
add_executable( ${APPLICATION_EXECUTABLE} WIN32 MACOSX_BUNDLE main.cpp ${final_src}) add_executable( ${APPLICATION_EXECUTABLE} WIN32 MACOSX_BUNDLE main.cpp ${final_src})
qt5_use_modules(${APPLICATION_EXECUTABLE} Widgets Network Xml)
#FIXME: hardcoded path #FIXME: hardcoded path
if ( EXISTS ${CSYNC_BINARY_DIR}/modules/ocsync_owncloud.so ) if ( EXISTS ${CSYNC_BINARY_DIR}/modules/ocsync_owncloud.so )

View file

@ -13,6 +13,7 @@
#include <QDebug> #include <QDebug>
#include <QNetworkRequest> #include <QNetworkRequest>
#include <QNetworkCookieJar>
#include "creds/shibboleth/shibbolethaccessmanager.h" #include "creds/shibboleth/shibbolethaccessmanager.h"

View file

@ -481,7 +481,7 @@ void Folder::setProxy()
if( _csync_ctx ) { if( _csync_ctx ) {
/* Store proxy */ /* Store proxy */
QUrl proxyUrl(ownCloudInfo::instance()->webdavUrl()); QUrl proxyUrl(ownCloudInfo::instance()->webdavUrl());
QList<QNetworkProxy> proxies = QNetworkProxyFactory::proxyForQuery(proxyUrl); QList<QNetworkProxy> proxies = QNetworkProxyFactory::proxyForQuery(QNetworkProxyQuery(proxyUrl));
// We set at least one in Application // We set at least one in Application
Q_ASSERT(proxies.count() > 0); Q_ASSERT(proxies.count() > 0);
QNetworkProxy proxy = proxies.first(); QNetworkProxy proxy = proxies.first();

View file

@ -18,10 +18,12 @@
#include "mirall/owncloudinfo.h" #include "mirall/owncloudinfo.h"
#include "mirall/owncloudtheme.h" #include "mirall/owncloudtheme.h"
#include "mirall/theme.h" #include "mirall/theme.h"
#include "mirall/utility.h"
#include "creds/abstractcredentials.h" #include "creds/abstractcredentials.h"
#include "creds/credentialsfactory.h" #include "creds/credentialsfactory.h"
#include <QtCore>
#include <QtGui> #include <QWidget>
#define DEFAULT_REMOTE_POLL_INTERVAL 30000 // default remote poll time in milliseconds #define DEFAULT_REMOTE_POLL_INTERVAL 30000 // default remote poll time in milliseconds
#define DEFAULT_MAX_LOG_LINES 20000 #define DEFAULT_MAX_LOG_LINES 20000
@ -159,7 +161,7 @@ void MirallConfigFile::restoreGeometry(QWidget *w)
QString MirallConfigFile::configPath() const QString MirallConfigFile::configPath() const
{ {
if( _confDir.isEmpty() ) { if( _confDir.isEmpty() ) {
_confDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation); _confDir = Utility::dataLocation();
} }
QString dir = _confDir; QString dir = _confDir;

View file

@ -138,9 +138,13 @@ QNetworkReply* ownCloudInfo::mkdirRequest( const QString& dir )
qDebug() << "OCInfo Making dir " << dir; qDebug() << "OCInfo Making dir " << dir;
_authAttempts = 0; _authAttempts = 0;
QNetworkRequest req; QNetworkRequest req;
QUrl url = QUrl(webdavUrl(_connection)); #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QUrl url(webdavUrl(_connection));
url.setEncodedPath(url.encodedPath()+QUrl::toPercentEncoding(dir, "/")); url.setEncodedPath(url.encodedPath()+QUrl::toPercentEncoding(dir, "/"));
#else
QUrl url(webdavUrl(_connection));
url.setPath(url.path(QUrl::FullyEncoded)+QUrl::toPercentEncoding(dir, "/"));
#endif
req.setUrl( url ); req.setUrl( url );
QNetworkReply *reply = davRequest("MKCOL", req, 0); QNetworkReply *reply = davRequest("MKCOL", req, 0);

View file

@ -142,9 +142,9 @@ QString SslErrorDialog::certDiv( QSslCertificate cert ) const
msg += QL("<div id=\"ccert\">"); msg += QL("<div id=\"ccert\">");
QStringList li; QStringList li;
QString org = Qt::escape(cert.subjectInfo( QSslCertificate::Organization)); QString org = Utility::escape(cert.subjectInfo( QSslCertificate::Organization));
QString unit = Qt::escape(cert.subjectInfo( QSslCertificate::OrganizationalUnitName)); QString unit = Utility::escape(cert.subjectInfo( QSslCertificate::OrganizationalUnitName));
QString country = Qt::escape(cert.subjectInfo( QSslCertificate::CountryName)); QString country = Utility::escape(cert.subjectInfo( QSslCertificate::CountryName));
if (unit.isEmpty()) unit = tr("&lt;not specified&gt;"); if (unit.isEmpty()) unit = tr("&lt;not specified&gt;");
if (org.isEmpty()) org = tr("&lt;not specified&gt;"); if (org.isEmpty()) org = tr("&lt;not specified&gt;");
if (country.isEmpty()) country = tr("&lt;not specified&gt;"); if (country.isEmpty()) country = tr("&lt;not specified&gt;");

View file

@ -24,6 +24,12 @@
#include <QWidget> #include <QWidget>
#include <QDebug> #include <QDebug>
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include <QDesktopServices>
#else
#include <QStandardPaths>
#endif
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
#include <sys/statvfs.h> #include <sys/statvfs.h>
#include <sys/types.h> #include <sys/types.h>
@ -51,7 +57,7 @@ QString Utility::formatFingerprint( const QByteArray& fmhash )
hash.append(' '); hash.append(' ');
} }
QString fp = QString::fromAscii( hash.trimmed() ); QString fp = QString::fromLatin1( hash.trimmed() );
fp.replace(QChar(' '), QChar(':')); fp.replace(QChar(' '), QChar(':'));
return fp; return fp;
@ -369,4 +375,22 @@ QString Utility::toCSyncScheme(const QString &urlStr)
return url.toString(); return url.toString();
} }
QString Utility::escape(const QString &in)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
return Qt::escape(in);
#else
return in.toHtmlEscaped();
#endif
}
QString Utility::dataLocation()
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
return QDesktopServices::storageLocation(QDesktopServices::DataLocation);
#else
return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
#endif
}
} // namespace Mirall } // namespace Mirall

View file

@ -44,6 +44,11 @@ namespace Utility
* @return the formatted string. * @return the formatted string.
*/ */
QString compactFormatDouble(double value, int prec, const QString& unit = QString::null); QString compactFormatDouble(double value, int prec, const QString& unit = QString::null);
// porting methods
QString escape(const QString&);
QString dataLocation();
} }
} }