Internal
Public Access
Milestone 5: deliver embedded RDP sessions and lifecycle hardening
This commit is contained in:
+27
-11
@@ -72,24 +72,32 @@ SessionWindow::SessionWindow(const Profile& profile, QWidget* parent)
|
||||
QMenu menu(this);
|
||||
QAction* disconnectAction = menu.addAction(QStringLiteral("Disconnect"));
|
||||
QAction* reconnectAction = menu.addAction(QStringLiteral("Reconnect"));
|
||||
menu.addSeparator();
|
||||
QMenu* themeMenu = menu.addMenu(QStringLiteral("Theme"));
|
||||
QList<QAction*> themeActions;
|
||||
const QString currentTheme = tab->terminalThemeName();
|
||||
for (const QString& themeName : terminalThemeNames()) {
|
||||
QAction* themeAction = themeMenu->addAction(themeName);
|
||||
themeAction->setCheckable(true);
|
||||
themeAction->setChecked(
|
||||
themeName.compare(currentTheme, Qt::CaseInsensitive) == 0);
|
||||
themeActions.append(themeAction);
|
||||
|
||||
if (tab->supportsThemeSelection()) {
|
||||
menu.addSeparator();
|
||||
QMenu* themeMenu = menu.addMenu(QStringLiteral("Theme"));
|
||||
const QString currentTheme = tab->terminalThemeName();
|
||||
for (const QString& themeName : terminalThemeNames()) {
|
||||
QAction* themeAction = themeMenu->addAction(themeName);
|
||||
themeAction->setCheckable(true);
|
||||
themeAction->setChecked(
|
||||
themeName.compare(currentTheme, Qt::CaseInsensitive) == 0);
|
||||
themeActions.append(themeAction);
|
||||
}
|
||||
}
|
||||
QAction* clearAction = menu.addAction(QStringLiteral("Clear"));
|
||||
|
||||
QAction* clearAction = nullptr;
|
||||
if (tab->supportsClearAction()) {
|
||||
clearAction = menu.addAction(QStringLiteral("Clear"));
|
||||
}
|
||||
|
||||
QAction* chosen = menu.exec(m_tabs->tabBar()->mapToGlobal(pos));
|
||||
if (chosen == disconnectAction) {
|
||||
tab->disconnectSession();
|
||||
} else if (chosen == reconnectAction) {
|
||||
tab->reconnectSession();
|
||||
} else if (chosen == clearAction) {
|
||||
} else if (clearAction != nullptr && chosen == clearAction) {
|
||||
tab->clearTerminal();
|
||||
} else {
|
||||
for (QAction* themeAction : themeActions) {
|
||||
@@ -105,11 +113,19 @@ SessionWindow::SessionWindow(const Profile& profile, QWidget* parent)
|
||||
addSessionTab(profile);
|
||||
}
|
||||
|
||||
void SessionWindow::openProfile(const Profile& profile)
|
||||
{
|
||||
addSessionTab(profile);
|
||||
}
|
||||
|
||||
void SessionWindow::addSessionTab(const Profile& profile)
|
||||
{
|
||||
auto* tab = new SessionTab(profile, this);
|
||||
const int index = m_tabs->addTab(tab, tab->tabTitle());
|
||||
m_tabs->setCurrentIndex(index);
|
||||
if (m_tabs->count() > 1) {
|
||||
setWindowTitle(QStringLiteral("OrbitHub Sessions"));
|
||||
}
|
||||
m_tabs->tabBar()->setTabTextColor(
|
||||
index, tabColorForState(SessionState::Disconnected, m_tabs->palette()));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user