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(plasmacomponents)
add_subdirectory(plasmaextracomponents)
#add_subdirectory(locale)
add_subdirectory(locale)

View File

@ -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)

View File

@ -22,12 +22,17 @@
#include "locale_p.h"
//KDE
#include <KGlobal>
#include <KLocale>
#include <QLocale>
//Qt
#include <QDebug>
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<int> 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)

View File

@ -27,7 +27,7 @@
//KDE
#include <KLocale>
#include <QLocale>
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();

View File

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

View File

@ -21,16 +21,15 @@
#ifndef LOCALEBINDINGSPLUGIN_H
#define LOCALEBINDINGSPLUGIN_H
#include <QDeclarativeExtensionPlugin>
#include <QQmlExtensionPlugin>
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

View File

@ -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}