Exemplo n.º 1
0
//-----------------------------------------------------------------------------
// Function: DrawingBoard::addAndOpenDocument()
//-----------------------------------------------------------------------------
void DrawingBoard::addAndOpenDocument(TabDocument* doc, bool forceUnlocked)
{
    if (forceUnlocked)
    {
        doc->setProtection(false);
    }
    else
    {
        // Open in unlocked mode by default only if the version is draft.
        doc->setProtection(doc->getDocumentVLNV().getVersion() != "draft");
    }

    connect(doc, SIGNAL(errorMessage(QString const&)),
            this, SIGNAL(errorMessage(QString const&)), Qt::UniqueConnection);
    connect(doc, SIGNAL(noticeMessage(QString const&)),
            this, SIGNAL(noticeMessage(QString const&)), Qt::UniqueConnection);

    connect(doc, SIGNAL(helpUrlRequested(QString const&)),
            this, SIGNAL(helpUrlRequested(QString const&)), Qt::UniqueConnection);

    connect(doc, SIGNAL(contentChanged()), this, SIGNAL(documentContentChanged()), Qt::UniqueConnection);
    connect(doc, SIGNAL(modifiedChanged(bool)), this, SIGNAL(documentModifiedChanged(bool)), Qt::UniqueConnection);
    connect(doc, SIGNAL(documentSaved(TabDocument*)),
            this, SLOT(onDocumentSaved(TabDocument*)), Qt::UniqueConnection);
    connect(doc, SIGNAL(titleChanged(TabDocument*, QString const&)),
            this, SLOT(onDocumentTitleChanged(TabDocument*, QString const&)), Qt::UniqueConnection);

    if (doc->getEditProvider() != 0)
    {
        connect(doc->getEditProvider(), SIGNAL(editStateChanged()), this, SIGNAL(documentEditStateChanged()));
    }

    addTab(doc, doc->getTitle());
    setCurrentWidget(doc);
}
Exemplo n.º 2
0
void Phrase::setEditState(Phrase::EditState state)
{
    if (m_editState == state) {
        return;
    }
    m_editState = state;
    emit editStateChanged();
}