/***************************************************************************
- * Copyright (C) 2005-2015 by the Quassel Project *
+ * Copyright (C) 2005-2016 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
_progressMinimum(0),
_progressMaximum(-1),
_progressValue(-1),
- _resetting(false),
- _qNetworkConfigurationManager(0)
+ _resetting(false)
{
qRegisterMetaType<ConnectionState>("CoreConnection::ConnectionState");
}
_reconnectTimer.setSingleShot(true);
connect(&_reconnectTimer, SIGNAL(timeout()), SLOT(reconnectTimeout()));
-#ifdef HAVE_KDE4
- connect(Solid::Networking::notifier(), SIGNAL(statusChanged(Solid::Networking::Status)),
- SLOT(solidNetworkStatusChanged(Solid::Networking::Status)));
-#endif
_qNetworkConfigurationManager = new QNetworkConfigurationManager(this);
connect(_qNetworkConfigurationManager, SIGNAL(onlineStateChanged(bool)), SLOT(onlineStateChanged(bool)));
if (!_peer) {
CoreConnectionSettings s;
if (_wantReconnect && s.autoReconnect()) {
-#ifdef HAVE_KDE4
- // If using Solid, we don't want to reconnect if we're offline
- if (s.networkDetectionMode() == CoreConnectionSettings::UseSolid) {
- if (Solid::Networking::status() != Solid::Networking::Connected
- && Solid::Networking::status() != Solid::Networking::Unknown) {
- return;
- }
- }
-#endif /* HAVE_KDE4 */
- // If using QNetworkConfigurationManager, ditto
+ // If using QNetworkConfigurationManager, we don't want to reconnect if we're offline
if (s.networkDetectionMode() == CoreConnectionSettings::UseQNetworkConfigurationManager) {
if (!_qNetworkConfigurationManager->isOnline()) {
return;
}
}
-
reconnectToCore();
}
}
}
-#ifdef HAVE_KDE4
-
-void CoreConnection::solidNetworkStatusChanged(Solid::Networking::Status status)
-{
- CoreConnectionSettings s;
- if (s.networkDetectionMode() != CoreConnectionSettings::UseSolid)
- return;
-
- switch (status) {
- case Solid::Networking::Unknown:
- case Solid::Networking::Connected:
- //qDebug() << "Solid: Network status changed to connected or unknown";
- if (state() == Disconnected) {
- if (_wantReconnect && s.autoReconnect()) {
- reconnectToCore();
- }
- }
- break;
- case Solid::Networking::Disconnecting:
- case Solid::Networking::Unconnected:
- if (state() != Disconnected && !isLocalConnection())
- disconnectFromCore(tr("Network is down"), true);
- break;
- default:
- break;
- }
-}
-
-#endif
-
void CoreConnection::onlineStateChanged(bool isOnline)
{
CoreConnectionSettings s;
}
}
+
bool CoreConnection::isEncrypted() const
{
return _peer && _peer->isSecure();
if (state != _state) {
_state = state;
emit stateChanged(state);
+ if (state == Connected)
+ _wantReconnect = true;
if (state == Disconnected)
emit disconnected();
}