Пример #1
0
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;
}
Пример #2
0
void TextDomArea::loadFile(const BoostPath& pathOfFile)
{
	PlainDocumentRefPtr temp=dynamic_pointer_cast<PlainDocument>(TextFileHandler::the()->forceRead(pathOfFile));
	if(temp)
	{
		setDocumentModel(temp);
		handleDocumentModelChanged();
	}
}
Пример #3
0
bool DocumentWindow::buildNew()
{
    if (!closeDocument())
    {
        return false;
    }

    setWindowTitle(tr("new %1 *").arg(s_newUniqueId++));

    m_document.buildNew();

    setDocumentModel();

    return true;
}