diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2011-09-28 11:55:00 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2011-09-28 11:55:00 (GMT) |
commit | d81ddfd44455c79d0a44ab1caf29939b287dd895 (patch) | |
tree | 9b4383c5c23b405170ff9b2b5edb6762165828bb /src/corelib | |
parent | 89ae1ec634f82f89e97f3e19b5d5fb0da9b3092f (diff) | |
parent | c75aabbb022e3c2db246e2fd90a36662cf28ec24 (diff) | |
download | Qt-d81ddfd44455c79d0a44ab1caf29939b287dd895.zip Qt-d81ddfd44455c79d0a44ab1caf29939b287dd895.tar.gz Qt-d81ddfd44455c79d0a44ab1caf29939b287dd895.tar.bz2 |
Merge remote-tracking branch 'mainline/4.8'
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/global/qnamespace.qdoc | 2 | ||||
-rw-r--r-- | src/corelib/io/qfsfileengine.cpp | 5 | ||||
-rw-r--r-- | src/corelib/io/qsettings.cpp | 47 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 23 | ||||
-rw-r--r-- | src/corelib/thread/qthread_symbian.cpp | 5 |
5 files changed, 78 insertions, 4 deletions
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 4974aef..03e0d1f 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2560,7 +2560,7 @@ will imply to use the layout direction set on the parent widget or QApplication. This has the same effect as QWidget::unsetLayoutDirection(). - When LayoutDirectoinAuto is used in conjunction with text layouting, it will imply that the text + When LayoutDirectionAuto is used in conjunction with text layouting, it will imply that the text directionality is determined from the content of the string to be layouted. \sa QApplication::setLayoutDirection(), QWidget::setLayoutDirection(), QTextOption::setTextDirection(), QString::isRightToLeft() diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index e1f3123..dd4c40f 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -120,9 +120,12 @@ void QFSFileEnginePrivate::init() openMode = QIODevice::NotOpen; fd = -1; fh = 0; -#if defined (Q_OS_SYMBIAN) && !defined(QT_SYMBIAN_USE_NATIVE_FILEMAP) +#if defined (Q_OS_SYMBIAN) + symbianFilePos = 0; +#if !defined(QT_SYMBIAN_USE_NATIVE_FILEMAP) fileHandleForMaps = -1; #endif +#endif lastIOCommand = IOFlushCommand; lastFlushFailed = false; closeFileHandle = false; diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 547bbeb..ab8cc39 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -2332,6 +2332,25 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, %COMMON_APPDATA% path is usually \tt{C:\\Documents and Settings\\All Users\\Application Data}. + On Symbian, the following files are used for both IniFormat and + NativeFormat (in this example, we assume that the application is + installed on the \c e-drive and its Secure ID is \c{0xECB00931}): + + \list 1 + \o \c{c:\data\.config\MySoft\Star Runner.conf} + \o \c{c:\data\.config\MySoft.conf} + \o \c{e:\private\ecb00931\MySoft\Star Runner.conf} + \o \c{e:\private\ecb00931\MySoft.conf} + \endlist + + The SystemScope settings location is determined from the installation + drive and Secure ID (UID3) of the application. If the application is + built-in on the ROM, the drive used for SystemScope is \c c:. + + \note Symbian SystemScope settings are by default private to the + application and not shared between applications, unlike other + environments. + The paths for the \c .ini and \c .conf files can be changed using setPath(). On Unix and Mac OS X, the user can override them by by setting the \c XDG_CONFIG_HOME environment variable; see @@ -2389,6 +2408,32 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, On other platforms than Windows, "Default" and "." would be treated as regular subkeys. + \section2 Securing application settings in Symbian + + UserScope settings in Symbian are writable by any application by + default. To protect the application settings from access and tampering + by other applications, the settings need to be placed in the private + secure area of the application. This can be done by specifying the + settings storage path directly to the private area. The following + snippet changes the UserScope to \c{c:/private/ecb00931/MySoft.conf} + (provided the application is installed on the \c{c-drive} and its + Secure ID is \c{0xECB00931}: + + \snippet doc/src/snippets/code/src_corelib_io_qsettings.cpp 30 + + Framework libraries (like Qt itself) may store configuration and cache + settings using UserScope, which is accessible and writable by other + applications. If the application is very security sensitive or uses + high platform security capabilities, it may be prudent to also force + framework settings to be stored in the private directory of the + application. This can be done by changing the default path of UserScope + before QApplication is created: + + \snippet doc/src/snippets/code/src_corelib_io_qsettings.cpp 31 + + Note that this may affect framework libraries' functionality if they expect + the settings to be shared between applications. + \section2 Platform Limitations While QSettings attempts to smooth over the differences between @@ -3423,6 +3468,8 @@ void QSettings::setUserIniPath(const QString &dir) \row \o SystemScope \o \c /etc/xdg \row \o{1,2} Mac OS X \o{1,2} IniFormat \o UserScope \o \c $HOME/.config \row \o SystemScope \o \c /etc/xdg + \row \o{1,2} Symbian \o{1,2} NativeFormat, IniFormat \o UserScope \o \c c:/data/.config + \row \o SystemScope \o \c <drive>/private/<uid> \endtable The default UserScope paths on Unix and Mac OS X (\c diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 18a5eae..752bbaa 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -273,6 +273,29 @@ bool QCoreApplicationPrivate::is_app_closing = false; // initialized in qcoreapplication and in qtextstream autotest when setlocale is called. Q_CORE_EXPORT bool qt_locale_initialized = false; +#ifdef Q_OS_SYMBIAN +// The global QSettings needs to be cleaned where cleanup stack is available, which is not +// normally the case when global static destructors are run. +// Declare a custom QGlobalStaticDeleter for QSettings to handle that case. +template<> +class QGlobalStaticDeleter<QSettings> +{ +public: + QGlobalStatic<QSettings> &globalStatic; + QGlobalStaticDeleter(QGlobalStatic<QSettings> &_globalStatic) + : globalStatic(_globalStatic) + { } + + inline ~QGlobalStaticDeleter() + { + CTrapCleanup *cleanup = CTrapCleanup::New(); + delete globalStatic.pointer; + delete cleanup; + globalStatic.pointer = 0; + globalStatic.destroyed = true; + } +}; +#endif /* Create an instance of Trolltech.conf. This ensures that the settings will not diff --git a/src/corelib/thread/qthread_symbian.cpp b/src/corelib/thread/qthread_symbian.cpp index 46339a6..2ea1b44 100644 --- a/src/corelib/thread/qthread_symbian.cpp +++ b/src/corelib/thread/qthread_symbian.cpp @@ -324,13 +324,14 @@ void *QThreadPrivate::start(void *arg) data->threadId = QThread::currentThreadId(); set_thread_data(data); + CTrapCleanup *cleanup = CTrapCleanup::New(); + q_check_ptr(cleanup); + { QMutexLocker locker(&thr->d_func()->mutex); data->quitNow = thr->d_func()->exited; } - CTrapCleanup *cleanup = CTrapCleanup::New(); - // ### TODO: allow the user to create a custom event dispatcher createEventDispatcher(data); |