Now that we rely on Qt 4.8 and up, we can use QNCM on all platforms.
Solid::Networking didn't do anything else, and is deprecated in
KDE Frameworks in favor of QNCM anyway.
Also improved the core connection settings dialog a bit.
clientcoreinfo.h
)
-if (KDE4_FOUND)
- include_directories(${KDE4_INCLUDES})
- add_definitions(-DHAVE_KDE ${KDE4_DEFINITIONS})
-endif()
-
if (USE_QT5)
list(APPEND qt_modules Widgets)
endif()
qt_use_modules(mod_client Network Core Gui ${qt_modules})
target_link_libraries(mod_client mod_common)
-
-if (KDE4_FOUND)
- target_link_libraries(mod_client ${KDE4_SOLID_LIBS})
-endif()
CoreConnectionSettings::NetworkDetectionMode CoreConnectionSettings::networkDetectionMode()
{
-#ifdef HAVE_KDE4
- NetworkDetectionMode def = UseSolid;
-#else
- NetworkDetectionMode def = UseQNetworkConfigurationManager;
-#endif
- return (NetworkDetectionMode)localValue("NetworkDetectionMode", def).toInt();
+ auto mode = localValue("NetworkDetectionMode", UseQNetworkConfigurationManager).toInt();
+ if (mode == 0)
+ mode = UseQNetworkConfigurationManager; // UseSolid is gone, map that to the new default
+ return static_cast<NetworkDetectionMode>(mode);
}
{
public:
enum NetworkDetectionMode {
- UseSolid,
- UseQNetworkConfigurationManager,
+ UseQNetworkConfigurationManager = 1, // UseSolid is gone
UsePingTimeout,
NoActiveDetection
};
_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();
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef CORECONNECTION_H_
-#define CORECONNECTION_H_
+#pragma once
-#include "QPointer"
-#include "QTimer"
+#include <QNetworkConfigurationManager>
+#include <QPointer>
+#include <QTimer>
#ifdef HAVE_SSL
# include <QSslSocket>
# include <QTcpSocket>
#endif
-#ifdef HAVE_KDE4
-# include <Solid/Networking>
-#endif
-
-#include <QNetworkConfigurationManager>
-
#include "coreaccount.h"
#include "remotepeer.h"
#include "types.h"
void reconnectIntervalChanged(const QVariant &interval);
void reconnectTimeout();
-#ifdef HAVE_KDE4
- void solidNetworkStatusChanged(Solid::Networking::Status status);
-#endif
void onlineStateChanged(bool isOnline);
private:
inline CoreConnection::ConnectionState CoreConnection::state() const { return _state; }
inline bool CoreConnection::isConnected() const { return state() >= Connected; }
inline CoreAccount CoreConnection::currentAccount() const { return _account; }
-
-#endif
: SettingsPage(tr("Remote Cores"), tr("Connection"), parent)
{
ui.setupUi(this);
-#ifndef HAVE_KDE4
- ui.useSolid->hide();
-#endif
initAutoWidgets();
- connect(ui.useSolid, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
connect(ui.useQNetworkConfigurationManager, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
connect(ui.usePingTimeout, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
connect(ui.useNoTimeout, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
void CoreConnectionSettingsPage::defaults()
{
-#ifdef HAVE_KDE4
- setRadioButtons(CoreConnectionSettings::UseSolid);
-#else
setRadioButtons(CoreConnectionSettings::UseQNetworkConfigurationManager);
-#endif
SettingsPage::defaults();
}
void CoreConnectionSettingsPage::setRadioButtons(CoreConnectionSettings::NetworkDetectionMode mode)
{
switch (mode) {
-#ifdef HAVE_KDE4
- case CoreConnectionSettings::UseSolid:
- ui.useSolid->setChecked(true);
- break;
-#endif
case CoreConnectionSettings::UseQNetworkConfigurationManager:
ui.useQNetworkConfigurationManager->setChecked(true);
break;
CoreConnectionSettings::NetworkDetectionMode CoreConnectionSettingsPage::modeFromRadioButtons() const
{
-#ifdef HAVE_KDE4
- if (ui.useSolid->isChecked())
- return CoreConnectionSettings::UseSolid;
-#endif
if (ui.useQNetworkConfigurationManager->isChecked())
return CoreConnectionSettings::UseQNetworkConfigurationManager;
if (ui.usePingTimeout->isChecked())
<rect>
<x>0</x>
<y>0</y>
- <width>446</width>
+ <width>476</width>
<height>465</height>
</rect>
</property>
<string>Network Status Detection</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QRadioButton" name="useSolid">
- <property name="toolTip">
- <string>Rely on KDE's hardware layer to detect if we're online. Recommended for most KDE users</string>
- </property>
- <property name="text">
- <string>Use KDE's network status detection (via Solid)</string>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- </widget>
- </item>
<item>
<widget class="QRadioButton" name="useQNetworkConfigurationManager">
<property name="toolTip">
- <string>Rely on Qt's network configuration manager to detect if we're online.</string>
+ <string>Rely on Qt's network configuration manager to detect if we're online</string>
</property>
<property name="text">
- <string>Use Qt's network status detection (via QNetworkConfigurationManager)</string>
+ <string>Automatic</string>
</property>
<property name="checked">
<bool>false</bool>
<item>
<widget class="QSpinBox" name="reconnectInterval">
<property name="toolTip">
- <string>Actively ping the remote core and disconnect if we didn't get a reply after a certain time</string>
+ <string>Interval between consecutive connection attempts</string>
</property>
<property name="suffix">
<string> seconds</string>
</item>
</layout>
</widget>
+ <tabstops>
+ <tabstop>useQNetworkConfigurationManager</tabstop>
+ <tabstop>usePingTimeout</tabstop>
+ <tabstop>pingTimeout</tabstop>
+ <tabstop>useNoTimeout</tabstop>
+ <tabstop>autoReconnect</tabstop>
+ <tabstop>reconnectInterval</tabstop>
+ </tabstops>
<resources/>
<connections>
<connection>