Commit 193f498d authored by Jan Grulich's avatar Jan Grulich
Browse files

Fix compilation with libmm-qt

parent 0718c5c8
......@@ -8,17 +8,17 @@ find_package(NetworkManager "0.9.8" REQUIRED)
include(FindPkgConfig)
include(KDE4Defaults)
if (DISABLE_MODEMMANAGERQT)
message(STATUS "Disabling ModemManagerQt support")
set(WITH_MODEMMANAGERQT 0)
if (DISABLE_MODEMMANAGER_SUPPORT)
message(STATUS "Disabling ModemManager support")
set(WITH_MODEMMANAGER_SUPPORT 0)
else()
pkg_check_modules(MODEMMANAGERQT ModemManagerQt)
if (MODEMMANAGERQT_FOUND)
message(STATUS "Enabling ModemManagerQt support")
set(WITH_MODEMMANAGERQT 1)
message(STATUS "Enabling ModemManager support")
set(WITH_MODEMMANAGER_SUPPORT 1)
else()
message(STATUS "ModemManagerQt not found")
set(WITH_MODEMMANAGERQT 0)
set(WITH_MODEMMANAGER_SUPPORT 0)
endif()
endif()
......@@ -42,7 +42,7 @@ pkg_check_modules(QTNETWORK REQUIRED QtNetwork)
pkg_check_modules(NETWORKMANAGER REQUIRED NetworkManager)
add_definitions(
-DWITH_MODEMMANAGERQT=${WITH_MODEMMANAGERQT}
-DWITH_MODEMMANAGER_SUPPORT=${WITH_MODEMMANAGER_SUPPORT}
${QT_DEFINITIONS}
${KDE_DEFINITIONS}
${NETWORKMANAGERQT_CFLAGS_OTHER}
......
......@@ -35,7 +35,7 @@
ConnectionIcon::ConnectionIcon(QObject* parent):
QObject(parent),
m_signal(0)
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
,m_modemNetwork(0)
#endif
{
......@@ -143,7 +143,7 @@ void ConnectionIcon::setIcons()
bool vpnFound = false;
m_signal = 0;
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
if (m_modemNetwork) {
disconnect(m_modemNetwork.data(), 0, this, 0);
m_modemNetwork.clear();
......@@ -197,7 +197,7 @@ void ConnectionIcon::setIcons()
Q_EMIT setTooltipIcon("network-wired-activated");
} else if (type == NetworkManager::Device::Modem) {
connectionFound = true;
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
setModemIcon(device);
#else
Q_EMIT setConnectionIcon("network-mobile-0");
......@@ -208,7 +208,7 @@ void ConnectionIcon::setIcons()
if (btDevice) {
connectionFound = true;
if (btDevice->bluetoothCapabilities().testFlag(NetworkManager::BluetoothDevice::Dun)) {
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
setModemIcon(device);
#else
Q_EMIT setConnectionIcon("network-mobile-0");
......@@ -300,7 +300,7 @@ void ConnectionIcon::setDisconnectedIcon()
return;
}
}
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
void ConnectionIcon::setModemIcon(const NetworkManager::Device::Ptr & device)
{
NetworkManager::ModemDevice::Ptr modemDevice = device.objectCast<NetworkManager::ModemDevice>();
......
......@@ -24,7 +24,7 @@
#include <NetworkManagerQt/Manager>
#include <NetworkManagerQt/ActiveConnection>
#include <NetworkManagerQt/WirelessNetwork>
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
#include <ModemManagerQt/modemgsmnetworkinterface.h>
#endif
class ConnectionIcon : public QObject
......@@ -45,7 +45,7 @@ private Q_SLOTS:
void deviceRemoved(const QString & device);
void setIcons();
void setWirelessIconForSignalStrength(int strength);
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
void modemNetworkRemoved();
void modemSignalChanged(uint signal);
void setIconForModem();
......@@ -64,7 +64,7 @@ private:
void setDisconnectedIcon();
void setWirelessIcon(const NetworkManager::Device::Ptr & device, const QString & ssid);
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
ModemManager::ModemGsmNetworkInterface::Ptr m_modemNetwork;
void setModemIcon(const NetworkManager::Device::Ptr & device);
#endif
......
......@@ -63,7 +63,7 @@ Model::Model(QObject* parent):
SLOT(addWimaxNsp(QString,QString)));
connect(m_monitor, SIGNAL(addWirelessNetwork(QString,QString)),
SLOT(addWirelessNetwork(QString,QString)));
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
connect(m_monitor, SIGNAL(modemAccessTechnologyChanged(QString)),
SLOT(modemPropertiesChanged(QString)));
connect(m_monitor, SIGNAL(modemAllowedModeChanged(QString)),
......@@ -270,7 +270,7 @@ void Model::connectionUpdated(const QString& connection)
}
}
}
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
void Model::modemPropertiesChanged(const QString& modem)
{
foreach (ModelItem * item, m_items.itemsByDevice(modem)) {
......
......@@ -57,7 +57,7 @@ private Q_SLOTS:
void addWimaxNsp(const QString& nsp, const QString& device);
void addWirelessNetwork(const QString& ssid, const QString& device);
void connectionUpdated(const QString& connection);
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
void modemPropertiesChanged(const QString& modem);
void modemSignalQualityChanged(uint signal, const QString& modem);
#endif
......
......@@ -144,10 +144,10 @@ void Monitor::addDevice(const NetworkManager::Device::Ptr& device)
SLOT(wirelessNetworkAppeared(QString)), Qt::UniqueConnection);
connect(wifiDev.data(), SIGNAL(networkDisappeared(QString)),
SLOT(wirelessNetworkDisappeared(QString)), Qt::UniqueConnection);
}else if (device->type() == NetworkManager::Device::Modem) {
} else if (device->type() == NetworkManager::Device::Modem) {
NMMonitorDebug() << "Available modem device " << device->interfaceName();
NetworkManager::ModemDevice::Ptr modemDev = device.objectCast<NetworkManager::ModemDevice>();
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
ModemManager::ModemGsmNetworkInterface::Ptr modemNetwork = modemDev->getModemNetworkIface().objectCast<ModemManager::ModemGsmNetworkInterface>();
if (modemNetwork) {
connect(modemNetwork.data(), SIGNAL(signalQualityChanged(uint)),
......@@ -353,7 +353,7 @@ void Monitor::deviceRemoved(const QString& device)
NMMonitorDebug() << "Device " << device << " removed";
Q_EMIT removeConnectionsByDevice(device);
}
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
void Monitor::gsmNetworkAccessTechnologyChanged(ModemManager::ModemInterface::AccessTechnology technology)
{
ModemManager::ModemGsmNetworkInterface * gsmNetwork = qobject_cast<ModemManager::ModemGsmNetworkInterface*>(sender());
......
......@@ -28,7 +28,7 @@
#include <NetworkManagerQt/VpnConnection>
#include <NetworkManagerQt/WirelessNetwork>
#include <NetworkManagerQt/WirelessDevice>
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
#include <ModemManagerQt/modeminterface.h>
#endif
class Monitor : public QObject
......@@ -53,7 +53,7 @@ private Q_SLOTS:
void connectionUpdated();
void deviceAdded(const QString& device);
void deviceRemoved(const QString& device);
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
void gsmNetworkAccessTechnologyChanged(ModemManager::ModemInterface::AccessTechnology technology);
void gsmNetworkAllowedModeChanged(ModemManager::ModemInterface::AllowedMode mode);
void gsmNetworkSignalQualityChanged(uint signal);
......@@ -78,7 +78,7 @@ Q_SIGNALS:
void addWimaxNsp(const QString& nsp, const QString& device);
void addWirelessNetwork(const QString& network, const QString& device);
void connectionUpdated(const QString& connection);
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
void modemAccessTechnologyChanged(const QString& modem);
void modemAllowedModeChanged(const QString& modem);
void modemSignalQualityChanged(uint signal, const QString & modem);
......
......@@ -77,7 +77,7 @@ ConnectionEditor::ConnectionEditor(QWidget* parent, Qt::WindowFlags flags):
action = new QAction(i18n("InfiniBand"), this);
action->setData(NetworkManager::ConnectionSettings::Infiniband);
m_menu->addAction(action);
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
action = new QAction(i18n("Mobile Broadband..."), this);
action->setData(NetworkManager::ConnectionSettings::Gsm);
m_menu->addAction(action);
......@@ -336,7 +336,7 @@ void ConnectionEditor::addConnection(QAction* action)
ConnectionSettings::ConnectionType type = static_cast<ConnectionSettings::ConnectionType>(action->data().toUInt());
if (type == NetworkManager::ConnectionSettings::Gsm) { // launch the mobile broadband wizard, both gsm/cdma
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
QWeakPointer<MobileConnectionWizard> wizard = new MobileConnectionWizard(NetworkManager::ConnectionSettings::Unknown, this);
if (wizard.data()->exec() == QDialog::Accepted && wizard.data()->getError() == MobileProviders::Success) {
qDebug() << "Mobile broadband wizard finished:" << wizard.data()->type() << wizard.data()->args();
......
set(kded_networkmanagement_SRCS
notification.cpp
passworddialog.cpp
secretagent.cpp
service.cpp
bluetoothmonitor.cpp
)
kde4_add_ui_files(kded_networkmanagement_SRCS
passworddialog.ui
pinwidget.ui
)
if (MODEMMANAGERQT_FOUND)
set(kded_networkmanagement_SRCS
notification.cpp
passworddialog.cpp
secretagent.cpp
service.cpp
bluetoothmonitor.cpp
modemmonitor.cpp
pindialog.cpp
)
kde4_add_ui_files(kded_networkmanagement_SRCS
pinwidget.ui
passworddialog.ui
if (WITH_MODEMMANAGERQT)
set(kded_networkmanagement_SRCS
modemmonitor.cpp
pindialog.cpp
)
kde4_add_ui_files(kded_networkmanagement_SRCS
pinwidget.ui
)
)
else()
set(kded_networkmanagement_SRCS
notification.cpp
passworddialog.cpp
secretagent.cpp
service.cpp
bluetoothmonitor.cpp
)
kde4_add_ui_files(kded_networkmanagement_SRCS
passworddialog.ui
)
endif()
kde4_add_plugin(kded_networkmanagement ${kded_networkmanagement_SRCS})
......
......@@ -60,7 +60,7 @@ void BluetoothMonitor::addBluetoothConnection(const QString& bdAddr, const QStri
mBdaddr = bdAddr;
mService = service.toLower();
if (mService == "dun") {
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
connect(ModemManager::notifier(), SIGNAL(modemAdded(QString)),
SLOT(modemAdded(QString)));
#endif
......@@ -214,7 +214,7 @@ void BluetoothMonitor::init()
mDunDevice = reply.value();
}
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
void BluetoothMonitor::modemAdded(const QString &udi)
{
qDebug() << "Modem added" << udi;
......
......@@ -22,7 +22,7 @@
#ifndef PLASMA_NM_BLUETOOTH_MONITOR_H
#define PLASMA_NM_BLUETOOTH_MONITOR_H
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
#include "../lib/mobileconnectionwizard.h"
#include <ModemManagerQt/manager.h>
#endif
......@@ -40,7 +40,7 @@ public Q_SLOTS:
Q_SCRIPTABLE void addBluetoothConnection(const QString & bdAddr, const QString & service);
private Q_SLOTS:
void init();
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
void modemAdded(const QString &udi);
#endif
private:
......@@ -49,7 +49,7 @@ private:
QString mDunDevice;
QString mDevicePath;
QString mDeviceName;
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
QWeakPointer<MobileConnectionWizard> mobileConnectionWizard;
#endif
};
......
......@@ -26,7 +26,7 @@
#include "secretagent.h"
#include "notification.h"
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
#include "modemmonitor.h"
#endif
#include "bluetoothmonitor.h"
......@@ -51,7 +51,7 @@ NetworkManagementService::NetworkManagementService(QObject * parent, const QVari
d->agent = new SecretAgent(this);
new Notification(this);
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
new ModemMonitor(this);
#endif
new BluetoothMonitor(this);
......
set(plasmanetworkmanagement-internal_SRCS
settingwidget.cpp
vpnuiplugin.cpp
uiutils.cpp
hwaddrcombobox.cpp
ssidcombobox.cpp
bssidcombobox.cpp
)
if (WITH_MODEMMANAGERQT)
set(plasmanetworkmanagement-internal_SRCS
mobileproviders.cpp
mobileconnectionwizard.cpp
)
if (MODEMMANAGERQT_FOUND)
set(plasmanetworkmanagement-internal_SRCS
settingwidget.cpp
vpnuiplugin.cpp
uiutils.cpp
hwaddrcombobox.cpp
ssidcombobox.cpp
bssidcombobox.cpp
mobileproviders.cpp
mobileconnectionwizard.cpp
)
else()
set(plasmanetworkmanagement-internal_SRCS
settingwidget.cpp
vpnuiplugin.cpp
uiutils.cpp
hwaddrcombobox.cpp
ssidcombobox.cpp
bssidcombobox.cpp
)
endif()
kde4_add_library(plasmanetworkmanagement-internal SHARED ${plasmanetworkmanagement-internal_SRCS})
......
......@@ -557,7 +557,7 @@ QString UiUtils::wirelessBandToString(NetworkManager::WirelessSetting::Frequency
return QString();
}
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
QString UiUtils::convertTypeToString(const ModemManager::ModemInterface::Type type)
{
switch (type) {
......@@ -832,7 +832,7 @@ QString UiUtils::bluetoothDetails(const BluetoothDevice::Ptr& btDevice, const QS
QString UiUtils::modemDetails(const ModemDevice::Ptr& modemDevice, const QStringList& keys)
{
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
QString format = "<tr><td align=\"right\" width=\"50%\"><b>%1</b></td><td align=\"left\" width=\"50%\">&nbsp;%2</td></tr>";
QString details;
ModemManager::ModemGsmNetworkInterface::Ptr modemNetwork = modemDevice->getModemNetworkIface().objectCast<ModemManager::ModemGsmNetworkInterface>();
......
......@@ -150,7 +150,7 @@ public:
* @return A string representation
*/
static QString wirelessBandToString(NetworkManager::WirelessSetting::FrequencyBand band);
#if WITH_MODEMMANAGERQT
#if WITH_MODEMMANAGER_SUPPORT
static QString convertTypeToString(const ModemManager::ModemInterface::Type type);
static QString convertBandToString(const ModemManager::ModemInterface::Band band);
static QString convertAllowedModeToString(const ModemManager::ModemInterface::AllowedMode mode);
......
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