Commit 208f26e7 authored by Lukáš Tinkl's avatar Lukáš Tinkl
Browse files

porting ++

parent 061b02ce
......@@ -66,8 +66,7 @@ void BluetoothMonitor::addBluetoothConnection(const QString& bdAddr, const QStri
mService = service.toLower();
if (mService == "dun") {
#if WITH_MODEMMANAGER_SUPPORT
connect(ModemManager::notifier(), SIGNAL(modemAdded(QString)),
SLOT(modemAdded(QString)));
connect(ModemManager::notifier(), &ModemManager::Notifier::modemAdded, this, &BluetoothMonitor::modemAdded);
#endif
}
init();
......
......@@ -83,9 +83,9 @@ void PasswordDialog::setupGenericUi(const ConnectionSettings &connectionSettings
ui->password->setPasswordMode(true);
ui->password->setFocus();
connect(ui->showPassword, SIGNAL(toggled(bool)), this, SLOT(showPassword(bool)));
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(ui->showPassword, &QCheckBox::toggled, this, &PasswordDialog::showPassword);
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &PasswordDialog::accept);
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &PasswordDialog::reject);
}
void PasswordDialog::setupVpnUi(const ConnectionSettings &connectionSettings)
......
......@@ -22,15 +22,14 @@
#include "pindialog.h"
#include <QIntValidator>
#include <QDebug>
#include <QDesktopWidget>
#include <KWindowSystem>
#include <KGlobalSettings>
#include <KIcon>
#include <KIconLoader>
#include <KLocalizedString>
#include <ModemManagerQt/manager.h>
PinDialog::PinDialog(ModemManager::Modem *modem, const Type type, QWidget *parent)
......@@ -64,7 +63,7 @@ PinDialog::PinDialog(ModemManager::Modem *modem, const Type type, QWidget *paren
ui->puk->setValidator(validator2);
ui->errorMessage->setHidden(true);
QRect desktop = KGlobalSettings::desktopGeometry(topLevelWidget());
QRect desktop = QApplication::desktop()->screenGeometry(topLevelWidget());
setMinimumWidth(qMin(1000, qMax(sizeHint().width(), desktop.width() / 4)));
pixmapLabel = new QLabel(this);
......@@ -72,8 +71,8 @@ PinDialog::PinDialog(ModemManager::Modem *modem, const Type type, QWidget *paren
ui->gridLayout->addWidget(pixmapLabel, 0, 0);
pixmapLabel->setPixmap(KIcon("dialog-password").pixmap(KIconLoader::SizeHuge));
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &PinDialog::accept);
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &PinDialog::reject);
if (isPukDialog()) {
QString pukType;
......@@ -149,8 +148,8 @@ PinDialog::PinDialog(ModemManager::Modem *modem, const Type type, QWidget *paren
KWindowSystem::activateWindow(winId());
move((desktop.width() - width()) / 2, (desktop.height() - height()) / 2);
connect(ui->chkShowPass, SIGNAL(toggled(bool)), this, SLOT(chkShowPassToggled(bool)));
connect(ModemManager::notifier(), SIGNAL(modemRemoved(QString)), SLOT(modemRemoved(QString)));
connect(ui->chkShowPass, &QCheckBox::toggled, this, &PinDialog::chkShowPassToggled);
connect(ModemManager::notifier(), &ModemManager::Notifier::modemRemoved, this, &PinDialog::modemRemoved);
}
PinDialog::~PinDialog()
......
......@@ -48,8 +48,7 @@ SecretAgent::SecretAgent(QObject* parent):
m_wallet(0),
m_dialog(0)
{
connect(NetworkManager::notifier(), SIGNAL(serviceDisappeared()),
this, SLOT(killDialogs()));
connect(NetworkManager::notifier(), &NetworkManager::Notifier::serviceDisappeared, this, &SecretAgent::killDialogs);
}
SecretAgent::~SecretAgent()
......@@ -338,8 +337,8 @@ bool SecretAgent::processGetSecrets(SecretsRequest &request, bool ignoreWallet)
if (requestNew || (allowInteraction && !setting->needSecrets(requestNew).isEmpty()) || (allowInteraction && userRequested) || (isVpn && allowInteraction)) {
m_dialog = new PasswordDialog(request.connection, request.flags, request.setting_name);
connect(m_dialog, SIGNAL(accepted()), this, SLOT(dialogAccepted()));
connect(m_dialog, SIGNAL(rejected()), this, SLOT(dialogRejected()));
connect(m_dialog, &PasswordDialog::accepted, this, &SecretAgent::dialogAccepted);
connect(m_dialog, &PasswordDialog::rejected, this, &SecretAgent::dialogRejected);
if (isVpn) {
m_dialog->setupVpnUi(connectionSettings);
} else {
......@@ -483,8 +482,8 @@ bool SecretAgent::useWallet() const
if (KWallet::Wallet::isEnabled()) {
m_wallet = KWallet::Wallet::openWallet(KWallet::Wallet::LocalWallet(), 0, KWallet::Wallet::Asynchronous);
if (m_wallet) {
connect(m_wallet, SIGNAL(walletOpened(bool)), this, SLOT(walletOpened(bool)));
connect(m_wallet, SIGNAL(walletClosed()), this, SLOT(walletClosed()));
connect(m_wallet, &KWallet::Wallet::walletOpened, this, &SecretAgent::walletOpened);
connect(m_wallet, &KWallet::Wallet::walletClosed, this, &SecretAgent::walletClosed);
return true;
} else {
qWarning() << "Error opening kwallet.";
......
......@@ -45,26 +45,23 @@ K_PLUGIN_FACTORY(NetworkManagementServiceFactory, registerPlugin<NetworkManageme
class NetworkManagementServicePrivate
{
public:
public:
SecretAgent * agent;
};
NetworkManagementService::NetworkManagementService(QObject * parent, const QVariantList&)
: KDEDModule(parent), d_ptr(new NetworkManagementServicePrivate)
: KDEDModule(parent), d_ptr(new NetworkManagementServicePrivate)
{
Q_D(NetworkManagementService);
KLocalizedString::setApplicationDomain("plasmanetworkmanagement-kded");
#warning "port translatin catalog away from KGlobal::insertCatalog"
KGlobal::locale()->insertCatalog("plasma_applet_org.kde.plasma.networkmanagement"); // mobile wizard
// QDBusReply<bool> reply = QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.plasma-desktop");
// if (reply.value()) {
QDBusReply<bool> reply = QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.plasma_shell");
if (reply.value()) {
doInitialization();
// } else {
// QDBusServiceWatcher * watcher = new QDBusServiceWatcher("org.kde.plasma-desktop", QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this);
// connect(watcher, SIGNAL(serviceRegistered(QString)), SLOT(finishInitialization()));
// }
} else {
QDBusServiceWatcher * watcher = new QDBusServiceWatcher("org.kde.plasma_shell", QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this);
connect(watcher, SIGNAL(serviceRegistered(QString)), SLOT(finishInitialization()));
}
}
NetworkManagementService::~NetworkManagementService()
......@@ -75,7 +72,7 @@ NetworkManagementService::~NetworkManagementService()
void NetworkManagementService::finishInitialization()
{
QDBusServiceWatcher * watcher = static_cast<QDBusServiceWatcher*>(sender());
disconnect(watcher, SIGNAL(serviceRegistered(QString)), this, SLOT(finishInitialization()));
disconnect(watcher, SIGNAL(serviceRegistered(QString)), this, SLOT(finishInitialization()));
doInitialization();
}
......
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