Port, build Locale bindings

This enables 90% of the Locale bindings. Some translation-related things
need changing.
This commit is contained in:
Sebastian Kügler 2013-02-15 05:13:53 +01:00
parent e071a0fdd0
commit 19d9a2b88b
7 changed files with 48 additions and 33 deletions

View File

@ -4,4 +4,4 @@ add_subdirectory(core)
add_subdirectory(qtextracomponents) add_subdirectory(qtextracomponents)
add_subdirectory(plasmacomponents) add_subdirectory(plasmacomponents)
add_subdirectory(plasmaextracomponents) add_subdirectory(plasmaextracomponents)
#add_subdirectory(locale) add_subdirectory(locale)

View File

@ -1,25 +1,27 @@
project(localebindings) project(localebindings)
include(KDE4Defaults) # include(KDE4Defaults)
#
set(localebindings_SRCS set(localebindings_SRCS
locale.cpp locale.cpp
localebindingsplugin.cpp localebindingsplugin.cpp
calendarsystem.cpp calendarsystem.cpp
) )
INCLUDE_DIRECTORIES( # INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR} # ${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR} # ${CMAKE_BINARY_DIR}
${KDE4_INCLUDES} # ${KDE4_INCLUDES}
) # )
qt4_automoc(${localebindings_SRCS}) qt4_automoc(${localebindings_SRCS})
add_library(localebindingsplugin SHARED ${localebindings_SRCS})
kde4_add_library(localebindingsplugin SHARED ${localebindings_SRCS}) target_link_libraries(localebindingsplugin
${QT_QTCORE_LIBRARY}
target_link_libraries(localebindingsplugin ${QT_QTDECLARATIVE_LIBRARY} ${KDE4_KDECORE_LIBRARY}) ${Qt5Quick_LIBRARIES}
${Qt5Qml_LIBRARIES}
install(TARGETS localebindingsplugin DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/locale) ${KDE4_KDECORE_LIBS}
install(FILES qmldir DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/locale) )
install(TARGETS localebindingsplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/locale)
install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/locale)

View File

@ -22,12 +22,17 @@
#include "locale_p.h" #include "locale_p.h"
//KDE //KDE
#include <KGlobal> #include <KLocale>
#include <QLocale>
//Qt
#include <QDebug>
Locale::Locale(QObject* parent) Locale::Locale(QObject* parent)
: QObject(parent) : QObject(parent)
{ {
m_locale = KGlobal::locale(); //m_locale = KGlobal::locale();
m_locale = KLocale::global();
} }
bool Locale::setCountryDivisionCode(const QString &countryDivisionCode) bool Locale::setCountryDivisionCode(const QString &countryDivisionCode)
@ -45,7 +50,10 @@ void Locale::setCurrencyCode(const QString &newCurrencyCode)
bool Locale::isApplicationTranslatedInto(const QString &lang) 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, 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 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<int> Locale::allDigitSetsList() const QList<int> Locale::allDigitSetsList() const
@ -483,7 +494,10 @@ QString Locale::defaultCurrencyCode()
bool Locale::useTranscript() const 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 int Locale::fileEncodingMib() const
@ -540,7 +554,9 @@ Locale::WeekNumberSystem Locale::weekNumberSystem() const
QString Locale::removeAcceleratorMarker(const QString &label) 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) void Locale::setDigitSet(Locale::DigitSet digitSet)

View File

@ -27,7 +27,7 @@
//KDE //KDE
#include <KLocale> #include <KLocale>
#include <QLocale>
class QString; class QString;
class QDate; class QDate;
class QTime; class QTime;
@ -1547,7 +1547,7 @@ public:
Q_INVOKABLE void reparseConfiguration(); Q_INVOKABLE void reparseConfiguration();
private: private:
KLocale *m_locale; KLocale* m_locale;
Q_SIGNALS: Q_SIGNALS:
void binaryUnitDialectChanged(); void binaryUnitDialectChanged();

View File

@ -19,7 +19,7 @@
*/ */
#include "localebindingsplugin.h" #include "localebindingsplugin.h"
#include <QtDeclarative/qdeclarative.h> #include <QtQml>
#include "locale_p.h" #include "locale_p.h"
#include "calendarsystem.h" #include "calendarsystem.h"

View File

@ -21,16 +21,15 @@
#ifndef LOCALEBINDINGSPLUGIN_H #ifndef LOCALEBINDINGSPLUGIN_H
#define LOCALEBINDINGSPLUGIN_H #define LOCALEBINDINGSPLUGIN_H
#include <QDeclarativeExtensionPlugin> #include <QQmlExtensionPlugin>
class LocaleBindingsPlugin : public QDeclarativeExtensionPlugin class LocaleBindingsPlugin : public QQmlExtensionPlugin
{ {
Q_OBJECT Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
public: public:
void registerTypes(const char *uri); void registerTypes(const char *uri);
}; };
Q_EXPORT_PLUGIN2(localebindingsplugin, LocaleBindingsPlugin)
#endif #endif

View File

@ -14,16 +14,14 @@ set(plasmaextracomponents_SRCS
fallbackcomponent.cpp fallbackcomponent.cpp
) )
# include_directories( include_directories(
# ${KACTIVITIES_INCLUDE_DIRS} ${KACTIVITIES_INCLUDE_DIRS}
# ) )
qt4_automoc(${plasmaextracomponents_SRCS}) qt4_automoc(${plasmaextracomponents_SRCS})
add_library(plasmaextracomponentsplugin SHARED ${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 target_link_libraries(plasmaextracomponentsplugin
${QT_QTCORE_LIBRARY} ${QT_QTCORE_LIBRARY}