Remove listview

master
Timothy Pearson 12 years ago
parent 65886d792d
commit e3bfbdc4e4

@ -65,14 +65,6 @@ RemoteMDI::RemoteMDI()
// Create the status bar
statusBar()->message(i18n("No view!"));
// Create the list of the opened windows
m_listBox = new KListBox(this);
m_listBox->setCaption(i18n("Opened windows"));
addToolWindow(m_listBox, KDockWidget::DockLeft, getMainDockWidget());
connect(m_listBox, SIGNAL(executed(TQListBoxItem *)), this, SLOT(listBoxExecuted(TQListBoxItem*)));
connect(m_listBox, SIGNAL(rightButtonClicked(TQListBoxItem*, const TQPoint&)), this, SLOT(listBoxRightClicked(TQListBoxItem*)));
processLockouts();
}
@ -198,12 +190,16 @@ void RemoteMDI::disconnectFromServer() {
connect_action->setEnabled(false);
disconnect_action->setEnabled(false);
for (TQValueList< KMdiChildView *>::iterator it = m_window.begin(); it != m_window.end(); ++it ) {
// Get the view
KMdiChildView *view = *it;
// Close it
closeSpecifiedWindow(view);
// Close all windows
KMdiIterator<KMdiChildView*> *it = createIterator();
while (it->currentItem()) {
KMdiChildView *c = dynamic_cast<KMdiChildView*>(it->currentItem());
if (c) {
closeSpecifiedWindow(c);
}
it->next();
}
deleteIterator(it);
if (m_rsvSvrSocket) {
m_rsvSvrSocket->clearPendingData();
@ -279,10 +275,6 @@ void RemoteMDI::openNewWindow(KMdiChildView *view) {
}
(new TQHBoxLayout(view))->setAutoAdd( true );
// Add the item to the window list
m_window.append(view);
m_listBox->insertItem(view->tabCaption());
// Add to the MDI and set as current
if (mdiMode() == KMdi::ToplevelMode) {
addWindow(view, KMdi::Detach);
@ -309,10 +301,6 @@ void RemoteMDI::childWindowCloseRequest(KMdiChildView *pWnd) {
void RemoteMDI::currentChanged(KMdiChildView *current) {
// Update status bar and list box
statusBar()->message(i18n( "%1 activated").arg(current->tabCaption()));
TQListBoxItem *item = m_listBox->findItem(current->tabCaption());
assert(item);
m_listBox->setCurrentItem(item);
}
void RemoteMDI::closeCurrent() {
@ -327,14 +315,6 @@ void RemoteMDI::closeSpecifiedWindow(KMdiChildView *window) {
// Notify the status bar of the removal of the window
statusBar()->message(i18n("%1 removed").arg(window->tabCaption()));
// Remove from the window list
m_window.remove(m_window.find(window));
// Remove from the list box
TQListBoxItem *item = m_listBox->findItem(window->tabCaption());
assert(item);
delete item;
// We could also call removeWindowFromMdi, but it doesn't delete the
// pointer. This way, we're sure that the view will get deleted.
closeWindow(window);
@ -346,43 +326,6 @@ void RemoteMDI::closeSpecifiedWindow(KMdiChildView *window) {
}
}
void RemoteMDI::listBoxExecuted(TQListBoxItem *item) {
// Get the current item's text
TQString text = item->text();
// Active the corresponding tab
for (TQValueList< KMdiChildView *>::iterator it = m_window.begin(); it != m_window.end(); ++it ) {
// Get the view
KMdiChildView *view = *it;
assert(view);
// Is the view we need to show?
if (view->caption() == text) {
view->activate();
break;
}
}
}
void RemoteMDI::listBoxRightClicked(TQListBoxItem *item) {
// Get the current item's text
TQString text = item->text();
// Bring up a menu for the corresponding window
// RAJA FIXME
for (TQValueList< KMdiChildView *>::iterator it = m_window.begin(); it != m_window.end(); ++it ) {
// Get the view
KMdiChildView *view = *it;
assert(view);
// Is the view we need to show?
if (view->caption() == text) {
view->activate();
break;
}
}
}
void RemoteMDI::childClosed(KMdiChildView * w) {
assert(w);
@ -393,26 +336,24 @@ void RemoteMDI::childClosed(KMdiChildView * w) {
// Notify the status bar of the removal of the window
statusBar()->message(i18n("%1 removed").arg(w->tabCaption()));
// Remove from the window list
m_window.remove(m_window.find(w));
// Remove from the list box
TQListBoxItem *item = m_listBox->findItem( w->tabCaption() );
assert(item);
delete item;
// Remove the view from MDI, BUT DO NOT DELETE IT! It is automatically deleted by TQt since it was closed.
removeWindowFromMdi(w);
}
bool RemoteMDI::queryClose() {
// Close all open connections
for (TQValueList< KMdiChildView *>::iterator it = m_window.begin(); it != m_window.end(); ++it ) {
RemoteLab::InstrumentView* iview = dynamic_cast<RemoteLab::InstrumentView*>(*it);
if (iview) {
iview->closeConnections();
KMdiIterator<KMdiChildView*> *it = createIterator();
while (it->currentItem()) {
KMdiChildView *c = dynamic_cast<KMdiChildView*>(it->currentItem());
if (c) {
RemoteLab::InstrumentView* iview = dynamic_cast<RemoteLab::InstrumentView*>(c);
if (iview) {
iview->closeConnections();
}
}
it->next();
}
deleteIterator(it);
// Save current MDI settings (window positions, etc.)
KConfig *c = kapp->config();

@ -53,8 +53,6 @@ class RemoteMDI : public KMdiMainFrm
void currentChanged(KMdiChildView *current);
void closeCurrent();
void closeSpecifiedWindow(KMdiChildView *window);
void listBoxExecuted(TQListBoxItem *);
void listBoxRightClicked(TQListBoxItem *);
void childClosed(KMdiChildView *w);
private slots:
@ -73,9 +71,6 @@ class RemoteMDI : public KMdiMainFrm
unsigned m_children;
TQString m_serverHost;
TQValueList<KMdiChildView*> m_window;
KListBox *m_listBox;
TDEKerberosClientSocket* m_rsvSvrSocket;

Loading…
Cancel
Save