I have made the following changes intended for : nemo:devel:mw / mlite Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below.
https://build.merproject.org//request/show/148 Thank You, Robin Burchell [This message was auto-generated] --- Request # 148: Messages from BOSS: State: review at 2013-04-02T11:20:52 by cibot Reviews: accepted by cibot : Prechecks succeeded. new for nemo:devel:mw : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: home:w00t:branches:nemo:devel:mw / mlite -> nemo:devel:mw / mlite changes files: -------------- --- mlite.changes +++ mlite.changes @@ -0,0 +1,5 @@ +* Tue Nov 20 2012 Vesa Halttunen <[email protected]> - 0.1.0 +- Bring back support for Harmattan style translation in desktop files (from Vesa) +- Remove unnecessary linking against QtGui (from Robin) +- Make rpmlint happy (from Robin) + old: ---- 0001-remove-API-which-will-block-use-of-dconf.patch mlite-0.0.10.tar.bz2 new: ---- mlite-0.1.0.tar.bz2 spec files: ----------- --- mlite.spec +++ mlite.spec @@ -9,14 +9,13 @@ # << macros Summary: Useful classes originating from MeeGo Touch -Version: 0.0.10 +Version: 0.1.0 Release: 1 Group: System/Libraries License: LGPL v2.1 URL: http://www.meego.com Source0: %{name}-%{version}.tar.bz2 Source100: mlite.yaml -Patch0: 0001-remove-API-which-will-block-use-of-dconf.patch Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig BuildRequires: pkgconfig(QtDBus) @@ -30,7 +29,7 @@ %package devel -Summary: mlite development package +Summary: Development package for mlite Group: System/Libraries Requires: %{name} = %{version}-%{release} @@ -42,8 +41,6 @@ %prep %setup -q -n %{name} -# 0001-remove-API-which-will-block-use-of-dconf.patch -%patch0 -p1 # >> setup # << setup other changes: -------------- ++++++ mlite-0.0.10.tar.bz2 -> mlite-0.1.0.tar.bz2 --- .gitignore +++ .gitignore @@ -0,0 +1,8 @@ +*~ +*.o +*.so* +Makefile +*.pro.user +.moc +.obj +mnotificationmanagerproxy.* --- mdesktopentry.cpp +++ mdesktopentry.cpp @@ -2,11 +2,9 @@ ** This file was derived from the MDesktopEntry implementation in the ** libmeegotouch library. ** -** Original Copyright: -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** -** Copyright on new work: -** Copyright 2011 Intel Corp. +** Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Intel Corp. +** Copyright (C) 2012, 2013 Jolla Ltd. ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public @@ -19,7 +17,8 @@ #include <QRegExp> #include <QFile> #include <QStringList> -#include <QLocale> +#include <QCoreApplication> +#include <QTranslator> #include <QTextStream> #include <QTextCodec> #include <QDebug> @@ -49,6 +48,7 @@ const QString LogicalIdKey("Desktop Entry/X-MeeGo-Logical-Id"); const QString TranslationCatalogKey("Desktop Entry/X-MeeGo-Translation-Catalog"); const QString XMaemoServiceKey("Desktop Entry/X-Maemo-Service"); +QMap<QString, QSharedPointer<QTranslator> > MDesktopEntryPrivate::translators; // The syntax of the locale string in the POSIX environment variables // related to locale is: @@ -75,25 +75,13 @@ if (regexp.indexIn(localeString) == 0 && regexp.capturedTexts().size() == 6) { // size of regexp pattern above - - *language = regexp.capturedTexts().at(1); // language - - // POSIX locale modifier, interpreted as script - if (!regexp.capturedTexts().at(5).isEmpty()) - *script = regexp.capturedTexts().at(5); - else - *script = ""; - - if (!regexp.capturedTexts().at(3).isEmpty()) - *country = regexp.capturedTexts().at(3); // country - else - *country = ""; - } - else - { - *language = ""; - *script = ""; - *country = ""; + *language = regexp.capturedTexts().at(1); + *script = regexp.capturedTexts().at(5); + *country = regexp.capturedTexts().at(3); + } else { + *language = QString(); + *script = QString(); + *country = QString(); } } @@ -105,12 +93,27 @@ QFile file(fileName); //Checks if the file exists and opens it in readonly mode - if (file.exists() && file.open(QIODevice::ReadOnly)) - { - readDesktopFile(file, desktopEntriesMap); - } - else - { + if (file.exists() && file.open(QIODevice::ReadOnly)) { + if (readDesktopFile(file, desktopEntriesMap)) { + // Load the translation catalog if it has been defined for the entry. + if (desktopEntriesMap.contains(TranslationCatalogKey)) { + // Load the catalog from disk if it's not yet loaded + QString catalog = desktopEntriesMap.value(TranslationCatalogKey); + QString engineeringEnglishCatalog = catalog + "_eng_en"; + if (!translators.contains(engineeringEnglishCatalog)) { + translators[engineeringEnglishCatalog] = QSharedPointer<QTranslator>(new QTranslator(0)); + translators[engineeringEnglishCatalog]->load(engineeringEnglishCatalog, "/usr/share/translations"); + qApp->installTranslator(translators[engineeringEnglishCatalog].data()); + } + + if (!translators.contains(catalog)) { + translators[catalog] = QSharedPointer<QTranslator>(new QTranslator(0)); + translators[catalog]->load(QLocale(), catalog, "-", "/usr/share/translations"); + qApp->installTranslator(translators[catalog].data()); + } + } + } + } else { qDebug() << "Specified Desktop file does not exist" << fileName; } } @@ -121,6 +124,13 @@ bool MDesktopEntryPrivate::readDesktopFile(QIODevice &device, QMap<QString, QString> &desktopEntriesMap) { + valid = MDesktopEntry::readDesktopFile(device, desktopEntriesMap); + return valid; +} + +bool MDesktopEntry::readDesktopFile(QIODevice &device, QMap<QString, QString> &desktopEntriesMap) +{ + bool valid = true; // Group header is of form [groupname] // The group name is captured // Group names may contain all ASCII characters except for [ and ] and control characters @@ -307,15 +317,24 @@ QString MDesktopEntry::name() const { QString name = value(NameKey); - QString lang, script, country, postfixKey; - - parsePosixLang(getenv("LANG"), &lang, &country, &script); - if (contains(postfixKey = NameKey + '[' + lang + '_' + country + '@' + script + ']') || - contains(postfixKey = NameKey + '[' + lang + '_' + country + ']') || - contains(postfixKey = NameKey + '[' + lang + ']')) { - // Use the freedesktop.org standard localization style - name = value(postfixKey); + if (contains(LogicalIdKey)) { + name = qtTrId(value(LogicalIdKey).toAscii().data()); + } else { + QString lang, variant, country, postfixKey; + + parsePosixLang(getenv("LANG"), &lang, &country, &variant); + if (contains(postfixKey = NameKey + '[' + lang + '_' + + country + '@' + + variant + ']') || + contains(postfixKey = NameKey + '[' + lang + '_' + + country + ']') || + contains(postfixKey = NameKey + '[' + lang + '@' + + variant + ']') || + contains(postfixKey = NameKey + '[' + lang + ']')) { + // Use the freedesktop.org standard localization style + name = value(postfixKey); + } } return name; --- mdesktopentry.h +++ mdesktopentry.h @@ -2,11 +2,9 @@ ** This file was derived from the MDesktopEntry implementation in the ** libmeegotouch library. ** -** Original Copyright: -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** -** Copyright on new work: -** Copyright 2011 Intel Corp. +** Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Intel Corp. +** Copyright (C) 2012, 2013 Jolla Ltd. ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public @@ -230,6 +228,15 @@ */ bool contains(const QString &group, const QString &key) const; + /*! + * Parses a desktop entry file. + * + * \param device the QIODevice to read the desktop file from + * \param map the QMap to store key-value pairs to + * \return true if desktop file can be parsed + */ + static bool readDesktopFile(QIODevice &device, QMap<QString, QString> &desktopEntriesMap); + protected: /*! \internal */ //! Pointer to the private class --- mdesktopentry_p.h +++ mdesktopentry_p.h @@ -1,13 +1,10 @@ /*************************************************************************** +** This file was derived from the MDesktopEntry implementation in the +** libmeegotouch library. ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation ([email protected]) -** -** This file is part of libmeegotouch. -** -** If you have questions regarding the use of this file, please contact -** Nokia at [email protected]. +** Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Intel Corp. +** Copyright (C) 2012, 2013 Jolla Ltd. ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public @@ -20,7 +17,10 @@ #ifndef MDESKTOPENTRY_P_H #define MDESKTOPENTRY_P_H +#include <QSharedPointer> + class MDesktopEntry; +class QTranslator; /*! * MDesktopEntryPrivate is the private class for MDesktopEntry. @@ -57,6 +57,9 @@ //! A map for storing the desktop entries keys and their corresponding values QMap<QString, QString> desktopEntriesMap; + //! A map for storing translators for translation catalogs + static QMap<QString, QSharedPointer<QTranslator> > translators; + /*! * Returns the boolean value of a key. * --- mgconfitem.cpp +++ mgconfitem.cpp @@ -311,54 +311,6 @@ set(QVariant()); } -QList<QString> MGConfItem::listDirs() const -{ - QList<QString> children; - - withClient(client) { - QByteArray k = convertKey(priv->key); - GError *error = NULL; - GSList *dirs = gconf_client_all_dirs(client, k.data(), &error); - if(error) { - qDebug() << error->message; - g_error_free(error); - return children; - } - - for (GSList *d = dirs; d; d = d->next) { - children.append(convertKey((char *)d->data)); - g_free(d->data); - } - g_slist_free(dirs); - } - - return children; -} - -QList<QString> MGConfItem::listEntries() const -{ - QList<QString> children; - - withClient(client) { - QByteArray k = convertKey(priv->key); - GError *error = NULL; - GSList *entries = gconf_client_all_entries(client, k.data(), &error); - if(error) { - qDebug() << error->message; - g_error_free(error); - return children; - } - - for (GSList *e = entries; e; e = e->next) { - children.append(convertKey(((GConfEntry *)e->data)->key)); - gconf_entry_free((GConfEntry *)e->data); - } - g_slist_free(entries); - } - - return children; -} - MGConfItem::MGConfItem(const QString &key, QObject *parent) : QObject(parent) { --- mgconfitem.h +++ mgconfitem.h @@ -113,23 +113,6 @@ */ void unset(); - /*! Return a list of the directories below this item. The - returned strings are absolute key names like - "/myapp/settings". - - A directory is a key that has children. The same key might - also have a value, but that is confusing and best avoided. - */ - QList<QString> listDirs() const; - - /*! Return a list of entries below this item. The returned - strings are absolute key names like "/myapp/settings/first". - - A entry is a key that has a value. The same key might also - have children, but that is confusing and is best avoided. - */ - QList<QString> listEntries() const; - Q_SIGNALS: /*! Emitted when the value of this item has changed. */ --- mlite.pro +++ mlite.pro @@ -22,7 +22,6 @@ } equals(QT_MAJOR_VERSION, 4) { - QT += gui include(json/json.pri) SOURCES += mnotificationmanagerproxy.cpp \ mnotification.cpp \ @@ -81,7 +80,7 @@ INSTALLS += target headers pcfiles TRANSLATIONS += $${SOURCES} $${HEADERS} $${OTHER_FILES} -VERSION = 0.0.10 +VERSION = 0.1.0 PROJECT_NAME = mlite dist.commands += rm -fR $${PROJECT_NAME}-$${VERSION} && --- tools/mlitenotificationtool/.gitignore +++ tools/mlitenotificationtool/.gitignore @@ -0,0 +1 @@ +mlitenotificationtool ++++++ mlite.yaml --- mlite.yaml +++ mlite.yaml @@ -1,14 +1,12 @@ Name: mlite Summary: Useful classes originating from MeeGo Touch -Version: 0.0.10 +Version: 0.1.0 Release: 1 Group: System/Libraries License: LGPL v2.1 URL: http://www.meego.com Sources: - "%{name}-%{version}.tar.bz2" -Patches: - - 0001-remove-API-which-will-block-use-of-dconf.patch Description: | Select set of useful classes from meegotouch that do not require taking in all of meegotouch. @@ -24,7 +22,7 @@ - "%{_libdir}/libmlite.so.*" SubPackages: - Name: devel - Summary: mlite development package + Summary: Development package for mlite Group: System/Libraries Files: - "%{_includedir}/mlite" ++++++ deleted files: --- 0001-remove-API-which-will-block-use-of-dconf.patch
