diff --git a/clients/tde/src/app/remotemdi.cpp b/clients/tde/src/app/remotemdi.cpp index 8647145..be285ae 100644 --- a/clients/tde/src/app/remotemdi.cpp +++ b/clients/tde/src/app/remotemdi.cpp @@ -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(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(w); + if (view) { + TQString libraryName = view->name(); + for (TQPtrList::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); } diff --git a/clients/tde/src/app/remotemdi.h b/clients/tde/src/app/remotemdi.h index 75c6c31..c2c8884 100644 --- a/clients/tde/src/app/remotemdi.h +++ b/clients/tde/src/app/remotemdi.h @@ -60,7 +60,7 @@ class RemoteMDI : public KMdiMainFrm void configKeys(); void updateStatusBarMessage(); void updateStatusBarMainMessage(const TQString& message); - void updateStatusBarWindowMessage(const TQString& message); + void updateStatusBarWindowMessage(const TQString& message, const TQObject* window=NULL); void connectToServer(); void finishConnectingToServer(); void disconnectFromServer(); @@ -76,7 +76,7 @@ class RemoteMDI : public KMdiMainFrm private: TQString m_mainStatusBarMessage; - TQString m_windowStatusBarMessage; + TQMap m_windowStatusBarMapping; unsigned m_children; TQString m_serverHost;