bool DocumentWindow::loadDocument(const QString& path) { if (!closeDocument()) { return false; } const QFile::FileError loading = m_document.loadFromFile(path); if (loading != QFile::NoError) { showPopup(tr("Error"), tr("Failed to load file: %1").arg(path)); return false; } m_path = path; m_synchronized = true; setWindowTitle(separateName(path)); setDocumentModel(); emit documentLoaded(path); return true; }
void TextDomArea::loadFile(const BoostPath& pathOfFile) { PlainDocumentRefPtr temp=dynamic_pointer_cast<PlainDocument>(TextFileHandler::the()->forceRead(pathOfFile)); if(temp) { setDocumentModel(temp); handleDocumentModelChanged(); } }
bool DocumentWindow::buildNew() { if (!closeDocument()) { return false; } setWindowTitle(tr("new %1 *").arg(s_newUniqueId++)); m_document.buildNew(); setDocumentModel(); return true; }