Remove network information from tooltip when disconnected, showing a
"Not connected" line instead.
Don't show the server name if empty.
This fixes a slightly confusing state where the tooltip implies the
network's connected when it's actually not.
Q_UNUSED(column);
QString strTooltip;
QTextStream tooltip( &strTooltip, QIODevice::WriteOnly );
Q_UNUSED(column);
QString strTooltip;
QTextStream tooltip( &strTooltip, QIODevice::WriteOnly );
- tooltip << "<qt><style>.bold { font-weight: bold; }</style>";
+ tooltip << "<qt><style>.bold { font-weight: bold; } .italic { font-style: italic; }</style>";
// Function to add a row to the tooltip table
auto addRow = [&](const QString& key, const QString& value, bool condition) {
// Function to add a row to the tooltip table
auto addRow = [&](const QString& key, const QString& value, bool condition) {
};
tooltip << "<p class='bold' align='center'>" << NetworkItem::escapeHTML(networkName(), true) << "</p>";
};
tooltip << "<p class='bold' align='center'>" << NetworkItem::escapeHTML(networkName(), true) << "</p>";
- tooltip << "<table cellspacing='5' cellpadding='0'>";
- addRow(tr("Server"), NetworkItem::escapeHTML(currentServer(), true), true);
-
- addRow(tr("Users"), QString::number(nickCount()), true);
-
- if (_network)
- addRow(tr("Lag"), NetworkItem::escapeHTML(tr("%1 msecs").arg(_network->latency()), true), true);
+ if (isActive()) {
+ tooltip << "<table cellspacing='5' cellpadding='0'>";
+ addRow(tr("Server"), NetworkItem::escapeHTML(currentServer(), true), !currentServer().isEmpty());
+ addRow(tr("Users"), QString::number(nickCount()), true);
+ if (_network)
+ addRow(tr("Lag"), NetworkItem::escapeHTML(tr("%1 msecs").arg(_network->latency()), true), true);
- tooltip << "</table></qt>";
+ tooltip << "</table>";
+ } else {
+ tooltip << "<p class='italic' align='center'>" << tr("Not connected") << "</p>";
+ }
+ tooltip << "</qt>";