|
|
|
@ -85,9 +85,14 @@ RemoteMDI::~RemoteMDI()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RemoteMDI::updateStatusBarMessage() {
|
|
|
|
|
TQString windowStatusBarMessage;
|
|
|
|
|
if (m_pCurrentWindow) {
|
|
|
|
|
windowStatusBarMessage = m_windowStatusBarMapping[TQT_TQOBJECT(m_pCurrentWindow)];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KStatusBar* sb = statusBar();
|
|
|
|
|
if (sb) {
|
|
|
|
|
sb->message(m_mainStatusBarMessage + ((m_windowStatusBarMessage != "")?" [" + i18n("Instrument") + ": " + m_windowStatusBarMessage + "]":""));
|
|
|
|
|
sb->message(m_mainStatusBarMessage + ((windowStatusBarMessage != "")?" [" + i18n("Instrument") + ": " + windowStatusBarMessage + "]":""));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -96,8 +101,16 @@ void RemoteMDI::updateStatusBarMainMessage(const TQString& message) {
|
|
|
|
|
updateStatusBarMessage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RemoteMDI::updateStatusBarWindowMessage(const TQString& message) {
|
|
|
|
|
m_windowStatusBarMessage = message;
|
|
|
|
|
void RemoteMDI::updateStatusBarWindowMessage(const TQString& message, const TQObject* window) {
|
|
|
|
|
const TQObject* windowObject = window;
|
|
|
|
|
if (!windowObject) {
|
|
|
|
|
windowObject = sender();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (windowObject) {
|
|
|
|
|
m_windowStatusBarMapping[windowObject] = message;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateStatusBarMessage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -140,11 +153,9 @@ void RemoteMDI::startModule() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RemoteLab::InstrumentView* view = new RemoteLab::InstrumentView(st.clientLibrary, st.name, (mdiMode() == KMdi::ToplevelMode) ? 0 : this);
|
|
|
|
|
view->setName(st.clientLibrary.ascii());
|
|
|
|
|
connect(view, SIGNAL(statusMessageSet(const TQString&)), this, SLOT(updateStatusBarWindowMessage(const TQString&)));
|
|
|
|
|
if (st.singleInstance) {
|
|
|
|
|
// RAJA FIXME
|
|
|
|
|
// Store the kaction and this view pointer both in a list
|
|
|
|
|
// Also remember to alter updateStatusBarWindowMessage to store the latest string for the active window and display properly
|
|
|
|
|
const_cast<KAction*>(sendingAction)->setEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
openNewWindow(view);
|
|
|
|
@ -433,7 +444,7 @@ void RemoteMDI::closeCurrent() {
|
|
|
|
|
void RemoteMDI::closeSpecifiedWindow(KMdiChildView *window) {
|
|
|
|
|
if (window) {
|
|
|
|
|
// Notify the status bar of the removal of the window
|
|
|
|
|
updateStatusBarWindowMessage(TQString::null);
|
|
|
|
|
updateStatusBarWindowMessage(TQString::null, TQT_TQOBJECT(window));
|
|
|
|
|
updateStatusBarMainMessage(i18n("Instrument %1 removed").arg(window->tabCaption()));
|
|
|
|
|
|
|
|
|
|
// We could also call removeWindowFromMdi, but it doesn't delete the
|
|
|
|
@ -458,9 +469,23 @@ void RemoteMDI::childClosed(KMdiChildView * w) {
|
|
|
|
|
unplugActionList("selectedInstrument_actionlist");
|
|
|
|
|
|
|
|
|
|
// Notify the status bar of the removal of the window
|
|
|
|
|
updateStatusBarWindowMessage(TQString::null);
|
|
|
|
|
updateStatusBarWindowMessage(TQString::null, TQT_TQOBJECT(w));
|
|
|
|
|
updateStatusBarMainMessage(i18n("Instrument %1 removed").arg(w->tabCaption()));
|
|
|
|
|
|
|
|
|
|
// Re-enable associated action
|
|
|
|
|
RemoteLab::InstrumentView* view = dynamic_cast<RemoteLab::InstrumentView*>(w);
|
|
|
|
|
if (view) {
|
|
|
|
|
TQString libraryName = view->name();
|
|
|
|
|
for (TQPtrList<KAction>::Iterator it(m_instrumentActionList.begin()); it != m_instrumentActionList.end(); ++it) {
|
|
|
|
|
if ((*it)->name() == libraryName) {
|
|
|
|
|
(*it)->setEnabled(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remove status bar text
|
|
|
|
|
m_windowStatusBarMapping.remove(TQT_TQOBJECT(w));
|
|
|
|
|
|
|
|
|
|
// Remove the view from MDI, BUT DO NOT DELETE IT! It is automatically deleted by TQt since it was closed.
|
|
|
|
|
removeWindowFromMdi(w);
|
|
|
|
|
}
|
|
|
|
|