diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-07-05 01:56:44 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-07-05 01:56:44 -0500 |
commit | fa038ebd48bc9d0402eb9b271f119fefe498f541 (patch) | |
tree | 45d2deb46ea07f3aef63febcfbc37f186c8b86b7 /clients/tde/src | |
parent | 6d13afadb8cf8ef0788afaa0d7b4229bc48d0c19 (diff) | |
download | ulab-fa038ebd48bc9d0402eb9b271f119fefe498f541.tar.gz ulab-fa038ebd48bc9d0402eb9b271f119fefe498f541.zip |
Fix window status bar
Diffstat (limited to 'clients/tde/src')
-rw-r--r-- | clients/tde/src/app/remotemdi.cpp | 41 | ||||
-rw-r--r-- | clients/tde/src/app/remotemdi.h | 4 |
2 files changed, 35 insertions, 10 deletions
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<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); } 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<const TQObject*, TQString> m_windowStatusBarMapping; unsigned m_children; TQString m_serverHost; |