void EditorTabWidget::closeCurrentDocument() { if(count() == 0) return; m_closeGuard = true; int index = currentPageIndex(); QValueList<Document_t>::iterator it = m_docList.at(index); KTextEditor::Document* doc = (*it).view->document(); doc->closeURL(); KTextEditor::View* view = (*it).view; delete view; delete doc; QWidget* w = page(index); removePage(w); m_docList.remove(it); if(count() == 0) { disableEditorActions(); } m_closeGuard = false; }
void EditorTabWidget::closeAllDocuments() { int i = 0; QWidget* w; KTextEditor::Document* doc; KTextEditor::View* view; QValueList<Document_t>::iterator it; for( it = m_docList.begin(); it != m_docList.end(); ++it, ++i ) { view = (*it).view; doc = (*it).view->document(); doc->closeURL(); delete view; delete doc; w = page(i); removePage(w); i++; } m_docList.clear(); disableEditorActions(); }