lib Library API Documentation

KoMainWindow Class Reference

Main window for a KOffice application. More...

#include <koMainWindow.h>

List of all members.

Public Slots

void slotEmailFile ()
virtual void slotFileNew ()
virtual void slotFileOpen ()
virtual void slotFileOpenRecent (const KURL &)
virtual void slotFileSave ()
virtual void slotFileSaveAs ()
virtual void slotFilePrint ()
void slotFilePrintPreview ()
virtual void slotDocumentInfo ()
virtual void slotFileClose ()
virtual void slotFileQuit ()
virtual void slotConfigureKeys ()
virtual void slotConfigureToolbars ()
virtual void slotNewToolbarConfig ()
virtual void slotToolbarToggled (bool toggle)
virtual void slotSplitView ()
virtual void slotRemoveView ()
virtual void slotSetOrientation ()
virtual void slotCloseAllViews ()
void slotReloadFile ()
void slotVersionsFile ()
void slotImportFile ()
void slotExportFile ()

Signals

void documentSaved ()
void saveDialogShown ()

Public Member Functions

 KoMainWindow (KInstance *instance, const char *_name=0)
 ~KoMainWindow ()
virtual void setRootDocument (KoDocument *doc)
virtual void updateCaption ()
virtual KoDocumentrootDocument () const
virtual KoViewrootView () const
virtual KParts::PartManager * partManager ()
void print (bool quick)
void showToolbar (const char *tbName, bool shown)
bool toolbarIsVisible (const char *tbName)
QLabelstatusBarLabel ()
void setMaxRecentItems (uint _number)
void addRecentURL (const KURL &url)
virtual bool openDocument (const KURL &url)
bool openDocument (KoDocument *newdoc, const KURL &url)
virtual DCOPObject * dcopObject ()
void reloadRecentFileList ()
virtual void updateCaption (const QString caption, bool mod)
void updateReloadFileAction (KoDocument *doc)
void updateVersionsFileAction (KoDocument *doc)

Protected Slots

virtual void slotActivePartChanged (KParts::Part *newPart)

Protected Member Functions

void chooseNewDocument (intinitDocFlags)
void setRootDocumentDirect (KoDocument *doc, const QPtrList< KoView > &views)
virtual KoDocumentcreateDoc () const
virtual bool saveDocument (bool saveas=false, bool silent=false)
virtual void closeEvent (QCloseEvent *e)
virtual void resizeEvent (QResizeEvent *e)
virtual bool queryClose ()
virtual bool openDocumentInternal (const KURL &url, KoDocument *newdoc=0L)
bool isExporting () const
bool isImporting () const
void saveRecentFiles ()
KRecentFilesAction * recentAction () const


Detailed Description

Main window for a KOffice application.

This class is used to represent a main window of a KOffice component. Each main window contains a menubar and some toolbars.

Note:
This class does NOT need to be subclassed in your application.

Definition at line 50 of file koMainWindow.h.


Constructor & Destructor Documentation

KoMainWindow::KoMainWindow KInstance *  instance,
const char *  _name = 0
 

Constructor.

Initializes a KOffice main window (with its basic GUI etc.).

Definition at line 162 of file koMainWindow.cc.

References slotCloseAllViews(), slotConfigureKeys(), slotConfigureToolbars(), slotDocumentInfo(), slotEmailFile(), slotExportFile(), slotFileClose(), slotFileNew(), slotFileOpen(), slotFileOpenRecent(), slotFilePrint(), slotFilePrintPreview(), slotFileQuit(), slotFileSave(), slotFileSaveAs(), slotImportFile(), slotReloadFile(), slotSplitView(), and slotVersionsFile().

Referenced by chooseNewDocument().

KoMainWindow::~KoMainWindow  ) 
 

Destructor.

Definition at line 290 of file koMainWindow.cc.


Member Function Documentation

void KoMainWindow::setRootDocument KoDocument doc  )  [virtual]
 

Called when a document is assigned to this mainwindow.

This creates a view for this document, makes it the active part, etc.

Definition at line 320 of file koMainWindow.cc.

References updateCaption().

Referenced by chooseNewDocument(), KoView::newView(), openDocument(), slotCloseAllViews(), slotFileClose(), slotReloadFile(), and KoApplication::start().

void KoMainWindow::updateCaption  )  [virtual]
 

Update caption from document info - call when document info (title in the about page) changes.

Definition at line 458 of file koMainWindow.cc.

References rootDocument().

Referenced by openDocument(), and setRootDocument().

KoDocument * KoMainWindow::rootDocument  )  const [virtual]
 

Retrieves the document that is displayed in the mainwindow.

Definition at line 493 of file koMainWindow.cc.

Referenced by chooseNewDocument(), queryClose(), saveDocument(), slotConfigureKeys(), slotConfigureToolbars(), slotDocumentInfo(), slotEmailFile(), slotNewToolbarConfig(), slotReloadFile(), slotToolbarToggled(), and updateCaption().

void KoMainWindow::print bool  quick  ) 
 

Prints the document.

Parameters:
quick whether the print setup dialog is to be displayed

Definition at line 1142 of file koMainWindow.cc.

Referenced by slotFilePrint(), and KoApplication::start().

void KoMainWindow::showToolbar const char *  tbName,
bool  shown
 

The application should call this to show or hide a toolbar.

It also takes care of the corresponding action in the settings menu.

Definition at line 1288 of file koMainWindow.cc.

bool KoMainWindow::toolbarIsVisible const char *  tbName  ) 
 

Returns:
TRUE if the toolbar tbName is visible

Definition at line 1282 of file koMainWindow.cc.

QLabel * KoMainWindow::statusBarLabel  ) 
 

Get hold of the label in the statusbar, to write messages to it.

You can also insert other items in the status bar by using QStatusBar::addWidget.

Definition at line 1516 of file koMainWindow.cc.

void KoMainWindow::setMaxRecentItems uint  _number  ) 
 

Sets the maximum number of recent documents entries.

Definition at line 1526 of file koMainWindow.cc.

void KoMainWindow::addRecentURL const KURL &  url  ) 
 

The document opened a URL -> store into recent documents list.

Definition at line 401 of file koMainWindow.cc.

References saveRecentFiles().

Referenced by saveDocument().

bool KoMainWindow::openDocument const KURL &  url  )  [virtual]
 

Load the desired document and show it.

Parameters:
url the URL to open
Returns:
TRUE on success.

Definition at line 510 of file koMainWindow.cc.

References saveRecentFiles().

Referenced by slotFileOpen(), slotFileOpenRecent(), slotReloadFile(), and KoApplication::start().

bool KoMainWindow::openDocument KoDocument newdoc,
const KURL &  url
 

Load the URL into this document (and make it root doc after loading).

Special method for KoApplication::start, don't use.

Definition at line 523 of file koMainWindow.cc.

References KoDocument::checkAutoSaveFile(), KoDocument::initDoc(), setRootDocument(), and updateCaption().

void KoMainWindow::reloadRecentFileList  ) 
 

Reloads the recent documents list.

Definition at line 445 of file koMainWindow.cc.

void KoMainWindow::updateCaption const QString  caption,
bool  mod
[virtual]
 

Updates the window caption based on the document info and path.

Definition at line 487 of file koMainWindow.cc.

void KoMainWindow::documentSaved  )  [signal]
 

This signal is emitted if the document has been saved successfully.

Referenced by slotFileSave(), and slotFileSaveAs().

void KoMainWindow::saveDialogShown  )  [signal]
 

This signals is emmitted before the save dialog is shown.

Referenced by saveDocument().

void KoMainWindow::slotEmailFile  )  [slot]
 

Slot for eMailing the document using KMail.

This is a very simple extension that will allow any document that is currently being edited to be emailed using KMail.

Definition at line 1541 of file koMainWindow.cc.

References rootDocument(), and saveDocument().

Referenced by KoMainWindow().

void KoMainWindow::slotFileNew  )  [virtual, slot]
 

Slot for opening a new document.

If the current document is empty, the new document replaces it. If not, a new shell will be opened for showing the document.

Definition at line 1056 of file koMainWindow.cc.

References chooseNewDocument().

Referenced by KoMainWindow().

void KoMainWindow::slotFileOpen  )  [virtual, slot]
 

Slot for opening a saved file.

If the current document is empty, the opened document replaces it. If not a new shell will be opened for showing the opened file.

Definition at line 1061 of file koMainWindow.cc.

References isImporting(), KoFilterManager::mimeFilter(), openDocument(), KoDocument::readExtraNativeMimeTypes(), and KoDocument::readNativeFormatMimeType().

Referenced by KoMainWindow(), and slotImportFile().

void KoMainWindow::slotFileOpenRecent const KURL &   )  [virtual, slot]
 

Slot for opening a file among the recently opened files.

If the current document is empty, the opened document replaces it. If not a new shell will be opened for showing the opened file.

Definition at line 1087 of file koMainWindow.cc.

References openDocument().

Referenced by KoMainWindow().

void KoMainWindow::slotFileSave  )  [virtual, slot]
 

Saves the current document with the current name.

Definition at line 1092 of file koMainWindow.cc.

References documentSaved(), and saveDocument().

Referenced by KoMainWindow().

void KoMainWindow::slotFileSaveAs  )  [virtual, slot]
 

Saves the current document with a new name.

Definition at line 1098 of file koMainWindow.cc.

References documentSaved(), and saveDocument().

Referenced by KoMainWindow(), and slotExportFile().

void KoMainWindow::slotFilePrint  )  [virtual, slot]
 

Prints the actual document.

Definition at line 1177 of file koMainWindow.cc.

References print().

Referenced by KoMainWindow().

void KoMainWindow::slotFilePrintPreview  )  [slot]
 

Show a print preview.

Definition at line 1182 of file koMainWindow.cc.

Referenced by KoMainWindow().

void KoMainWindow::slotDocumentInfo  )  [virtual, slot]
 

Show a dialog with author and document information.

Definition at line 1104 of file koMainWindow.cc.

References rootDocument().

Referenced by KoMainWindow().

void KoMainWindow::slotFileClose  )  [virtual, slot]
 

Closes the document.

Definition at line 1125 of file koMainWindow.cc.

References chooseNewDocument(), queryClose(), and setRootDocument().

Referenced by KoMainWindow().

void KoMainWindow::slotFileQuit  )  [virtual, slot]
 

Closes the shell.

Definition at line 1137 of file koMainWindow.cc.

Referenced by KoMainWindow().

void KoMainWindow::slotConfigureKeys  )  [virtual, slot]
 

Configure key bindings.

Definition at line 1217 of file koMainWindow.cc.

References rootDocument().

Referenced by KoMainWindow().

void KoMainWindow::slotConfigureToolbars  )  [virtual, slot]
 

Configure toolbars.

Definition at line 1233 of file koMainWindow.cc.

References rootDocument(), and slotNewToolbarConfig().

Referenced by KoMainWindow().

void KoMainWindow::slotNewToolbarConfig  )  [virtual, slot]
 

Post toolbar config.

(Plug action lists back in, etc.)

Definition at line 1242 of file koMainWindow.cc.

References rootDocument().

Referenced by slotConfigureToolbars().

void KoMainWindow::slotToolbarToggled bool  toggle  )  [virtual, slot]
 

Shows or hides a toolbar.

Definition at line 1263 of file koMainWindow.cc.

References rootDocument().

void KoMainWindow::slotSplitView  )  [virtual, slot]
 

View splitting stuff.

Definition at line 1312 of file koMainWindow.cc.

Referenced by KoMainWindow().

void KoMainWindow::slotCloseAllViews  )  [virtual, slot]
 

Close all views.

Definition at line 1322 of file koMainWindow.cc.

References queryClose(), and setRootDocument().

Referenced by KoMainWindow().

void KoMainWindow::slotReloadFile  )  [slot]
 

Reload file.

Definition at line 1601 of file koMainWindow.cc.

References KoDocument::isEmpty(), KoDocument::isModified(), openDocument(), rootDocument(), and setRootDocument().

Referenced by KoMainWindow().

void KoMainWindow::slotVersionsFile  )  [slot]
 

This will call a dialogbox to add version to list of files.

Definition at line 1594 of file koMainWindow.cc.

Referenced by KoMainWindow().

void KoMainWindow::slotImportFile  )  [slot]
 

File --> Import.

This will call slotFileOpen(). To differentiate this from an ordinary call to slotFileOpen() call isImporting().

Definition at line 1626 of file koMainWindow.cc.

References slotFileOpen().

Referenced by KoMainWindow().

void KoMainWindow::slotExportFile  )  [slot]
 

File --> Export.

This will call slotFileSaveAs(). To differentiate this from an ordinary call to slotFileSaveAs() call isExporting().

Definition at line 1635 of file koMainWindow.cc.

References slotFileSaveAs().

Referenced by KoMainWindow().

void KoMainWindow::chooseNewDocument intinitDocFlags   )  [protected]
 

Helper method for slotFileNew and slotFileClose.

Definition at line 1026 of file koMainWindow.cc.

References createDoc(), KoDocument::documentList(), KoDocument::isEmpty(), KoMainWindow(), rootDocument(), and setRootDocument().

Referenced by slotFileClose(), and slotFileNew().

void KoMainWindow::setRootDocumentDirect KoDocument doc,
const QPtrList< KoView > &  views
[protected]
 

Special method for KOShell, to allow switching the root document (and its views) among a set of them.

Definition at line 386 of file koMainWindow.cc.

KoDocument * KoMainWindow::createDoc  )  const [protected, virtual]
 

Create a new empty document.

Definition at line 451 of file koMainWindow.cc.

References KoDocumentEntry::createDoc(), KoDocumentEntry::queryByMimeType(), and KoDocument::readNativeFormatMimeType().

Referenced by chooseNewDocument().

bool KoMainWindow::saveDocument bool  saveas = false,
bool  silent = false
[protected, virtual]
 

Saves the document, asking for a filename if necessary.

Parameters:
saveas if set to TRUE the user is always prompted for a filename
silent if set to TRUE rootDocument()->setTitleModified will not be called.
Returns:
TRUE on success, false on error or cancel (don't display anything in this case, the error dialog box is also implemented here but restore the original URL in slotFileSaveAs)

Definition at line 677 of file koMainWindow.cc.

References addRecentURL(), KoDocument::confirmNonNativeSave(), KoDocument::exp0rt(), KoDocument::extraNativeMimeTypes(), KoDocument::file(), isExporting(), KoDocument::isNativeFormat(), KoFilterManager::mimeFilter(), KoDocument::mimeType(), KoDocument::nativeFormatMimeType(), KoDocument::outputMimeType(), KoDocument::resetURL(), rootDocument(), saveDialogShown(), KoDocument::setFile(), KoDocument::setModified(), KoDocument::setOutputMimeType(), KoFileDialog::setSpecialMimeFilter(), KoDocument::setTitleModified(), KoDocument::setURL(), KoFileDialog::specialEntrySelected(), KoDocument::specialOutputFlag(), and KoDocument::supportedSpecialFormats().

Referenced by queryClose(), slotEmailFile(), slotFileSave(), and slotFileSaveAs().

bool KoMainWindow::queryClose  )  [protected, virtual]
 

Ask user about saving changes to the document upon exit.

Definition at line 966 of file koMainWindow.cc.

References rootDocument(), and saveDocument().

Referenced by slotCloseAllViews(), and slotFileClose().

bool KoMainWindow::isExporting  )  const [protected]
 

Returns whether or not the current slotFileSave[As]() or saveDocument() call is actually an export operation (like File --> Export).

If this is true, you must call KoDocument::export() instead of KoDocument::save() or KoDocument::saveAs(), in any reimplementation of saveDocument().

Definition at line 1649 of file koMainWindow.cc.

Referenced by saveDocument().

bool KoMainWindow::isImporting  )  const [protected]
 

Returns whether or not the current slotFileOpen() or openDocument() call is actually an import operation (like File --> Import).

If this is true, you must call KoDocument::import() instead of KoDocument::openURL(), in any reimplementation of openDocument() or openDocumentInternal().

Definition at line 1644 of file koMainWindow.cc.

Referenced by slotFileOpen().

void KoMainWindow::saveRecentFiles  )  [protected]
 

Save the list of recent files.

Definition at line 428 of file koMainWindow.cc.

Referenced by addRecentURL(), and openDocument().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for lib Library Version 1.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Feb 13 09:41:03 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003