mirror of
https://github.com/KDE/krfb
synced 2026-07-01 07:31:16 -07:00
Show hostname in krfb connection info
Summary: Using krfb as desktop support tool for ~250 desktops on LAN - 95% of the users aren't equipped to deal with reciting IP addresses accurately, so I wanted to add the hostname into the connection details as well, since it's easier for non-tech people to read that back. Attached patch does this, and works internally for us - thoughts on doing it better: * hostnames as reported by the host are not necessarily accurate for network access, so * consider actually doing a nameserver lookup to verify * only show the hostname if you can verify Reviewers: ngraham, #kde_applications, aacid Reviewed By: #kde_applications, aacid Subscribers: akulichalexandr, aacid, pino, alexeymin Tags: #kde_applications Differential Revision: https://phabricator.kde.org/D14527
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include <QVector>
|
||||
#include <QSet>
|
||||
#include <QNetworkInterface>
|
||||
#include <QHostInfo>
|
||||
|
||||
|
||||
class TCP: public QWidget, public Ui::TCP
|
||||
@@ -141,10 +142,14 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
continue;
|
||||
|
||||
if(interface.flags() & QNetworkInterface::IsRunning &&
|
||||
!interface.addressEntries().isEmpty())
|
||||
m_ui.addressDisplayLabel->setText(QStringLiteral("%1 : %2")
|
||||
.arg(interface.addressEntries().first().ip().toString())
|
||||
.arg(port));
|
||||
!interface.addressEntries().isEmpty()) {
|
||||
const QString hostName = QHostInfo::localHostName();
|
||||
const QString ipAddress = interface.addressEntries().first().ip().toString();
|
||||
const QString addressLabelText = hostName.isEmpty()
|
||||
? QStringLiteral("%1 : %2").arg(ipAddress).arg(port)
|
||||
: QStringLiteral("%1 (%2) : %3").arg(hostName, ipAddress).arg(port);
|
||||
m_ui.addressDisplayLabel->setText(addressLabelText);
|
||||
}
|
||||
}
|
||||
|
||||
//Figure out the password
|
||||
|
||||
Reference in New Issue
Block a user