Axivion: Allow None item for dashboard

This allows to explicitly disable the accesses of possibly
configured dashboards.

The old approach with the hard linking is gone and if the
user now accesses the Axivion perspective intentional or
not the session is tied to the dashboard until this is
changed to a different one.
That also means accessing any file inside the session may
try to request information about the file from the current
dashboard server.

Make it possible to undo the loose linking by introducing
a None item which in turn disables accessing the dashboard.

Change-Id: I04a960baad102663c4d97e652d44c86a04563416
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
Christian Stenger
2024-10-09 13:51:50 +02:00
parent fae89be345
commit 41d276eb6f
2 changed files with 22 additions and 13 deletions

View File

@@ -244,8 +244,15 @@ IssuesWidget::IssuesWidget(QWidget *parent)
if (data.isValid()) {
const AxivionServer server = data.value<AxivionServer>();
switchActiveDashboardId(server.id);
reinitProjectList(m_dashboardProjects->currentText());
} else {
switchActiveDashboardId({});
{
GuardLocker lock(m_signalBlocker);
m_dashboardProjects->clear();
}
updateBasicProjectInfo(std::nullopt);
}
reinitProjectList(m_dashboardProjects->currentText());
});
m_dashboardProjects = new QComboBox(this);
@@ -411,28 +418,34 @@ void IssuesWidget::initDashboardList(const QString &preferredProject)
: preferredProject;
resetDashboard();
m_dashboardListUninitialized = false;
GuardLocker lock(m_signalBlocker);
const QList<AxivionServer> servers = settings().allAvailableServers();
if (servers.isEmpty()) {
switchActiveDashboardId({});
{
GuardLocker lock(m_signalBlocker);
m_dashboardProjects->clear();
}
updateBasicProjectInfo(std::nullopt);
return;
}
GuardLocker lock(m_signalBlocker);
m_dashboards->addItem(Tr::tr("None"));
for (const AxivionServer &server : servers)
m_dashboards->addItem(server.displayString(), QVariant::fromValue(server));
Id activeId = activeDashboardId();
if (!activeId.isValid())
activeId = settings().defaultDashboardId();
if (activeId.isValid()) {
int index = Utils::indexOf(servers, Utils::equal(&AxivionServer::id, activeId));
if (index < 0) {
activeId = settings().defaultDashboardId();
index = Utils::indexOf(servers, Utils::equal(&AxivionServer::id, activeId));
}
m_dashboards->setCurrentIndex(index);
m_dashboards->setCurrentIndex(index + 1);
reinitProjectList(currentProject);
} else {
m_dashboards->setCurrentIndex(0);
}
switchActiveDashboardId(activeId);
reinitProjectList(currentProject);
}
void IssuesWidget::reinitProjectList(const QString &currentProject)

View File

@@ -1026,13 +1026,9 @@ void AxivionPluginPrivate::onSessionLoaded(const QString &sessionName)
const QString projectName = SessionManager::sessionValue(SV_PROJECTNAME).toString();
const Id dashboardId = Id::fromSetting(SessionManager::sessionValue(SV_DASHBOARDID));
if (!dashboardId.isValid()) {
if (!dashboardId.isValid())
switchActiveDashboardId({});
resetDashboard();
return;
}
if (activeDashboardId() != dashboardId)
else if (activeDashboardId() != dashboardId)
switchActiveDashboardId(dashboardId);
reinitDashboard(projectName);
}