diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,9 +34,9 @@ CoreAddons Declarative DBusAddons + IconThemes KIO I18n - IconThemes NetworkManagerQt Notifications Plasma @@ -47,6 +47,8 @@ WindowSystem ) +find_package(KF5Emoticons CONFIG REQUIRED) + find_package(KF5ModemManagerQt ${KF5_MIN_VERSION}) set_package_properties(KF5ModemManagerQt PROPERTIES TYPE OPTIONAL) diff --git a/applet/contents/ui/ConnectionItem.qml b/applet/contents/ui/ConnectionItem.qml --- a/applet/contents/ui/ConnectionItem.qml +++ b/applet/contents/ui/ConnectionItem.qml @@ -83,8 +83,8 @@ elide: Text.ElideRight font.weight: ConnectionState == PlasmaNM.Enums.Activated ? Font.DemiBold : Font.Normal font.italic: ConnectionState == PlasmaNM.Enums.Activating ? true : false - text: ItemUniqueName - textFormat: Text.PlainText + text: DisplayName + textFormat: Text.StyledText } PlasmaComponents.Label { @@ -178,7 +178,7 @@ } PlasmaComponents.MenuItem { - text: ItemUniqueName + text: DisplayName enabled: false } PlasmaComponents.MenuItem { diff --git a/applet/contents/ui/DetailsText.qml b/applet/contents/ui/DetailsText.qml --- a/applet/contents/ui/DetailsText.qml +++ b/applet/contents/ui/DetailsText.qml @@ -81,6 +81,7 @@ horizontalAlignment: Text.AlignRight opacity: 0.6 text: "" + details[index*2] + ":  " + textFormat: Text.StyledText Component.onCompleted: { if (paintedWidth > repeater.longestString) { @@ -102,7 +103,7 @@ font.pointSize: theme.smallestFont.pointSize opacity: 0.6 text: details[(index*2)+1] - textFormat: Text.PlainText + textFormat: Text.StyledText MouseArea { anchors.fill: parent diff --git a/kcm/qml/ConnectionItem.qml b/kcm/qml/ConnectionItem.qml --- a/kcm/qml/ConnectionItem.qml +++ b/kcm/qml/ConnectionItem.qml @@ -70,8 +70,8 @@ elide: Text.ElideRight font.weight: ConnectionState == PlasmaNM.Enums.Activated ? Font.DemiBold : Font.Normal font.italic: ConnectionState == PlasmaNM.Enums.Activating ? true : false - text: Name - textFormat: Text.PlainText + text: DisplayName + textFormat: Text.StyledText } Text { diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt --- a/libs/CMakeLists.txt +++ b/libs/CMakeLists.txt @@ -24,8 +24,9 @@ plasmanm_editor ${NETWORKMANAGER_LIBRARIES} PRIVATE - KF5::I18n + KF5::Emoticons KF5::IconThemes + KF5::I18n KF5::Notifications KF5::Service KF5::Wallet diff --git a/libs/editor/CMakeLists.txt b/libs/editor/CMakeLists.txt --- a/libs/editor/CMakeLists.txt +++ b/libs/editor/CMakeLists.txt @@ -99,6 +99,7 @@ KF5::WidgetsAddons Qt5::Widgets PRIVATE + KF5::Emoticons KF5::IconThemes KF5::I18n KF5::KIOWidgets diff --git a/libs/models/networkmodel.h b/libs/models/networkmodel.h --- a/libs/models/networkmodel.h +++ b/libs/models/networkmodel.h @@ -49,6 +49,7 @@ DeviceName, DevicePathRole, DeviceStateRole, + DisplayNameRole, DuplicateRole, ItemUniqueNameRole, ItemTypeRole, diff --git a/libs/models/networkmodel.cpp b/libs/models/networkmodel.cpp --- a/libs/models/networkmodel.cpp +++ b/libs/models/networkmodel.cpp @@ -64,6 +64,12 @@ return item->devicePath(); case DeviceStateRole: return item->deviceState(); + case DisplayNameRole: + if (m_list.returnItems(NetworkItemsList::Name, item->name()).count() > 1) { + return UiUtils::parseEmoticons(item->originalName()); + } else { + return UiUtils::parseEmoticons(item->name()); + } case DuplicateRole: return item->duplicate(); case ItemUniqueNameRole: @@ -134,6 +140,7 @@ roles[DeviceName] = "DeviceName"; roles[DevicePathRole] = "DevicePath"; roles[DeviceStateRole] = "DeviceState"; + roles[DisplayNameRole] = "DisplayName"; roles[DuplicateRole] = "Duplicate"; roles[ItemUniqueNameRole] = "ItemUniqueName"; roles[ItemTypeRole] = "ItemType"; diff --git a/libs/models/networkmodelitem.cpp b/libs/models/networkmodelitem.cpp --- a/libs/models/networkmodelitem.cpp +++ b/libs/models/networkmodelitem.cpp @@ -556,7 +556,7 @@ } } else if (m_type == NetworkManager::ConnectionSettings::Wireless) { NetworkManager::WirelessDevice::Ptr wirelessDevice = device.objectCast(); - m_details << i18n("Access point (SSID)") << m_ssid; + m_details << i18n("Access point (SSID)") << UiUtils::parseEmoticons(m_ssid); if (m_mode == NetworkManager::WirelessSetting::Infrastructure) { m_details << i18n("Signal strength") << QStringLiteral("%1%").arg(m_signal); } diff --git a/libs/uiutils.h b/libs/uiutils.h --- a/libs/uiutils.h +++ b/libs/uiutils.h @@ -22,7 +22,6 @@ #ifndef PLASMA_NM_UIUTILS_H #define PLASMA_NM_UIUTILS_H - #include #include #include @@ -92,6 +91,12 @@ */ static QString prettyInterfaceName(NetworkManager::Device::Type type, const QString &interfaceName); + /** + * @return a name replacing emoticons with HTML tag representing emoticon image + * @param name connection name or SSID + */ + static QString parseEmoticons(const QString &name); + /** * @return a human-readable description of the connection state of a given network interface * @param state The connection state diff --git a/libs/uiutils.cpp b/libs/uiutils.cpp --- a/libs/uiutils.cpp +++ b/libs/uiutils.cpp @@ -26,8 +26,9 @@ #include "debug.h" // KDE -#include #include +#include +#include #include #include @@ -293,6 +294,14 @@ return ret; } +QString UiUtils::parseEmoticons(const QString &name) +{ + KEmoticons emoticons; + KEmoticonsTheme emoticonsTheme = emoticons.theme(); + + return emoticonsTheme.parseEmoticons(name); +} + QString UiUtils::connectionStateToString(NetworkManager::Device::State state, const QString &connectionName) { QString stateString;