More Fixes

This commit is contained in:
2026-05-04 22:25:48 +02:00
parent 5f667b2b16
commit 609de21106
17 changed files with 168 additions and 107 deletions
+7 -3
View File
@@ -42,6 +42,7 @@
// #include <KConfigGroup>
// #include <KSharedConfig>
#include <QDebug>
#include <QRegularExpression>
#if defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD) || defined(Q_OS_MAC)
#include <sys/sysctl.h>
@@ -1133,16 +1134,19 @@ QString SSHProcessInfo::format(const QString& input) const
QString output(input);
// test whether host is an ip address
// in which case 'short host' and 'full host'
// markers in the input string are replaced with
// the full address
bool isIpAddress = false;
#if !defined(Q_OS_WIN)
struct in_addr address;
if (inet_aton(_host.toLocal8Bit().constData(), &address) != 0)
isIpAddress = true;
else
isIpAddress = false;
#else
// On Windows, use a simple heuristic: contains only digits and dots → IP
isIpAddress = QRegularExpression(QStringLiteral("^\\d+\\.\\d+\\.\\d+\\.\\d+$"))
.match(_host).hasMatch();
#endif
// search for and replace known markers
output.replace("%u", _user);