DocManager Class Reference

#include <docmanager.h>

Collaboration diagram for DocManager:

Collaboration graph
[legend]
List of all members.

Public Slots

TextDocumentcreateTextDocument ()
CircuitDocumentcreateCircuitDocument ()
FlowCodeDocumentcreateFlowCodeDocument ()
MechanicsDocumentcreateMechanicsDocument ()

Signals

void fileOpened (const KURL &url)

Public Member Functions

 ~DocManager ()
bool closeAll ()
void gotoTextLine (const KURL &url, int line)
DocumentopenURL (const KURL &url, ViewArea *viewArea=0)
ViewgetFocusedView () const
DocumentgetFocusedDocument () const
QString untitledName (int type)
DocumentfindDocument (const KURL &url) const
void associateDocument (const KURL &url, Document *document)
void giveDocumentFocus (Document *toFocus, ViewArea *viewAreaForNew=0)
void removeDocumentAssociations (Document *document)
void disableContextActions ()

Static Public Member Functions

static DocManagerself (KTechlab *ktechlab=0)

Protected Slots

void slotViewFocused (View *view)
void slotViewUnfocused ()
void documentDestroyed (QObject *obj)

Protected Member Functions

void handleNewDocument (Document *document, ViewArea *viewArea=0)
ViewcreateNewView (Document *document, ViewArea *viewArea=0)
CircuitDocumentopenCircuitFile (const KURL &url, ViewArea *viewArea=0)
FlowCodeDocumentopenFlowCodeFile (const KURL &url, ViewArea *viewArea=0)
MechanicsDocumentopenMechanicsFile (const KURL &url, ViewArea *viewArea=0)
TextDocumentopenTextFile (const KURL &url, ViewArea *viewArea=0)

Protected Attributes

DocumentList m_documentList
URLDocumentMap m_associatedDocuments
int m_countCircuit
int m_countFlowCode
int m_countMechanics
int m_countOther
KTechlab *const p_ktechlab
QGuardedPtr< Viewp_focusedView
QGuardedPtr< Documentp_connectedDocument
DocManagerIfacem_pIface
unsigned m_nextDocumentID

Detailed Description

Author:
David Saxton

Definition at line 37 of file docmanager.h.


Member Function Documentation

bool DocManager::closeAll (  ) 

Attempts to close all open documents, returning true if successful

Definition at line 64 of file docmanager.cpp.

References m_documentList, and removeDocumentAssociations().

void DocManager::gotoTextLine ( const KURL &  url,
int  line 
)

Goes to the given line in the given text file (if the file exists)

Definition at line 82 of file docmanager.cpp.

References TextView::gotoLine(), openURL(), and TextDocument::textView().

Referenced by LanguageManager::slotParaClicked().

Document * DocManager::openURL ( const KURL &  url,
ViewArea viewArea = 0 
)

Attempts to open the document at the given url.

Parameters:
ViewArea if non-null, will open the new view into the ViewArea

Definition at line 92 of file docmanager.cpp.

References createNewView(), findDocument(), giveDocumentFocus(), openCircuitFile(), openFlowCodeFile(), openMechanicsFile(), and openTextFile().

Referenced by ItemView::dropEvent(), gotoTextLine(), KTechlab::load(), PICComponent::mouseDoubleClickEvent(), ViewArea::restoreState(), ProcessChain::slotFinishedCompile(), and KTechlab::slotTabContextActivated().

View* DocManager::getFocusedView (  )  const [inline]

Returns the focused View

Definition at line 60 of file docmanager.h.

References p_focusedView.

Document * DocManager::getFocusedDocument (  )  const

Returns the focused Document (the document of the focused view)

Definition at line 138 of file docmanager.cpp.

References Document::isDeleted(), and p_focusedView.

Referenced by ProjectItem::addCurrentFile(), KTechlab::slotDocUndoRedoChanged(), and KTechlab::slotUpdateCaptions().

QString DocManager::untitledName ( int  type  ) 

Get a unique name, e.g. Untitled (circuit) - n" depending on the types of Document and whether it is the first one or not

Parameters:
type Document::DocumentType - type of Document

Definition at line 161 of file docmanager.cpp.

References m_countCircuit, m_countFlowCode, m_countMechanics, and m_countOther.

Referenced by createCircuitDocument(), createFlowCodeDocument(), createMechanicsDocument(), and createTextDocument().

Document * DocManager::findDocument ( const KURL &  url  )  const

Checks to see if a document with the given URL is already open, and returns a pointer to that Document if so - otherwises returns null

See also:
associateDocument

Definition at line 207 of file docmanager.cpp.

References m_associatedDocuments, and m_documentList.

Referenced by ProjectItem::build(), ProjectItem::closeOpenFiles(), and openURL().

void DocManager::associateDocument ( const KURL &  url,
Document document 
)

Associates a url with a pointer to a document. When findFile is called with the given url, it will return a pointer to this document if it still exists.

See also:
findDocument

Definition at line 225 of file docmanager.cpp.

References m_associatedDocuments.

Referenced by TextDocument::outputFilePath().

void DocManager::giveDocumentFocus ( Document toFocus,
ViewArea viewAreaForNew = 0 
)

Gives the given document focus. If it has no open views, one will be created for it if viewAreaForNew is non-null

Definition at line 145 of file docmanager.cpp.

References Document::activeView(), createNewView(), p_ktechlab, and KTechlab::tabWidget().

Referenced by openURL(), and ProcessChain::slotFinishedCompile().

TextDocument * DocManager::createTextDocument (  )  [slot]

Creates an empty text document (with an open view)

Definition at line 390 of file docmanager.cpp.

References TextDocument::constructTextDocument(), handleNewDocument(), p_ktechlab, and untitledName().

Referenced by ProcessChain::slotFinishedCompile().

CircuitDocument * DocManager::createCircuitDocument (  )  [slot]

Creates an empty circuit document (with an open view), and shows the component selector.

Definition at line 398 of file docmanager.cpp.

References handleNewDocument(), p_ktechlab, KateMDI::MainWindow::showToolView(), KateMDI::MainWindow::toolView(), ComponentSelector::toolViewIdentifier(), and untitledName().

FlowCodeDocument * DocManager::createFlowCodeDocument (  )  [slot]

Creates an empty flowcode document (with an open view), and shows the flowpart selector.

Definition at line 408 of file docmanager.cpp.

References handleNewDocument(), p_ktechlab, KateMDI::MainWindow::showToolView(), KateMDI::MainWindow::toolView(), FlowPartSelector::toolViewIdentifier(), and untitledName().

MechanicsDocument * DocManager::createMechanicsDocument (  )  [slot]

Creates an empty mechanics document (with an open view), and shows the mechanics selector.

Definition at line 418 of file docmanager.cpp.

References handleNewDocument(), p_ktechlab, KateMDI::MainWindow::showToolView(), KateMDI::MainWindow::toolView(), MechanicsSelector::toolViewIdentifier(), and untitledName().

void DocManager::fileOpened ( const KURL &  url  )  [signal]

Emitted when a file is successfully opened

Referenced by openCircuitFile(), openFlowCodeFile(), openMechanicsFile(), and openTextFile().

void DocManager::slotViewFocused ( View view  )  [protected, slot]

Does the appropriate enabling / disabling of actions, connections, etc

Definition at line 305 of file docmanager.cpp.

References ViewContainer::activeView(), View::document(), p_connectedDocument, p_focusedView, p_ktechlab, KTechlab::requestUpdateCaptions(), ItemInterface::self(), KTechlab::slotDocModifiedChanged(), KTechlab::slotDocUndoRedoChanged(), ItemInterface::slotItemDocumentChanged(), slotViewUnfocused(), KTechlab::tabWidget(), Document::type(), and View::viewContainer().

Referenced by handleNewDocument().

void DocManager::slotViewUnfocused (  )  [protected, slot]

Does the appropriate enabling / disabling of actions, connections, etc

Definition at line 352 of file docmanager.cpp.

References disableContextActions(), p_connectedDocument, p_focusedView, p_ktechlab, KTechlab::removeGUIClients(), KTechlab::requestUpdateCaptions(), ItemInterface::self(), and ItemInterface::slotItemDocumentChanged().

Referenced by handleNewDocument(), and slotViewFocused().

void DocManager::handleNewDocument ( Document document,
ViewArea viewArea = 0 
) [protected]

This function should be called after creating a new document to add it to the appropriate lists and connect it up as appropriate

Definition at line 255 of file docmanager.cpp.

References createNewView(), documentDestroyed(), m_documentList, m_nextDocumentID, p_ktechlab, slotViewFocused(), and slotViewUnfocused().

Referenced by createCircuitDocument(), createFlowCodeDocument(), createMechanicsDocument(), createTextDocument(), openCircuitFile(), openFlowCodeFile(), openMechanicsFile(), and openTextFile().

View * DocManager::createNewView ( Document document,
ViewArea viewArea = 0 
) [protected]

Takes the document, creates a new view and shoves it in a new ViewContainer

Definition at line 274 of file docmanager.cpp.

References KTechlab::addWindow(), Document::caption(), Document::createView(), ViewArea::id(), p_ktechlab, View::setFocused(), and ViewArea::viewContainer().

Referenced by giveDocumentFocus(), handleNewDocument(), and openURL().


The documentation for this class was generated from the following files:
Generated on Tue May 8 17:05:38 2007 for KTechLab by  doxygen 1.5.1