Commit 38c55b4c authored by Bhushan Shah's avatar Bhushan Shah 📱
Browse files

kcms: remove the KCMS moved in plasma-workspace

They are moved to plasma-workspace with bc113eb43805439202369d72fcb6d690768135e2
parent 7affae24
......@@ -18,8 +18,6 @@ ecm_optional_add_subdirectory(mouse)
ecm_optional_add_subdirectory(paths)
ecm_optional_add_subdirectory(kcmsmserver)
ecm_optional_add_subdirectory(kcmlaunchfeedback)
ecm_optional_add_subdirectory(notifications)
ecm_optional_add_subdirectory(formats)
ecm_optional_add_subdirectory(spellchecking)
ecm_optional_add_subdirectory(componentchooser)
ecm_optional_add_subdirectory(kded)
......
########### install files ###############
kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR kcontrol/formats)
<?xml version="1.0" ?>
<!DOCTYPE article PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN"
"dtd/kdedbx45.dtd" [
<!ENTITY % addindex "IGNORE">
<!ENTITY % English "INCLUDE" > <!-- change language only here -->
]>
<article id="formats" lang="&language;">
<articleinfo>
<title>Formats</title>
<authorgroup>
<author>&Mike.McBride; &Mike.McBride.mail;</author>
<author>&Krishna.Tateneni; &Krishna.Tateneni.mail;</author>
<!-- TRANS:ROLES_OF_TRANSLATORS -->
</authorgroup>
<date>2015-05-18</date>
<releaseinfo>Plasma 5.3</releaseinfo>
<keywordset>
<keyword>KDE</keyword>
<keyword>Systemsettings</keyword>
<keyword>locale</keyword>
<keyword>country</keyword>
<keyword>language</keyword>
<keyword>number</keyword>
<keyword>currency</keyword>
</keywordset>
</articleinfo>
<para>
This module of the &kde; &systemsettings; allows you to select customization
options that depend on the region of the world that you happen to live in.
</para>
<para>
In most cases, you can simply select the region, and all
options will be set in an appropriate manner.
</para>
<para>
On the bottom of this module you can see examples how the settings look
like and which measurement units are used. In addition to numbers, you can see
how currency values, dates, and times in long and short format are displayed.
When you change any of the settings, the preview shows the effects of the
changes before you apply them.
</para>
<para>
The <guilabel>Region</guilabel> drop down box contains the list of available
countries and will initially show your currently selected country. If the
selection shows <quote>Default</quote> then you have not set a country
and are defaulting to the Country set by the system, which will also be shown.
</para>
<para>
In case you need different individual settings enable <guilabel>Detailed Settings</guilabel>
and select the country format for <guilabel>Numbers</guilabel>, <guilabel>Time</guilabel>,
<guilabel>Currency</guilabel>, <guilabel>Measurement Units</guilabel> or
<guilabel>Collation and Sorting</guilabel> rules from the drop down boxes.
</para>
</article>
########### install files ###############
kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR kcontrol/notifications)
<?xml version="1.0" ?>
<!DOCTYPE article PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN"
"dtd/kdedbx45.dtd" [
<!ENTITY % addindex "IGNORE">
<!ENTITY % English "INCLUDE" > <!-- change language only here -->
]>
<article id="kcmnotify" lang="&language;">
<title>System Notification Settings</title>
<articleinfo>
<authorgroup>
<author>&Mike.McBride; &Mike.McBride.mail;</author>
<author><personname><firstname>Kai Uwe</firstname> <surname>Broulik</surname></personname> <email>kde@broulik.de</email></author>
<!-- TRANS:ROLES_OF_TRANSLATORS -->
</authorgroup>
<date>2021-04-16</date>
<releaseinfo>Plasma 5.21</releaseinfo>
<keywordset>
<keyword>KDE</keyword>
<keyword>Systemsettings</keyword>
<keyword>system notification</keyword>
<keyword>notification</keyword>
</keywordset>
</articleinfo>
<sect1 id="sys-notify">
<title>System Notification Settings</title>
<para>&plasma;, like all applications, needs to inform the user when a
problem occurs, a task is completed, or something has happened. &plasma;
uses a set of <quote>System Notifications</quote> to keep the user
informed on what is happening.</para>
<para>Using this module, you can determine what &plasma; does to communicate
each event.</para>
<sect2 id="notification-settings">
<title>Notification Settings</title>
<sect3 id="do-not-disturb">
<title>Do Not Disturb mode</title>
<para>This mode disables all visual and most audible notifications to let you focus on your current task. Settings in this section let you configure under which circumstances &plasma; automatically enables do not disturb mode.</para>
<variablelist>
<varlistentry>
<term><guiicon>Enable when screens are mirrored</guiicon></term>
<listitem><para>Automatically enable do not disturb mode when you mirror your screens, for example during a presentation.</para></listitem>
</varlistentry>
<varlistentry>
<term><guiicon>Enable while screen sharing</guiicon></term>
<listitem><para>Automatically enable do not disturb mode when you share your screens, for example during an online lecture.</para></listitem>
</varlistentry>
<varlistentry>
<term><guiicon>Show critical notifications</guiicon></term>
<listitem><para>Whether to show critical notifications, such as your battery is almost empty, to show even when in do not disturb mode.</para></listitem>
</varlistentry>
<varlistentry>
<term><guiicon>Toggle with:</guiicon></term>
<listitem><para>A global shortcut you can press to enable and disable do not disturb mode anytime.</para></listitem>
</varlistentry>
</variablelist>
</sect3>
<sect3 id="notification-filters">
<title>Filters</title>
<variablelist>
<varlistentry>
<term>Critical notifications: <guiicon>Always keep on top</guiicon></term>
<listitem><para>Keep critical notifications, such as your battery is almost empty, always on top. This ensures they will also be visible while watching a fullscreen video or giving a presentation.</para></listitem>
</varlistentry>
<varlistentry>
<term>Normal notifications: <guiicon>Always keep on top</guiicon></term>
<listitem><para>Keep normal notifications, such as messages, always on top. This ensures they will also be visible while watching a fullscreen video or giving a presentation.</para></listitem>
</varlistentry>
<varlistentry>
<term>Low priority notifications: <guiicon>Show popup</guiicon> and <guiicon>Show in history</guiicon></term>
<listitem><para>Whether low priority notifications, such as track changes in your media player, will be shown as popups or in the history, respectively.</para></listitem>
</varlistentry>
</variablelist>
</sect3>
<sect3 id="notification-behavior">
<title>Behavior</title>
<variablelist>
<varlistentry>
<term>Popup: <guiicon>Show near notification icon</guiicon></term>
<listitem><para>Show notification popups close to where your notification icon is located in your panel.</para></listitem>
</varlistentry>
<varlistentry>
<term><guiicon>Choose Custom Position...</guiicon></term>
<listitem><para>Lets you choose a fixed screen corner where notification popups will be positioned.</para></listitem>
</varlistentry>
<varlistentry>
<term><guiicon>Hide after:</guiicon></term>
<listitem><para>After how many seconds the notification popup will automatically disappear. You can choose anywhere between 1 and 120 seconds.</para></listitem>
</varlistentry>
</variablelist>
</sect3>
<sect3 id="progress-and-badges">
<title>Application Progress and Badges</title>
<sect4 id="application-progress">
<title>Application progress</title>
<para>Options in this section control how application progress, such as copying or downloading a file, is presented.</para>
<variablelist>
<varlistentry>
<term><guiicon>Show in task manager</guiicon></term>
<listitem><para>Colorize the window in the panel based on the progress.</para></listitem>
</varlistentry>
<varlistentry>
<term><guiicon>Show in notifications</guiicon></term>
<listitem><para>Show a notification popup during the progress.</para></listitem>
</varlistentry>
<varlistentry>
<term><guiicon>Keep popup open during progress</guiicon></term>
<listitem><para>Whether the popup should remain visible for the entire duration of the progress or automatically hide. It will always be shown again when the task finishes or fails.</para></listitem>
</varlistentry>
</variablelist>
</sect4>
<sect4 id="badges">
<title>Notification badges</title>
<variablelist>
<varlistentry>
<term><guiicon>Show in task manager</guiicon></term>
<listitem><para>Let applications show badges, such as an unread message count, in the panel.</para></listitem>
</varlistentry>
</variablelist>
</sect4>
</sect3>
</sect2>
<sect2 id="application-settings">
<title>Application Settings</title>
<para>Clicking the <guilabel>Configure...</guilabel> button at the end of the list opens the application settings page which lets you configure notification behavior on a per-application and per-service basis.</para>
<para>Use the sidebar on the left to choose an entry from the <guilabel>Applications</guilabel> or <guilabel>System Services</guilabel> category.</para>
<para>General warning popups as well as startup and shutdown sounds are located under the <guilabel>Plasma Workspace</guilabel> service.</para>
<para>Applications that do not provide proper identification, such as shell scripts, can be configured using the <guilabel>Other Applications</guilabel> entry.</para>
<variablelist>
<varlistentry>
<term><guiicon>Show popups</guiicon></term>
<listitem><para>Whether this application may show popup notifications.</para></listitem>
</varlistentry>
<varlistentry>
<term><guiicon>Show in do not disturb mode</guiicon></term>
<listitem><para>Whether this application may show popup notifications even when in do not disturb mode.</para></listitem>
</varlistentry>
<varlistentry>
<term><guiicon>Show in history</guiicon></term>
<listitem><para>Whether this application's notifications will be kept in the notification history.</para></listitem>
</varlistentry>
<varlistentry>
<term><guiicon>Show notification badges</guiicon></term>
<listitem><para>Whether this application may show badges, such as an unread message count, in the panel.</para></listitem>
</varlistentry>
<varlistentry>
<term><guiicon>Configure Events...</guiicon></term>
<listitem><para>For &kde; applications you can also configure each notification individually.</para></listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>
</article>
......@@ -16,7 +16,6 @@ add_subdirectory( launch )
add_subdirectory( landingpage )
add_subdirectory( keys )
add_subdirectory( ksmserver )
add_subdirectory( nightcolor )
add_subdirectory( users )
if (CMAKE_SYSTEM_NAME MATCHES Linux)
......@@ -29,8 +28,6 @@ add_subdirectory( desktoppaths )
add_subdirectory(activities)
add_subdirectory(componentchooser)
add_subdirectory(kded)
add_subdirectory(formats)
add_subdirectory(notifications)
add_subdirectory(runners)
add_subdirectory(spellchecking)
add_subdirectory(qtquicksettings)
......
# KI18N Translation Domain for this library
add_definitions(-DTRANSLATION_DOMAIN=\"kcmformats\")
set(kcm_formats_PART_SRCS
kcmformats.cpp
)
ki18n_wrap_ui(kcm_formats_PART_SRCS kcmformatswidget.ui )
add_library(kcm_formats MODULE ${kcm_formats_PART_SRCS})
kcoreaddons_desktop_to_json(kcm_formats formats.desktop SERVICE_TYPES kcmodule.desktop)
target_link_libraries(kcm_formats Qt::Core Qt::DBus Qt::Widgets KF5::I18n KF5::ConfigCore KF5::KCMUtils)
install(TARGETS kcm_formats DESTINATION ${KDE_INSTALL_PLUGINDIR} )
########### install files ###############
install( FILES formats.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} )
#! /usr/bin/env bash
$EXTRACTRC *.ui >> rc.cpp
$XGETTEXT *.cpp -o $podir/kcmformats.pot
rm -f rc.cpp
This diff is collapsed.
/*
* kcmformats.cpp
* Copyright 2014 Sebastian Kügler <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
*/
// own
#include "kcmformats.h"
#include "ui_kcmformatswidget.h"
// Qt
#include <QApplication>
#include <QComboBox>
#include <QDebug>
#include <QFile>
#include <QLocale>
#include <QStandardPaths>
#include <QTextCodec>
// Frameworks
#include <KLocalizedString>
#include <KMessageBox>
#include <KPluginFactory>
#include <KSharedConfig>
K_PLUGIN_CLASS_WITH_JSON(KCMFormats, "formats.json")
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);
m_combos << m_ui->comboGlobal << m_ui->comboNumbers << m_ui->comboTime << m_ui->comboCurrency << m_ui->comboMeasurement << m_ui->comboCollate;
}
KCMFormats::~KCMFormats()
{
delete m_ui;
}
bool countryLessThan(const QLocale &c1, const QLocale &c2)
{
// Ensure that the "Default (C)" locale always appears at the top
if (c1.name() == QLatin1Char('C') && c2.name() != QLatin1String("C"))
return true;
if (c2.name() == QLatin1Char('C'))
return false;
const QString ncn1 = !c1.nativeCountryName().isEmpty() ? c1.nativeCountryName() : QLocale::countryToString(c1.country());
const QString ncn2 = !c2.nativeCountryName().isEmpty() ? c2.nativeCountryName() : QLocale::countryToString(c2.country());
return QString::localeAwareCompare(ncn1, ncn2) < 0;
}
void KCMFormats::load()
{
QList<QLocale> allLocales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyCountry);
std::sort(allLocales.begin(), allLocales.end(), countryLessThan);
for (QComboBox *combo : qAsConst(m_combos)) {
initCombo(combo, allLocales);
}
readConfig();
for (QComboBox *combo : qAsConst(m_combos)) {
connectCombo(combo);
}
connect(m_ui->checkDetailed, &QAbstractButton::toggled, [=]() {
updateExample();
updateEnabled();
emit changed(true);
});
updateEnabled();
updateExample();
emit changed(false);
}
void KCMFormats::initCombo(QComboBox *combo, const QList<QLocale> &allLocales)
{
combo->clear();
const QString clabel = i18n("No change");
combo->addItem(clabel, QString());
for (const auto &locale : allLocales) {
addLocaleToCombo(combo, locale);
}
}
void KCMFormats::connectCombo(QComboBox *combo)
{
connect(combo, &QComboBox::currentTextChanged, [=]() {
emit changed(true);
updateExample();
});
}
void KCMFormats::addLocaleToCombo(QComboBox *combo, const QLocale &locale)
{
const QString clabel = !locale.nativeCountryName().isEmpty() ? locale.nativeCountryName() : QLocale::countryToString(locale.country());
// This needs to use name() rather than bcp47name() or later on the export will generate a non-sense locale (e.g. "it" instead of
// "it_IT")
// TODO: Properly handle scripts (@foo)
QString cvalue = locale.name();
if (!cvalue.contains(QLatin1Char('.')) && cvalue != QLatin1Char('C')) {
// explicitly add the encoding,
// otherwise Qt doesn't accept dead keys and garbles the output as well
cvalue.append(QLatin1Char('.') + QTextCodec::codecForLocale()->name());
}
QString flagcode;
const QStringList split = locale.name().split(QLatin1Char('_'));
if (split.count() > 1) {
flagcode = split[1].toLower();
}
QIcon flagIcon = loadFlagIcon(flagcode);
const QString nativeLangName = locale.nativeLanguageName();
if (!nativeLangName.isEmpty()) {
combo->addItem(flagIcon, i18n("%1 - %2 (%3)", clabel, nativeLangName, locale.name()), cvalue);
} else {
combo->addItem(flagIcon, i18n("%1 (%2)", clabel, locale.name()), cvalue);
}
}
void setCombo(QComboBox *combo, const QString &key)
{
const int ix = combo->findData(key);
if (ix > -1) {
combo->setCurrentIndex(ix);
}
}
QIcon KCMFormats::loadFlagIcon(const QString &flagCode)
{
QIcon icon = m_cachedFlags.value(flagCode);
if (!icon.isNull()) {
return icon;
}
QString flag(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kf5/locale/countries/%1/flag.png").arg(flagCode)));
if (!flag.isEmpty()) {
icon = QIcon(flag);
} else {
if (m_cachedUnknown.isNull()) {
m_cachedUnknown = QIcon::fromTheme("unknown");
}
icon = m_cachedUnknown;
}
m_cachedFlags.insert(flagCode, icon);
return icon;
}
const static QString configFile = QStringLiteral("plasma-localerc");
const static QString exportFile = QStringLiteral("plasma-locale-settings.sh");
const static QString lcLang = QStringLiteral("LANG");
const static QString lcNumeric = QStringLiteral("LC_NUMERIC");
const static QString lcTime = QStringLiteral("LC_TIME");
const static QString lcMonetary = QStringLiteral("LC_MONETARY");
const static QString lcMeasurement = QStringLiteral("LC_MEASUREMENT");
const static QString lcCollate = QStringLiteral("LC_COLLATE");
const static QString lcCtype = QStringLiteral("LC_CTYPE");
const static QString lcLanguage = QStringLiteral("LANGUAGE");
void KCMFormats::readConfig()
{
m_config = KConfigGroup(KSharedConfig::openConfig(configFile), "Formats");
bool useDetailed = m_config.readEntry("useDetailed", false);
m_ui->checkDetailed->setChecked(useDetailed);
setCombo(m_ui->comboGlobal, m_config.readEntry(lcLang, qgetenv(lcLang.toLatin1())));
setCombo(m_ui->comboNumbers, m_config.readEntry(lcNumeric, qgetenv(lcNumeric.toLatin1())));
setCombo(m_ui->comboTime, m_config.readEntry(lcTime, qgetenv(lcTime.toLatin1())));
setCombo(m_ui->comboCollate, m_config.readEntry(lcCollate, qgetenv(lcCollate.toLatin1())));
setCombo(m_ui->comboCurrency, m_config.readEntry(lcMonetary, qgetenv(lcMonetary.toLatin1())));
setCombo(m_ui->comboMeasurement, m_config.readEntry(lcMeasurement, qgetenv(lcMeasurement.toLatin1())));
updateEnabled();
}
void KCMFormats::writeConfig()
{
m_config = KConfigGroup(KSharedConfig::openConfig(configFile), "Formats");
// global ends up empty here when OK button is clicked from kcmshell5,
// apparently the data in the combo is gone by the time save() is called.
// This might be a problem in KCModule, but does not directly affect us
// since within systemsettings, it works fine.
// See https://bugs.kde.org/show_bug.cgi?id=334624
if (m_ui->comboGlobal->count() == 0) {
qWarning() << "Couldn't read data from UI, writing configuration failed.";
return;
}
const QString global = m_ui->comboGlobal->currentData().toString();
if (!m_ui->checkDetailed->isChecked()) {
// Global setting, clean up config
m_config.deleteEntry("useDetailed");
if (global.isEmpty()) {
m_config.deleteEntry(lcLang);
} else {
m_config.writeEntry(lcLang, global);
}
m_config.deleteEntry(lcNumeric);
m_config.deleteEntry(lcTime);
m_config.deleteEntry(lcMonetary);
m_config.deleteEntry(lcMeasurement);
m_config.deleteEntry(lcCollate);
m_config.deleteEntry(lcCtype);
} else {
// Save detailed settings
m_config.writeEntry("useDetailed", true);
if (global.isEmpty()) {
m_config.deleteEntry(lcLang);
} else {
m_config.writeEntry(lcLang, global);
}
const QString numeric = m_ui->comboNumbers->currentData().toString();
if (numeric.isEmpty()) {
m_config.deleteEntry(lcNumeric);
} else {
m_config.writeEntry(lcNumeric, numeric);
}
const QString time = m_ui->comboTime->currentData().toString();
if (time.isEmpty()) {
m_config.deleteEntry(lcTime);
} else {
m_config.writeEntry(lcTime, time);
}
const QString monetary = m_ui->comboCurrency->currentData().toString();
if (monetary.isEmpty()) {
m_config.deleteEntry(lcMonetary);
} else {
m_config.writeEntry(lcMonetary, monetary);
}
const QString measurement = m_ui->comboMeasurement->currentData().toString();
if (measurement.isEmpty()) {
m_config.deleteEntry(lcMeasurement);
} else {
m_config.writeEntry(lcMeasurement, measurement);
}
const QString collate = m_ui->comboCollate->currentData().toString();
if (collate.isEmpty()) {
m_config.deleteEntry(lcCollate);
} else {
m_config.writeEntry(lcCollate, collate);
}