2
* This file is part of system-settings
4
* Copyright (C) 2015 Canonical Ltd.
6
* Contact: Ken VanDine <ken.vandine@canonical.com>
8
* This program is free software: you can redistribute it and/or modify it
9
* under the terms of the GNU General Public License version 3, as published
10
* by the Free Software Foundation.
12
* This program is distributed in the hope that it will be useful, but
13
* WITHOUT ANY WARRANTY; without even the implied warranties of
14
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15
* PURPOSE. See the GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License along
18
* with this program. If not, see <http://www.gnu.org/licenses/>.
21
#include "cellular-plugin.h"
24
#include <QDBusInterface>
25
#include <QDBusPendingReply>
26
#include <QProcessEnvironment>
28
#include <SystemSettings/ItemBase>
30
using namespace SystemSettings;
32
class CellularItem: public ItemBase
37
explicit CellularItem(const QVariantMap &staticData, QObject *parent = 0);
38
void setVisibility(bool visible);
42
CellularItem::CellularItem(const QVariantMap &staticData, QObject *parent):
43
ItemBase(staticData, parent)
45
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
46
if (env.contains(QLatin1String("USS_SHOW_ALL_UI"))) {
47
QString showAllS = env.value("USS_SHOW_ALL_UI", QString());
49
if(!showAllS.isEmpty()) {
55
bool supportedDevice(true);
57
QDBusInterface m_NetStatusPropertiesIface(
58
"com.ubuntu.connectivity1",
59
"/com/ubuntu/connectivity1/NetworkingStatus",
60
"org.freedesktop.DBus.Properties",
61
QDBusConnection::sessionBus());
62
QDBusPendingReply<QVariant> modemReply = m_NetStatusPropertiesIface.call(
63
"Get", "com.ubuntu.connectivity1.NetworkingStatus", "ModemAvailable");
64
modemReply.waitForFinished();
65
if (modemReply.isValid()) {
66
supportedDevice = modemReply.argumentAt<0>().toBool();
69
setVisibility(supportedDevice);
72
void CellularItem::setVisibility(bool visible)
77
ItemBase *CellularPlugin::createItem(const QVariantMap &staticData,
80
return new CellularItem(staticData, parent);
83
#include "cellular-plugin.moc"