summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qcoreapplication.cpp
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2012-03-20 18:01:20 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-28 00:51:32 +0200
commite5d549552614f89dd73b29fc3ee4710f65bb1e57 (patch)
tree0f1480eb7c25a7dc48e5248463daf02d4f36f6c5 /src/corelib/kernel/qcoreapplication.cpp
parentdf43b9a06a73759ba74f23d9c3e91bd0347d1026 (diff)
Make QCoreApplication::applicationName() default to argv[0]
This makes it more useful in all the Qt apps that don't set it, given that it's used internally by QTemporaryFile, QTemporaryDir, QStandardPaths, QDBus, QAccessibleApplication, etc. Qt4 compatibility in the deprecated QDesktopServices is preserved, no fallback there. Change-Id: I584463507cf917a3720793c6bd45d07c60f8356c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qcoreapplication.cpp')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 967ed447d5..3d09d858a3 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1943,7 +1943,9 @@ QString QCoreApplication::organizationDomain()
using the empty constructor. This saves having to repeat this
information each time a QSettings object is created.
- \sa organizationName organizationDomain applicationVersion
+ If not set, the application name defaults to the executable name (since 5.0).
+
+ \sa organizationName organizationDomain applicationVersion applicationFilePath
*/
void QCoreApplication::setApplicationName(const QString &application)
{
@@ -1952,6 +1954,15 @@ void QCoreApplication::setApplicationName(const QString &application)
QString QCoreApplication::applicationName()
{
+ QString appname = coreappdata()->application;
+ if (appname.isEmpty() && QCoreApplication::self)
+ appname = QCoreApplication::self->d_func()->appName();
+ return appname;
+}
+
+// Exported for QDesktopServices (Qt4 behavior compatibility)
+Q_CORE_EXPORT QString qt_applicationName_noFallback()
+{
return coreappdata()->application;
}