Commit bc83609f authored by Alexander Semke's avatar Alexander Semke
Browse files

When switching between the different worksheets, update the status bar

to properly show the status of the current worksheet.
parent c71ffbcb
Pipeline #50948 passed with stage
in 25 minutes and 31 seconds
......@@ -18,6 +18,7 @@
Copyright (C) 2009 Alexander Rieder <alexanderrieder@gmail.com>
*/
#include "cantor.h"
#include "lib/session.h"
#include <cassert>
......@@ -40,6 +41,7 @@
#include <QFileDialog>
#include <QPushButton>
#include <QRegularExpression>
#include <QStatusBar>
#include <QGraphicsView>
#include "lib/backend.h"
......@@ -69,8 +71,8 @@ CantorShell::CantorShell() : KParts::MainWindow(), m_part(nullptr), m_panelHandl
m_tabWidget->setDocumentMode(true);
setCentralWidget(m_tabWidget);
connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(activateWorksheet(int)));
connect(m_tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
connect(m_tabWidget, &QTabWidget::currentChanged, this, &CantorShell::activateWorksheet);
connect(m_tabWidget, &QTabWidget::tabCloseRequested, this, &CantorShell::closeTab);
// apply the saved mainwindow settings, if any, and ask the mainwindow
// to automatically save settings if changed: window size, toolbar
......@@ -431,11 +433,31 @@ void CantorShell::activateWorksheet(int index)
m_pluginsStates[m_part] = states;
}
if (index != -1)
{
m_part = findPart(m_tabWidget->widget(index));
if(m_part)
{
createGUI(m_part);
//update the status bar
auto* wa = m_part->findChild<Cantor::WorksheetAccessInterface*>(Cantor::WorksheetAccessInterface::Name);
if (wa->session())
{
auto status = wa->session()->status();
switch (status) {
case Cantor::Session::Running:
statusBar()->showMessage(i18n("Calculating..."));
break;
case Cantor::Session::Done:
statusBar()->showMessage(i18n("Ready"));
break;
case Cantor::Session::Disable:
statusBar()->showMessage(QString());
break;
}
}
updateWindowTitle(m_part->url().fileName());
updatePanel();
}
......@@ -443,6 +465,7 @@ void CantorShell::activateWorksheet(int index)
qDebug()<<"selected part doesn't exist";
m_tabWidget->setCurrentIndex(index);
}
}
void CantorShell::setTabCaption(const QString& caption, const QIcon& icon)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment