bool MainWindow::setCurrentDoc(Document* doc) { if(documentIndex(doc) == -1) return false; m_pages->setCurrentWidget(doc->view()->widget()); return true; }
KTextEditor::MarkInterface* EditorTabWidget::documentMarkIf(const QString& path) { int index = documentIndex(path); if(index == -1) return NULL; return dynamic_cast<KTextEditor::MarkInterface*>( (*(m_docList.at(index))).view->document()); }
void EditorTabWidget::setCurrentDocument(const QString& filePath, bool forceOpen) { int index = documentIndex(filePath); if(index != -1) { setCurrentPage(index); } else if(forceOpen) { createDocument(KURL(filePath)); } }
bool MainWindow::closeDoc(Document *doc) { int index = documentIndex(doc); if (index >= 0) { onCloseRequested(index); return true; } return false; }
void EditorTabWidget::addDocument(KURL url) { int index; if((index = documentIndex(url.path())) != -1) { //file already opened, show it this->setCurrentPage(index); } else { createDocument(url); } enableEditorActions(); emit sigNewDocument(); }
bool MainWindow::saveDocumentAs(Document* doc) { QString file = QFileDialog::getSaveFileName(this, "Save As", QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "All (*);;XmlOcaf (*.xml);;MDTV-Standard (*.std);;BinOcaf (*.cbf)"); if(!file.isEmpty() && doc->saveAs(file)) { int index = documentIndex(doc); m_pages->setTabToolTip(index, doc->path()); m_pages->setTabText(index, uniqueTitle(doc->name())); setWindowTitle(qApp->applicationName() + " - " + currentDoc()->name()); return true; } return false; }