Commit 6c7ffdf8 authored by Sebastian Kügler's avatar Sebastian Kügler
Browse files

Bare-bones new Formats KCM

This forms a stab at the the new Locale settings, which need to be
transplanted to QLocale. Currently, this means much coarser setting,
that is no specific settings for the individual items, just a country
setting. From there, we can add back more fine-grained settings,
transplanted from the locale KCM.

Primarily, this makes language settings available to startkde, so the
LC_* variables can be exported.

This is currently non-functional, just a bare-bones KCM, loading a basic
UI file.

Run "kcmshell5 formats" to test.

CCBUG:331930
parent e081bf6f
......@@ -47,6 +47,7 @@ add_subdirectory(icons)
add_subdirectory(kded)
add_subdirectory(knotify)
add_subdirectory(locale)
add_subdirectory(formats)
add_subdirectory(spellchecking)
add_subdirectory(phonon)
add_subdirectory(workspaceoptions)
......
set(kcm_formats_PART_SRCS
kcmformats.cpp
)
kservice_desktop_to_json(formats.desktop)
qt5_wrap_ui(kcm_formats_PART_SRCS kcmformatswidget.ui )
add_library(kcm_formats MODULE ${kcm_formats_PART_SRCS})
target_link_libraries(kcm_formats Qt5::Core Qt5::DBus Qt5::Widgets KF5::I18n KF5::ConfigCore KF5::KCMUtils PW::KWorkspace)
install(TARGETS kcm_formats DESTINATION ${PLUGIN_INSTALL_DIR} )
########### install files ###############
install( FILES formats.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
#! /usr/bin/env bash
$EXTRACTRC *.ui >> rc.cpp
$XGETTEXT *.cpp -o $podir/kcmformats.pot
rm -f rc.cpp
[Desktop Entry]
Exec=kcmshell5 formats
Icon=preferences-desktop-locale
Type=Service
X-KDE-ServiceTypes=KCModule
X-DocPath=kcontrol/language/index.html
X-KDE-Library=kcm_formats
X-KDE-ParentApp=kcontrol
X-KDE-System-Settings-Parent-Category=locale
X-KDE-Weight=60
Name=Formats
Comment=Language, numeric, and time settings for your particular region
X-KDE-Keywords=language,translation,number format,locale,Country,charsets,character sets,Decimal symbol,Thousands separator,symbol,separator,sign,positive,negative,currency,money,fractional digits,calendar,time,date,formats,week,week start,first,paper,size,letter,A4,measure,metric,English,Imperial
Categories=Qt;KDE;X-KDE-settings-accessibility;
/*
* kcmformats.cpp
* Copyright 2014 Sebastian Kugler <sebas@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
*/
#include <QVBoxLayout>
#include <QDebug>
#include "ui_kcmformatswidget.h"
#include <QApplication>
#include "kcmformats.h"
#include <KPluginFactory>
#include <KLocalizedString>
K_PLUGIN_FACTORY_WITH_JSON(KCMFormatsFactory, "formats.json", registerPlugin<KCMFormats>();)
KCMFormats::KCMFormats(QWidget *parent, const QVariantList &args)
: KCModule(parent, args)
{
setQuickHelp( i18n("<h1>Formats</h1>"
" You can configure the formats used for time, dates, money and other numbers here."));
m_ui = new Ui::KCMFormatsWidget;
m_ui->setupUi(this);
}
void KCMFormats::load()
{
qDebug() << "Load.";
emit changed(false);
}
void KCMFormats::save()
{
qDebug() << "Formats save:";
}
void KCMFormats::defaults()
{
qDebug() << "Formats defaults:";
}
#include "kcmformats.moc"
[Desktop Entry]
Exec=kcmshell5 formats
Icon=preferences-desktop-locale
Type=Service
X-KDE-ServiceTypes=KCModule
X-DocPath=kcontrol/language/index.html
X-KDE-Library=kcm_formats
X-KDE-ParentApp=kcontrol
X-KDE-System-Settings-Parent-Category=locale
X-KDE-Weight=60
Name=Formats
Comment=Language, numeric, and time settings for your particular region
X-KDE-Keywords=language,translation,number format,locale,Country,charsets,character sets,Decimal symbol,Thousands separator,symbol,separator,sign,positive,negative,currency,money,fractional digits,calendar,time,date,formats,week,week start,first,paper,size,letter,A4,measure,metric,English,Imperial
Categories=Qt;KDE;X-KDE-settings-accessibility;
/*
* kcmformats.h
* Copyright 2014 Sebastian Kuegler <sebas@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
*/
#ifndef __kcmformats_h__
#define __kcmformats_h__
#include <kcmodule.h>
namespace Ui {
class KCMFormatsWidget;
}
class KCMFormats : public KCModule
{
Q_OBJECT
public:
explicit KCMFormats( QWidget *parent=0, const QVariantList &list=QVariantList() );
void load();
void save();
void defaults();
private:
Ui::KCMFormatsWidget* m_ui;
};
#endif
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KCMFormatsWidget</class>
<widget class="QWidget" name="KCMFormatsWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>627</width>
<height>508</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;h1&gt;Formats&lt;/h1&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>&lt;br/&gt;Country setting for formatting time, numbers, money, etc.&lt;br/&gt;&lt;br/&gt;</string>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Country:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="countriesCombo"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Example:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="exampleLabel">
<property name="text">
<string>Time: 12:00 AM&lt;br/&gt;Price: 23.99$&lt;br/&gt;Numbers: -12, 13.000, 1.2f&lt;br/&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KCMFormatsWidget</class>
<widget class="QWidget" name="KCMFormatsWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>627</width>
<height>508</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;h1&gt;Formats&lt;/h1&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>&lt;br/&gt;Country setting for formatting time, numbers, money, etc.&lt;br/&gt;&lt;br/&gt;</string>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Country:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="countriesCombo"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Example:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="exampleLabel">
<property name="text">
<string>Time: 12:00 AM&lt;br/&gt;Price: 23.99$&lt;br/&gt;Numbers: -12, 13.000, 1.2f&lt;br/&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment