void NetStatus::loggedIn(const QUrl &sessionUrl) { _sessionUrl = sessionUrl; _urlaction->setEnabled(true); _label->setText(tr("Host: %1").arg(fullAddress())); message(tr("Logged in!")); }
/** * Copy the current address to clipboard. * Should not be called if disconnected. */ void NetStatus::copyAddress() { QString addr = fullAddress(); QApplication::clipboard()->setText(addr); // Put address also in selection buffer so it can be pasted with // a middle mouse click where supported. QApplication::clipboard()->setText(addr, QClipboard::Selection); }
void NetStatus::externalIpDiscovered(const QString &ip) { // Only update IP if solicited if(_discoverIp->isVisible()) { _discoverIp->setEnabled(false); // TODO handle IPv6 style addresses int portsep = _address.lastIndexOf(':'); QString port; if(portsep>0) port = _address.mid(portsep); _address = ip; _sessionUrl.setHost(ip); _label->setText(tr("Host: %1").arg(fullAddress())); } }
/** * Set the label to display the address. * A context menu to copy the address to clipboard will be enabled. * @param address the address to display */ void NetStatus::connectingToHost(const QString& address, int port) { _address = address; _port = port; _label->setText(tr("Connecting to %1...").arg(fullAddress())); _copyaction->setEnabled(true); message(_label->text()); // Enable "discover IP" item for local host bool isLocal = WhatIsMyIp::isMyPrivateAddress(address); _discoverIp->setEnabled(isLocal); _discoverIp->setVisible(isLocal); // reset statistics _recvbytes = 0; _sentbytes = 0; _icon->show(); updateIcon(); }