From 3ecffbfcb012a9dac1cd6eda7d454e6e4e24d3f7 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 29 Apr 2015 19:04:49 +0200 Subject: [PATCH] global locale and language variables useful for locale depending things, like setting up kimpanel --- shell/scripting/appinterface.cpp | 10 ++++++++++ shell/scripting/appinterface.h | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/shell/scripting/appinterface.cpp b/shell/scripting/appinterface.cpp index 4153c9b2f..15b4a420e 100644 --- a/shell/scripting/appinterface.cpp +++ b/shell/scripting/appinterface.cpp @@ -120,6 +120,16 @@ void AppInterface::setTheme(const QString &name) m_theme->setThemeName(name); } +QString AppInterface::locale() const +{ + return QLocale::system().name(); +} + +QString AppInterface::language() const +{ + return QLocale::system().languageToString(QLocale::system().language()); +} + bool AppInterface::multihead() const { #ifdef Q_OS_WIN diff --git a/shell/scripting/appinterface.h b/shell/scripting/appinterface.h index 5b79d398e..93aa0143a 100644 --- a/shell/scripting/appinterface.h +++ b/shell/scripting/appinterface.h @@ -53,6 +53,8 @@ class AppInterface : public QObject Q_PROPERTY(int scriptingVersion READ scriptingVersion) Q_PROPERTY(bool multihead READ multihead) Q_PROPERTY(bool multiheadScreen READ multihead) + Q_PROPERTY(QString locale READ locale) + Q_PROPERTY(QString language READ language) public: AppInterface(ScriptEngine *env); @@ -74,6 +76,9 @@ public: QString theme() const; void setTheme(const QString &name); + QString locale() const; + QString language() const; + bool multihead() const; int multiheadScreen() const;