Merge remote-tracking branch 'origin/1.5'

This commit is contained in:
Daniel Molkentin 2014-02-12 21:17:06 +01:00
commit beb9752f09
12 changed files with 185 additions and 35 deletions

View file

@ -2,7 +2,7 @@ set( APPLICATION_NAME "ownCloud" )
#set( APPLICATION_SHORTNAME ${APPLICATION_NAME} )
set( APPLICATION_EXECUTABLE "owncloud" )
set( APPLICATION_DOMAIN "owncloud.com" )
set( APPLICATION_VENDOR "ownCloud, Inc" )
set( APPLICATION_VENDOR "ownCloud" )
set( APPLICATION_UPDATE_URL "https://updates.owncloud.com/client/" CACHE string "URL for updater" )
set( THEME_CLASS "ownCloudTheme" )

View file

@ -4,7 +4,7 @@ set( MIRALL_VERSION_PATCH 1 )
set( MIRALL_SOVERSION 0 )
if ( NOT DEFINED MIRALL_VERSION_SUFFIX )
set( MIRALL_VERSION_SUFFIX "rc1" ) #e.g. beta1, beta2, rc1
set( MIRALL_VERSION_SUFFIX "rc2" ) #e.g. beta1, beta2, rc1
endif( NOT DEFINED MIRALL_VERSION_SUFFIX )
if( NOT DEFINED MIRALL_VERSION_BUILD )

View file

@ -54,6 +54,7 @@
!define VERSION "@CPACK_PACKAGE_VERSION@"
Var InstallRunIfSilent
Var NoAutomaticUpdates
;-----------------------------------------------------------------------------
; Installer build timestamp.
@ -67,7 +68,7 @@ Name "@CPACK_NSIS_PACKAGE_NAME@"
BrandingText "${APPLICATION_NAME} ${VERSION} -- ${BUILD_TIME}"
OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@"
InstallDir "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
InstallDirRegKey HKCU "Software\${APPLICATION_NAME}" ""
InstallDirRegKey HKCU "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" ""
InstType Standard
InstType Full
InstType Minimal
@ -277,21 +278,21 @@ FunctionEnd
##############################################################################
Function PageReinstall
ReadRegStr $R0 HKLM "Software\${APPLICATION_NAME}" ""
ReadRegStr $R0 HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" ""
StrCmp $R0 "" 0 +2
Abort
;Detect version
ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionMajor"
ReadRegDWORD $R0 HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionMajor"
IntCmp $R0 ${VER_MAJOR} minor_check new_version older_version
minor_check:
ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionMinor"
ReadRegDWORD $R0 HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionMinor"
IntCmp $R0 ${VER_MINOR} rev_check new_version older_version
rev_check:
ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionRevision"
ReadRegDWORD $R0 HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionRevision"
IntCmp $R0 ${VER_PATCH} build_check new_version older_version
build_check:
ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionBuild"
ReadRegDWORD $R0 HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionBuild"
IntCmp $R0 ${VER_BUILD} same_version new_version older_version
new_version:
@ -487,11 +488,11 @@ Section -post
SetDetailsPrint listonly
;Version numbers used to detect existing installation version for comparisson.
WriteRegStr HKLM "Software\${APPLICATION_NAME}" "" $INSTDIR
WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionMajor" "${VER_MAJOR}"
WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionMinor" "${VER_MINOR}"
WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionRevision" "${VER_PATCH}"
WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionBuild" "${VER_BUILD}"
WriteRegStr HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "" $INSTDIR
WriteRegDWORD HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionMajor" "${VER_MAJOR}"
WriteRegDWORD HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionMinor" "${VER_MINOR}"
WriteRegDWORD HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionRevision" "${VER_PATCH}"
WriteRegDWORD HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionBuild" "${VER_BUILD}"
;Add or Remove Programs entry.
WriteRegExpandStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
@ -563,12 +564,12 @@ Section Uninstall
owncloud_installed:
;Delete registry keys.
DeleteRegValue HKLM "Software\${APPLICATION_NAME}" "VersionBuild"
DeleteRegValue HKLM "Software\${APPLICATION_NAME}" "VersionMajor"
DeleteRegValue HKLM "Software\${APPLICATION_NAME}" "VersionMinor"
DeleteRegValue HKLM "Software\${APPLICATION_NAME}" "VersionRevision"
DeleteRegValue HKLM "Software\${APPLICATION_NAME}" ""
DeleteRegKey HKLM "Software\${APPLICATION_NAME}"
DeleteRegValue HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionBuild"
DeleteRegValue HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionMajor"
DeleteRegValue HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionMinor"
DeleteRegValue HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionRevision"
DeleteRegValue HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" ""
DeleteRegKey HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}"
DeleteRegKey HKCR "${APPLICATION_NAME}"
@ -628,6 +629,13 @@ Function .onInit
StrCpy $InstallRunIfSilent "yes"
${EndIf}
${GetParameters} $R0
${GetOptions} $R0 "/noautoupdate" $R0
${IfNot} ${Errors}
StrCpy $NoAutomaticUpdates "yes"
${EndIf}
!insertmacro INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
; uncomment this line if you want to see the language selection
@ -695,6 +703,10 @@ FunctionEnd
Function .onInstSuccess
${MementoSectionSave}
${If} $NoAutomaticUpdates == "yes"
WriteRegDWORD HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "skipUpdateCheck" "1"
${EndIf}
${If} ${Silent}
${AndIf} $InstallRunIfSilent == "yes"
Call LaunchApplication

View file

@ -10,6 +10,8 @@
#cmakedefine THEME_INCLUDE @THEME_INCLUDE@
#cmakedefine APPLICATION_NAME "@APPLICATION_NAME@"
#cmakedefine APPLICATION_VENDOR "@APPLICATION_VENDOR@"
#cmakedefine APPLICATION_REV_DOMAIN "@APPLICATION_REV_DOMAIN@"
#cmakedefine APPLICATION_SHORTNAME "@APPLICATION_SHORTNAME@"
#cmakedefine APPLICATION_EXECUTABLE "@APPLICATION_EXECUTABLE@"
#cmakedefine APPLICATION_UPDATE_URL "@APPLICATION_UPDATE_URL@"

79
doc/autoupdate.rst Normal file
View file

@ -0,0 +1,79 @@
The Automatic Updater
=====================
To ensure you're always using the latest version of ownCloud Client, an
auto-update mechanism has been added in Version 1.5.1. It will ensure
that will automatically profit from the latest features and bugfixes.
The updater works differently depending on the operating system.
Basic Workflow
--------------
Windows
^^^^^^^
ownCloud client will check for updates and download the update if one
is available. You can view the status under ``Settings -> General -> Updates``.
If an update is available and has been successfully downloaded, ownCloud
Client will start a silent update prior to its next launch and then start itself.
If the silent update fails, the client offers a manual download.
.. note:: The user needs to be able to attain administrative privileges
to successfully perform the update.
Mac OS X
^^^^^^^^
If a new update is available, ownCloud client will ask the user to update
to the latest version using a pop-up dialog. This is the default for Mac
OS X applications which use the Sparkle framework.
Linux
^^^^^
Since distributions provide their own update tool, ownCloud Client on Linux
will not perform any updates on its own. It will, however, check for the
latest version and passively notify the user (``Settings -> General -> Updates``)
if an update is available.
Preventing Auto Updates
-----------------------
In controlled environment such as companies or universities, the auto-update
mechanism might not be desired as it interferes with controlled deployment
tools and policies. In this case, it is possible to disable the auto-updater
entirely:
Windows
^^^^^^^
There are two alternative approaches:
1. In ``HKEY_LOCAL_MACHINE\Software\ownCloud\ownCloud``, add a key of type DWORD
with the value ``skipUpdateCheck`` and the value 1 to the machine. This key
can be manually overrideen by the same value in ``HKEY_CURRENT_USER``.
2. In ``HKEY_LOCAL_MACHINE\Software\Policies\ownCloud\ownCloud``, add a key of
type DWORD the value ``skipUpdateCheck`` and the value 1 to the machine.
Setting the value here cannot be overridden by the user and is the preferred
way to control the updater behavior via Group Policies.
Mac OS X
^^^^^^^^
You can disable the update check via the system-wide ``.plist`` file located
at ``/Library/Preferences/com.owncloud.desktopclient.plist``. Add a new root
level item of type bool and the name ``skipUpdateCheck`` and set it to ``true``.
Linux
^^^^^
Since there is no updating functionality, there is no need to remove the check.
If you want to disable the check nontheless, open a file called
``/etc/ownCloud/ownCloud.conf`` and add the following content::
[General]
skipUpdateCheck=true

View file

@ -10,6 +10,7 @@ Contents
accountsetup
visualtour
advancedusage
autoupdate
building
architecture

View file

@ -301,7 +301,11 @@ void Account::setState(int state)
void Account::slotHandleErrors(QNetworkReply *reply , QList<QSslError> errors)
{
NetworkJobTimeoutPauser pauser(reply);
qDebug() << "SSL-Warnings happened for url " << reply->url().toString();
qDebug() << "SSL-Errors happened for url " << reply->url().toString();
foreach(const QSslError &error, errors) {
qDebug() << "\tError in " << error.certificate() << ":"
<< error.errorString() << "("<< error.error()<< ")";
}
if( _treatSslErrorsAsFailure ) {
// User decided once not to trust. Honor this decision.
@ -317,7 +321,7 @@ void Account::slotHandleErrors(QNetworkReply *reply , QList<QSslError> errors)
QSslSocket::addDefaultCaCertificates(approvedCerts);
addApprovedCerts(approvedCerts);
// all ssl certs are known and accepted. We can ignore the problems right away.
qDebug() << "Certs are already known and trusted, Warnings are not valid.";
qDebug() << "Certs are already known and trusted, Errors are not valid.";
reply->ignoreSslErrors();
} else {
_treatSslErrorsAsFailure = true;

View file

@ -33,9 +33,10 @@
#include "mirall/clientproxy.h"
#include "updater/updater.h"
#include "creds/abstractcredentials.h"
#include "config.h"
#if defined(Q_OS_WIN)
#include <windows.h>
#endif
@ -88,6 +89,9 @@ Application::Application(int &argc, char **argv) :
_logFlush(false),
_userTriggeredConnect(false)
{
// TODO: Can't set this without breaking current config pathes
// setOrganizationName(QLatin1String(APPLICATION_VENDOR));
setOrganizationDomain(QLatin1String(APPLICATION_REV_DOMAIN));
setApplicationName( _theme->appNameGUI() );
setWindowIcon( _theme->applicationIcon() );
@ -139,7 +143,9 @@ Application::Application(int &argc, char **argv) :
// startup procedure.
QTimer::singleShot( 0, this, SLOT( slotCheckConnection() ));
if( !cfg.skipUpdateCheck() ) {
if( cfg.skipUpdateCheck() ) {
qDebug() << Q_FUNC_INFO << "Skipping update check";
} else {
QTimer::singleShot( 3000, this, SLOT( slotStartUpdateDetector() ));
}

View file

@ -142,6 +142,26 @@ void MirallConfigFile::restoreGeometryHeader(QHeaderView *header)
header->restoreState(getValue(geometryC, header->objectName()).toByteArray());
}
QVariant MirallConfigFile::getPolicySetting(const QString &setting, const QVariant& defaultValue) const
{
if (Utility::isWindows()) {
// check for policies first and return immediately if a value is found.
QSettings userPolicy(QString::fromLatin1("HKEY_CURRENT_USER\\Software\\Policies\\%1\\%2")
.arg(APPLICATION_VENDOR).arg(Theme::instance()->appName()),
QSettings::NativeFormat);
if(userPolicy.contains(setting)) {
return userPolicy.value(setting);
}
QSettings machinePolicy(QString::fromLatin1("HKEY_LOCAL_MACHINE\\Software\\Policies\\%1\\%2")
.arg(APPLICATION_VENDOR).arg(APPLICATION_NAME),
QSettings::NativeFormat);
if(machinePolicy.contains(setting)) {
return machinePolicy.value(setting);
}
}
return defaultValue;
}
QString MirallConfigFile::configPath() const
{
@ -324,12 +344,11 @@ bool MirallConfigFile::skipUpdateCheck( const QString& connection ) const
QString con( connection );
if( connection.isEmpty() ) con = defaultConnection();
QSettings settings(configFile(), QSettings::IniFormat);
settings.beginGroup( con );
QVariant fallback = getValue(QLatin1String(skipUpdateCheckC), con, false);
fallback = getValue(QLatin1String(skipUpdateCheckC), QString(), fallback);
bool skipIt = settings.value( QLatin1String(skipUpdateCheckC), false ).toBool();
return skipIt;
QVariant value = getPolicySetting(QLatin1String(skipUpdateCheckC), fallback);
return value.toBool();
}
void MirallConfigFile::setSkipUpdateCheck( bool skip, const QString& connection )
@ -382,11 +401,34 @@ void MirallConfigFile::setProxyType(int proxyType,
QVariant MirallConfigFile::getValue(const QString& param, const QString& group,
const QVariant& defaultValue) const
{
QSettings settings(configFile(), QSettings::IniFormat);
if (!group.isEmpty())
settings.beginGroup(group);
QVariant systemSetting;
qDebug() << Q_FUNC_INFO;
if (Utility::isMac()) {
QSettings systemSettings(QSettings::NativeFormat, QSettings::SystemScope, QCoreApplication::organizationName());
if (!group.isEmpty()) {
systemSettings.beginGroup(group);
}
systemSetting = systemSettings.value(param, defaultValue);
} else if (Utility::isUnix()) {
QSettings systemSettings(QString( SYSCONFDIR "/%1/%1.conf").arg(Theme::instance()->appName()), QSettings::NativeFormat);
if (!group.isEmpty()) {
systemSettings.beginGroup(group);
}
systemSetting = systemSettings.value(param, defaultValue);
} else { // Windows
QSettings systemSettings(QString::fromLatin1("HKEY_LOCAL_MACHINE\\Software\\%1\\%2")
.arg(APPLICATION_VENDOR).arg(Theme::instance()->appName()),
QSettings::NativeFormat);
if (!group.isEmpty()) {
systemSettings.beginGroup(group);
}
systemSetting = systemSettings.value(param, defaultValue);
}
return settings.value(param, defaultValue);
QSettings settings(configFile(), QSettings::IniFormat);
if (!group.isEmpty()) settings.beginGroup(group);
return settings.value(param, systemSetting);
}
void MirallConfigFile::setValue(const QString& key, const QVariant &value)

View file

@ -108,7 +108,9 @@ public:
void saveGeometryHeader(QHeaderView *header);
void restoreGeometryHeader(QHeaderView *header);
protected:
QVariant getPolicySetting(const QString& policy, const QVariant& defaultValue = QVariant()) const;
void storeData(const QString& group, const QString& key, const QVariant& value);
QVariant retrieveData(const QString& group, const QString& key) const;
void removeData(const QString& group, const QString& key);

View file

@ -127,8 +127,11 @@ QMenu* SslButton::buildCertMenu(QMenu *parent, const QSslCertificate& cert,
QString txt;
if (pos > 0) {
txt += QString(2*pos, ' ');
txt += QChar(0x21AA); // nicer '->' symbol
txt += QChar(' ');
if (!Utility::isWindows()) {
// doesn't seem to work reliably on Windows
txt += QChar(0x21AA); // nicer '->' symbol
txt += QChar(' ');
}
}
QString certId = cn.isEmpty() ? ou : cn;

View file

@ -482,5 +482,4 @@ bool Utility::isLinux()
#endif
}
} // namespace Mirall