Esempio n. 1
0
/**
 * Marks a file as modified when the contents of the editor change.
 * This slot is conncted to the textChanged() signal of the Document object.
 * In addition to marking the file, this method also emits the modified()
 * signal.
 */
void EditorPage::slotSetModified(KTextEditor::Document *pDoc)
{
    if (m_pDoc != pDoc) {
        qDebug() << "edieor page documant dose not match"; 
        return;
    }

	// Only perform tasks if the file is not already marked
	if (!m_bModified && pDoc->isModified()) {
		m_bModified = true;
		emit modified(this, m_bModified);
	
		// check whether it was modified on
		// disk as well, and issue a warning if so
        KTextEditor::ModificationInterface *iface =
            qobject_cast<KTextEditor::ModificationInterface *>(pDoc);
		if (iface)
			iface->slotModifiedOnDisk(m_pView);
	}
}
Esempio n. 2
0
/**
 * Marks a file as modified when the contents of the editor change.
 * This slot is connected to the textChanged() signal of the Document object.
 * In addition to marking the file, this method also emits the modified()
 * signal.
 */
void EditorPage::slotSetModified(KTextEditor::Document* pDoc)
{
	// Only perform tasks if the file is not already marked
	if (!m_bModified && m_pDoc->isModified()) {
		m_bModified = true;
		emit modified(this, m_bModified);

#if KDE_IS_VERSION(3,3,0)
		// If the editor is a Kate part, check whether it was modified on
		// disk as well, and issue a warning if so
		KTextEditor::ModificationInterface *pModificationIf;

		pModificationIf = qobject_cast<KTextEditor::ModificationInterface *>(m_pDoc);
		if (pModificationIf){
			pModificationIf->slotModifiedOnDisk(pDoc->activeView());
		}
#endif
	}

	// Start/restart the auto-completion timer
	m_pCompletion->slotAutoComplete();
}