From 19d9a2b88bbaa4a45931927889e416c98f0fd506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Fri, 15 Feb 2013 05:13:53 +0100 Subject: [PATCH] Port, build Locale bindings This enables 90% of the Locale bindings. Some translation-related things need changing. --- src/declarativeimports/CMakeLists.txt | 2 +- src/declarativeimports/locale/CMakeLists.txt | 30 ++++++++++--------- src/declarativeimports/locale/locale.cpp | 28 +++++++++++++---- src/declarativeimports/locale/locale_p.h | 4 +-- .../locale/localebindingsplugin.cpp | 2 +- .../locale/localebindingsplugin.h | 7 ++--- .../plasmaextracomponents/CMakeLists.txt | 8 ++--- 7 files changed, 48 insertions(+), 33 deletions(-) diff --git a/src/declarativeimports/CMakeLists.txt b/src/declarativeimports/CMakeLists.txt index 99863fcb8..99f8d5f42 100644 --- a/src/declarativeimports/CMakeLists.txt +++ b/src/declarativeimports/CMakeLists.txt @@ -4,4 +4,4 @@ add_subdirectory(core) add_subdirectory(qtextracomponents) add_subdirectory(plasmacomponents) add_subdirectory(plasmaextracomponents) -#add_subdirectory(locale) +add_subdirectory(locale) diff --git a/src/declarativeimports/locale/CMakeLists.txt b/src/declarativeimports/locale/CMakeLists.txt index 63630259a..ff204fc24 100644 --- a/src/declarativeimports/locale/CMakeLists.txt +++ b/src/declarativeimports/locale/CMakeLists.txt @@ -1,25 +1,27 @@ project(localebindings) -include(KDE4Defaults) - +# include(KDE4Defaults) +# set(localebindings_SRCS locale.cpp localebindingsplugin.cpp calendarsystem.cpp ) -INCLUDE_DIRECTORIES( - ${CMAKE_SOURCE_DIR} - ${CMAKE_BINARY_DIR} - ${KDE4_INCLUDES} -) +# INCLUDE_DIRECTORIES( +# ${CMAKE_SOURCE_DIR} +# ${CMAKE_BINARY_DIR} +# ${KDE4_INCLUDES} +# ) qt4_automoc(${localebindings_SRCS}) - -kde4_add_library(localebindingsplugin SHARED ${localebindings_SRCS}) - -target_link_libraries(localebindingsplugin ${QT_QTDECLARATIVE_LIBRARY} ${KDE4_KDECORE_LIBRARY}) - -install(TARGETS localebindingsplugin DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/locale) -install(FILES qmldir DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/locale) +add_library(localebindingsplugin SHARED ${localebindings_SRCS}) +target_link_libraries(localebindingsplugin + ${QT_QTCORE_LIBRARY} + ${Qt5Quick_LIBRARIES} + ${Qt5Qml_LIBRARIES} + ${KDE4_KDECORE_LIBS} + ) +install(TARGETS localebindingsplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/locale) +install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/locale) diff --git a/src/declarativeimports/locale/locale.cpp b/src/declarativeimports/locale/locale.cpp index f8490b5e8..11067d70d 100644 --- a/src/declarativeimports/locale/locale.cpp +++ b/src/declarativeimports/locale/locale.cpp @@ -22,12 +22,17 @@ #include "locale_p.h" //KDE -#include +#include +#include + +//Qt +#include Locale::Locale(QObject* parent) : QObject(parent) { - m_locale = KGlobal::locale(); + //m_locale = KGlobal::locale(); + m_locale = KLocale::global(); } bool Locale::setCountryDivisionCode(const QString &countryDivisionCode) @@ -45,7 +50,10 @@ void Locale::setCurrencyCode(const QString &newCurrencyCode) bool Locale::isApplicationTranslatedInto(const QString &lang) { - return m_locale->isApplicationTranslatedInto(lang); +#warning "Locale::isApplicationTranslatedInto needs porting" + qWarning() << " has not been ported"; + //return m_locale->isApplicationTranslatedInto(lang); + return true; } void Locale::splitLocale(const QString &locale, QString &language, QString &country, QString &modifier, @@ -76,7 +84,10 @@ QString Locale::currencyCode() const QString Locale::translateQt(const char *context, const char *sourceText, const char *comment) const { - return m_locale->translateQt(context, sourceText, comment); +#warning "Locale::translateQt needs porting" + //return m_locale->translateQt(context, sourceText, comment); + qWarning() << " has not been ported"; + return sourceText; } QList Locale::allDigitSetsList() const @@ -483,7 +494,10 @@ QString Locale::defaultCurrencyCode() bool Locale::useTranscript() const { - return m_locale->useTranscript(); +#warning "Locale::useTranscript needs porting" + qWarning() << " has not been ported"; + return true; + //return m_locale->useTranscript(); } int Locale::fileEncodingMib() const @@ -540,7 +554,9 @@ Locale::WeekNumberSystem Locale::weekNumberSystem() const QString Locale::removeAcceleratorMarker(const QString &label) const { - return m_locale->removeAcceleratorMarker(label); + QString _l(label); + return _l.replace("&", ""); + //return m_locale->removeAcceleratorMarker(label); } void Locale::setDigitSet(Locale::DigitSet digitSet) diff --git a/src/declarativeimports/locale/locale_p.h b/src/declarativeimports/locale/locale_p.h index 5b4668f51..d90a11cc8 100644 --- a/src/declarativeimports/locale/locale_p.h +++ b/src/declarativeimports/locale/locale_p.h @@ -27,7 +27,7 @@ //KDE #include - +#include class QString; class QDate; class QTime; @@ -1547,7 +1547,7 @@ public: Q_INVOKABLE void reparseConfiguration(); private: - KLocale *m_locale; + KLocale* m_locale; Q_SIGNALS: void binaryUnitDialectChanged(); diff --git a/src/declarativeimports/locale/localebindingsplugin.cpp b/src/declarativeimports/locale/localebindingsplugin.cpp index 731fbfb06..71015d179 100644 --- a/src/declarativeimports/locale/localebindingsplugin.cpp +++ b/src/declarativeimports/locale/localebindingsplugin.cpp @@ -19,7 +19,7 @@ */ #include "localebindingsplugin.h" -#include +#include #include "locale_p.h" #include "calendarsystem.h" diff --git a/src/declarativeimports/locale/localebindingsplugin.h b/src/declarativeimports/locale/localebindingsplugin.h index 9f56d5baa..85b8fe16a 100644 --- a/src/declarativeimports/locale/localebindingsplugin.h +++ b/src/declarativeimports/locale/localebindingsplugin.h @@ -21,16 +21,15 @@ #ifndef LOCALEBINDINGSPLUGIN_H #define LOCALEBINDINGSPLUGIN_H -#include +#include -class LocaleBindingsPlugin : public QDeclarativeExtensionPlugin +class LocaleBindingsPlugin : public QQmlExtensionPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: void registerTypes(const char *uri); }; -Q_EXPORT_PLUGIN2(localebindingsplugin, LocaleBindingsPlugin) - #endif diff --git a/src/declarativeimports/plasmaextracomponents/CMakeLists.txt b/src/declarativeimports/plasmaextracomponents/CMakeLists.txt index 73a853010..5f55df55f 100644 --- a/src/declarativeimports/plasmaextracomponents/CMakeLists.txt +++ b/src/declarativeimports/plasmaextracomponents/CMakeLists.txt @@ -14,16 +14,14 @@ set(plasmaextracomponents_SRCS fallbackcomponent.cpp ) -# include_directories( -# ${KACTIVITIES_INCLUDE_DIRS} -# ) +include_directories( + ${KACTIVITIES_INCLUDE_DIRS} +) qt4_automoc(${plasmaextracomponents_SRCS}) add_library(plasmaextracomponentsplugin SHARED ${plasmaextracomponents_SRCS}) -#target_link_libraries(plasmaextracomponentsplugin ${QT_QTCORE_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} -# ${QT_QTGUI_LIBRARY} ${KDE4_PLASMA_LIBS} ${KACTIVITIES_LIBRARY} ) target_link_libraries(plasmaextracomponentsplugin ${QT_QTCORE_LIBRARY}