Commit 177a2641 authored by Bhushan Shah's avatar Bhushan Shah 📱
Browse files

mobile: disable the broadband KCM

On mobile we are not using modem manager but ofono plugin to manage the
mobiles, that is why this KCM can not work there. Besides this KCM is
mostly placeholder and is causing more confusion then function, let's
remove it.
parent dfaf302b
if (WITH_MODEMMANAGER_SUPPORT)
add_subdirectory(broadband)
endif()
add_subdirectory(wifi) add_subdirectory(wifi)
add_subdirectory(hotspot) add_subdirectory(hotspot)
project (kcm_mobile_broadband)
set (mobilebroadbandsettings_SRCS mobilebroadbandsettings.cpp)
add_library(kcm_mobile_broadband MODULE ${mobilebroadbandsettings_SRCS})
target_link_libraries(kcm_mobile_broadband
Qt5::DBus
Qt5::Gui
Qt5::Quick
Qt5::Qml
KF5::Plasma
KF5::I18n
KF5::NetworkManagerQt
KF5::ModemManagerQt
KF5::QuickAddons
)
kcoreaddons_desktop_to_json(kcm_mobile_broadband "mobilebroadbandsettings.desktop")
install(FILES mobilebroadbandsettings.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(TARGETS kcm_mobile_broadband DESTINATION ${PLUGIN_INSTALL_DIR}/kcms)
kpackage_install_package(package kcm_mobile_broadband kcms)
#!/usr/bin/env bash
$XGETTEXT `find . -name \*.cpp -o -name \*.qml` -o $podir/kcm_mobile_broadband.pot
/*
* Copyright 2018 Martin Kacej <m.kacej@atlas.sk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 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 Library General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "mobilebroadbandsettings.h"
#include <KPluginFactory>
#include <KLocalizedString>
#include <KAboutData>
#include <NetworkManagerQt/ConnectionSettings>
#include <NetworkManagerQt/GsmSetting>
#include <NetworkManagerQt/CdmaSetting>
#if WITH_MODEMMANAGER_SUPPORT
#include <ModemManagerQt/Manager>
#include <ModemManagerQt/GenericTypes>
#include <ModemManagerQt/ModemDevice>
#endif
K_PLUGIN_CLASS_WITH_JSON(MobileBroadbandSettings, "mobilebroadbandsettings.json")
MobileBroadbandSettings::MobileBroadbandSettings(QObject* parent, const QVariantList& args) : KQuickAddons::ConfigModule(parent, args)
{
KAboutData* about = new KAboutData("kcm_mobile_broadband", i18n("Configure mobile broadband"),
"0.1", QString(), KAboutLicense::GPL);
about->addAuthor(i18n("Martin Kacej"), QString(), "m.kacej@atlas.sk");
setAboutData(about);
ModemManager::scanDevices();
this->getModemDevice();
this->setupMobileNetwork();
}
MobileBroadbandSettings::~MobileBroadbandSettings()
{
}
bool MobileBroadbandSettings::mobileDataActive()
{
return m_mobileDataActive;
}
void MobileBroadbandSettings::setMobileDataActive(bool active)
{
m_mobileDataActive = active;
emit mobileDataActiveChanged(m_mobileDataActive);
}
QString MobileBroadbandSettings::getModemDevice()
{
ModemManager::ModemDevice::List list = ModemManager::modemDevices();
if (list.length() == 0)
return QString();
ModemManager::ModemDevice::Ptr device;
foreach (const ModemManager::ModemDevice::Ptr &md, list) {
ModemManager::Modem::Ptr m = md->modemInterface();
if (!m->isEnabled())
continue;
// TODO powerState ???
if (m->state() <= MM_MODEM_STATE_REGISTERED)
continue; // needs inspection
if (m->accessTechnologies() <= MM_MODEM_ACCESS_TECHNOLOGY_GSM)
continue;
if (m->currentCapabilities() <= MM_MODEM_CAPABILITY_GSM_UMTS)
continue;
device = md;
}
if (device) {
qWarning() << device->uni() << device->modemInterface()->uni();
return device->uni();
}
return QString();
}
void MobileBroadbandSettings::setupMobileNetwork()
{
ModemManager::ModemDevice::Ptr modem = ModemManager::findModemDevice(getModemDevice());
if (!modem)
return;
if (modem->bearers().count() == 0) {
qWarning() << "No bearers in modem found";
} else {
foreach (const ModemManager::Bearer::Ptr &p, modem->bearers()) {
qWarning() << p->properties();
}
}
}
QString MobileBroadbandSettings::getAPN()
{
return "some.ap.placeholder.com";
}
#include "mobilebroadbandsettings.moc"
[Desktop Entry]
Name=Mobile broadband
Name[ast]=Banda ancha móvil
Name[ca]=Banda ampla per mòbil
Name[ca@valencia]=Banda ampla per mòbil
Name[cs]=Mobilní Broadband
Name[da]=Mobilt bredbånd
Name[de]=Mobiles Breitband
Name[en_GB]=Mobile broadband
Name[es]=Banda ancha móvil
Name[et]=Mobiilandmeside
Name[eu]=Mugikorreko banda-zabala
Name[fi]=Mobiililaajakaista
Name[fr]=Haut débit mobile
Name[gl]=Banda larga móbil
Name[hu]=Mobil szélessáv
Name[ia]=Banda large mobile
Name[id]=Mobile broadband
Name[it]=Banda larga mobile
Name[ko]=모바일 광대역
Name[lt]=Mobilusis plačiajuostis
Name[ml]=മൊബൈൽ ബ്രോഡ്ബാൻഡ്
Name[nl]=Mobiel breedband
Name[nn]=Mobilt breiband
Name[pa]=ਮੋਬਾਈਲ ਬਰਾਡਬੈਂਡ
Name[pl]=Komórkowe szerokopasmowe
Name[pt]=Banda larga móvel
Name[pt_BR]=Banda larga móvel
Name[ro]=Bandă largă mobilă
Name[ru]=Мобильный интернет
Name[sk]=Mobilné širokopásmové pripojenie
Name[sl]=Mobilno širokopasovno omrežje
Name[sv]=Mobilt bredband
Name[uk]=Мобільна радіомережа
Name[x-test]=xxMobile broadbandxx
Name[zh_CN]=移动宽带
Name[zh_TW]=行動數據
Comment=Mobile broadband setting
Comment[ca]=Configuració de la banda ampla per mòbil
Comment[ca@valencia]=Configuració de la banda ampla per mòbil
Comment[cs]=Nastavení pro Mobilní Broadband
Comment[da]=Opsætning af mobilt bredbånd
Comment[de]=Einstellungen für Mobiles Breitband
Comment[en_GB]=Mobile broadband setting
Comment[es]=Preferencias de banda ancha móvil
Comment[et]=Mobiilandmeside seadistus
Comment[eu]=Mugikorreko banda-zabaleko ezarpena
Comment[fi]=Mobiililaajakaista-asetukset
Comment[fr]=Paramètre haut débit mobile
Comment[gl]=Opción de banda larga móbil
Comment[hu]=Mobil szélessáv beállításai
Comment[ia]=Preferentia de banda large mobile
Comment[id]=Pengesetan mobile broadband
Comment[it]=Impostazioni banda larga mobile
Comment[ko]=모바일 광대역 설정
Comment[lt]=Mobiliojo plačiajuosčio nuostata
Comment[ml]=മൊബൈൽ ബ്രോഡ്ബാൻഡ് സജ്ജീകരണം
Comment[nl]=Instelling voor mobiel breedband
Comment[nn]=Innstilling for mobilt breiband
Comment[pa]=ਮੋਬਾਈਲ ਬਰਾਡਬੈਂਡ ਸੈਟਿੰਗ
Comment[pl]=Ustawienia sieci komórkowej
Comment[pt]=Configuração da banda larga móvel
Comment[pt_BR]=Configurações da banda larga móvel
Comment[ro]=Configurare bandă largă mobilă
Comment[ru]=Параметры мобильного интернета
Comment[sk]=Nastavenie mobilného širokopásmového pripojenia
Comment[sl]=Nastavitve mobilnega širokopasovnega omrežja
Comment[sv]=Inställning av mobilt bredband
Comment[uk]=Налаштовування мобільної радіомережі
Comment[x-test]=xxMobile broadband settingxx
Comment[zh_CN]=移动宽带设置
Comment[zh_TW]=行動數據設定
Icon=smartphone
Exec=plasma-settings -m kcm_mobile_broadband
Type=Service
X-KDE-ServiceTypes=KCModule
X-KDE-Library=kcm_mobile_broadband
X-KDE-ParentApp=kcontrol
X-KDE-FormFactors=handset,tablet,mediacenter
X-KDE-System-Settings-Parent-Category=network
X-KDE-Weight=70
X-KDE-Keywords=mobile,data,network
X-KDE-Keywords[ast]=móvil,datos,rede
X-KDE-Keywords[ca]=mòbil,dades,xarxa
X-KDE-Keywords[ca@valencia]=mòbil,dades,xarxa
X-KDE-Keywords[cs]=mobilní,data,síť
X-KDE-Keywords[da]=mobil,data,netværk
X-KDE-Keywords[de]=mobil,daten,netzwerk
X-KDE-Keywords[en_GB]=mobile,data,network
X-KDE-Keywords[es]=móvil,datos,red
X-KDE-Keywords[et]=mobiil,mobiilandmeside,andmed,võrk
X-KDE-Keywords[eu]=mugikorra,datuak,sarea
X-KDE-Keywords[fi]=mobiili,data,verkko
X-KDE-Keywords[fr]=mobile,données,réseau
X-KDE-Keywords[gl]=móbil,datos,rede
X-KDE-Keywords[hu]=mobil,adat,hálózat
X-KDE-Keywords[ia]=mobile,data,network
X-KDE-Keywords[id]=mobile,data,jaringan
X-KDE-Keywords[it]=mobile, dati,rete
X-KDE-Keywords[ko]=mobile,data,network,모바일,데이터,네트워크
X-KDE-Keywords[lt]=mobilusis,duomenys,mobilieji,tinklas
X-KDE-Keywords[ml]=മൊബൈൽ,ഡാറ്റ,ശൃംഖല
X-KDE-Keywords[nl]=mobiel,gegevens,netwerk
X-KDE-Keywords[nn]=mobil,mobilt,data,nettverk
X-KDE-Keywords[pa]=ਮੋਬਾਈਲ,ਡਾਟਾ,ਨੈੱਟਵਰਕ
X-KDE-Keywords[pl]=komórkowa,mobilna,dane,sieć
X-KDE-Keywords[pt]=móvel,dados,rede
X-KDE-Keywords[pt_BR]=móvel,dados,rede
X-KDE-Keywords[ro]=mobil,mobilă,date,rețea
X-KDE-Keywords[ru]=mobile,data,network,мобильная,данные,сеть
X-KDE-Keywords[sk]=mobilný,mobilné,dáta,sieť
X-KDE-Keywords[sl]=mobile,mobilni,data,podatki,network,omrežje
X-KDE-Keywords[sv]=mobil,data,nätverk
X-KDE-Keywords[tg]=мобилӣ,иттилоотӣ,шабака
X-KDE-Keywords[uk]=mobile,data,network,мобільний,дані,мережа
X-KDE-Keywords[x-test]=xxmobilexx,xxdataxx,xxnetworkxx
X-KDE-Keywords[zh_CN]=mobile,data,network,移动,数据,网络
X-KDE-Keywords[zh_TW]=mobile,data,network,行動,資料,數據,網路
Categories=Qt;KDE;X-KDE-settings-system;
/*
* Copyright 2018 Martin Kacej <m.kacej@atlas.sk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 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 Library General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef MOBILEBROADBANDSETTINGS_H
#define MOBILEBROADBANDSETTINGS_H
#include <KQuickAddons/ConfigModule>
class MobileBroadbandSettings : public KQuickAddons::ConfigModule
{
Q_OBJECT
Q_PROPERTY(bool mobileDataActive READ mobileDataActive WRITE setMobileDataActive NOTIFY mobileDataActiveChanged)
public:
MobileBroadbandSettings(QObject *parent, const QVariantList &args);
virtual ~MobileBroadbandSettings();
bool mobileDataActive();
void setMobileDataActive(bool active);
Q_SIGNAL void mobileDataActiveChanged(bool active);
Q_INVOKABLE QString getModemDevice();
void setupMobileNetwork();
Q_INVOKABLE QString getAPN();
private:
bool m_mobileDataActive;
};
#endif // MOBILEBROADBANDSETTINGS_H
/*
* Copyright 2018 Martin Kacej <m.kacej@atlas.sk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 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 Library General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 2.6
import QtQuick.Controls 2.2 as Controls
import QtQuick.Layouts 1.3
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
import org.kde.kirigami 2.2 as Kirigami
Kirigami.Page {
ColumnLayout {
width: parent.width
spacing: Kirigami.Units.gridUnit * 1.5
RowLayout {
width: parent.width
Controls.Label {
text: i18n("Enable mobile data network")
font.weight: Font.Bold
Layout.fillWidth: true
}
Controls.CheckBox {
id: mobileDataCheckbox
enabled: enabledConnections.wwanHwEnabled && availableDevices.modemDeviceAvailable
anchors.rightMargin: Kirigami.Units.gridUnit
}
}
RowLayout {
width: parent.width
enabled: mobileDataCheckbox.checked
Controls.Label {
text: i18n("Enable data roaming")
font.weight: Font.Bold
color: parent.enabled ? Kirigami.Theme.textColor : Kirigami.Theme.disabledTextColor
Layout.fillWidth: true
}
Controls.CheckBox {
enabled: parent.enabled
checked: false
anchors.rightMargin: Kirigami.Units.gridUnit
onEnabledChanged: {
if (!enabled)
checked = false
}
}
}
Kirigami.Separator {}
Column {
Controls.Label {
text: i18n("Access point name")
font.weight: Font.Bold
}
Row {
Controls.TextField {
text: kcm.getAPN()
}
Controls.ToolButton {
text: i18n("Edit APN")
}
}
}
Controls.Button {
text: i18n("Data usage")
}
}
}
/*
* Copyright 2018 Martin Kacej <m.kacej@atlas.sk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 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 Library General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 2.6
import QtQuick.Controls 2.2 as Controls
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
import org.kde.kirigami 2.2 as Kirigami
Kirigami.ApplicationItem {
id: main
objectName: "mobileDataMain"
pageStack.defaultColumnWidth: Kirigami.Units.gridUnit * 25
pageStack.initialPage: MobileSettings {}
Kirigami.Theme.colorSet: Kirigami.Theme.Window
anchors.fill: parent
PlasmaNM.Handler {
id: handler
}
PlasmaNM.AvailableDevices {
id: availableDevices
}
PlasmaNM.EnabledConnections {
id: enabledConnections
onWwanEnabledChanged: {
mobileDataCheckbox.checked = mobileDataCheckbox.enabled && enabled
}
onWwanHwEnabledChanged: {
mobileDataCheckbox.enabled = enabled && availableDevices.modemDeviceAvailable
}
}
}
[Desktop Entry]
Name=Mobile Broadband
Name[ast]=Banda ancha móvil
Name[ca]=Banda ampla per mòbil
Name[ca@valencia]=Banda ampla per mòbil
Name[cs]=Mobilní Broadband
Name[da]=Mobilt bredbånd
Name[de]=Mobiles Breitband
Name[en_GB]=Mobile Broadband
Name[es]=Banda ancha móvil
Name[et]=Mobiilandmeside
Name[eu]=Mugikorreko banda-zabala
Name[fi]=Mobiililaajakaista
Name[fr]=Haut débit mobile
Name[gl]=Banda larga móbil
Name[hu]=Mobil szélessáv
Name[ia]=Banda large mobile
Name[id]=Mobile Broadband
Name[it]=Banda larga mobile
Name[ko]=모바일 광대역
Name[lt]=Mobilusis plačiajuostis
Name[ml]=മൊബൈൽ ബ്രോഡ്ബാൻഡ്
Name[nl]=Mobiel breedband
Name[nn]=Mobilt breiband
Name[pa]=ਮੋਬਾਈਲ ਬਰਾਡਬੈਂਡ
Name[pl]=Komórkowe szerokopasmowe
Name[pt]=Banda Larga Móvel
Name[pt_BR]=Banda larga móvel
Name[ro]=Bandă largă mobilă
Name[ru]=Мобильный интернет:
Name[sk]=Mobilné širokopásmové pripojenie
Name[sl]=Mobilno širokopasovno omrežje
Name[sv]=Mobilt bredband
Name[uk]=Мобільна радіомережа
Name[x-test]=xxMobile Broadbandxx
Name[zh_CN]=移动宽带
Name[zh_TW]=行動數據
Comment=Mobile broadband setting
Comment[ca]=Configuració de la banda ampla per mòbil
Comment[ca@valencia]=Configuració de la banda ampla per mòbil
Comment[cs]=Nastavení pro Mobilní Broadband
Comment[da]=Opsætning af mobilt bredbånd
Comment[de]=Einstellungen für Mobiles Breitband
Comment[en_GB]=Mobile broadband setting
Comment[es]=Preferencias de banda ancha móvil
Comment[et]=Mobiilandmeside seadistus
Comment[eu]=Mugikorreko banda-zabaleko ezarpena
Comment[fi]=Mobiililaajakaista-asetukset
Comment[fr]=Paramètre haut débit mobile
Comment[gl]=Opción de banda larga móbil
Comment[hu]=Mobil szélessáv beállításai
Comment[ia]=Preferentia de banda large mobile
Comment[id]=Pengesetan mobile broadband
Comment[it]=Impostazioni banda larga mobile
Comment[ko]=모바일 광대역 설정
Comment[lt]=Mobiliojo plačiajuosčio nuostata
Comment[ml]=മൊബൈൽ ബ്രോഡ്ബാൻഡ് സജ്ജീകരണം
Comment[nl]=Instelling voor mobiel breedband
Comment[nn]=Innstilling for mobilt breiband
Comment[pa]=ਮੋਬਾਈਲ ਬਰਾਡਬੈਂਡ ਸੈਟਿੰਗ
Comment[pl]=Ustawienia sieci komórkowej
Comment[pt]=Configuração da banda larga móvel
Comment[pt_BR]=Configurações da banda larga móvel
Comment[ro]=Configurare bandă largă mobilă
Comment[ru]=Параметры мобильного интернета
Comment[sk]=Nastavenie mobilného širokopásmového pripojenia
Comment[sl]=Nastavitve mobilnega širokopasovnega omrežja
Comment[sv]=Inställning av mobilt bredband
Comment[uk]=Налаштовування мобільної радіомережі
Comment[x-test]=xxMobile broadband settingxx
Comment[zh_CN]=移动宽带设置
Comment[zh_TW]=行動數據設定
Encoding=UTF-8
Type=Service
Icon=smartphone
X-KDE-ServiceTypes=KCModule
X-KDE-Library=kcm_mobile_broadband
X-KDE-PluginInfo-Author=Martin Kacej
X-KDE-PluginInfo-Email=m.kacej@atlas.sk
X-KDE-PluginInfo-Name=kcm_mobile_broadband
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-Website=https://plasma-mobile.org/
X-KDE-PluginInfo-Category=System Information
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
X-KDE-FormFactors=handset,tablet,mediacenter
X-Plasma-Package=kcm_mobile_broadband
X-Plasma-MainScript=ui/main.qml
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