# class toMain

This class defines the main window. More...

Definition | `#include <tomain.h>`
Inherits | toMainWindow [public ]
List of all Methods

Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- toMain ()
- QWorkspace * workspace ()
- toConnection & currentConnection (void)
- toEditWidget * editWidget ()
- virtual bool close (bool del)
- void createDefault (void)
- void setCoordinates (int,int)
- QPopupMenu * fileMenu ()
- QPopupMenu * editMenu ()
- QPopupMenu * toolsMenu ()
- QPopupMenu * helpMenu ()
- void updateKeepAlive ()
- std::list<QString> connections (void)
- toConnection & connection (const QString &)
- void setNeedCommit (toConnection &conn,bool needCommit=true)
- void editSQL (const QString &str)
- void registerSQLEditor (int toolid)
- void toolWidgetAdded (toToolWidget *tool)
- void toolWidgetRemoved (toToolWidget *tool)
- virtual void exportData (std::map<QCString,QString> &data,const QCString &prefix)
- virtual void importData (std::map<QCString,QString> &data,const QCString &prefix)
- QToolBar * editToolbar ()
- QToolBar * connectionToolbar ()
- void addChart (toLineChart *chart)
- void removeChart (toLineChart *chart)
- void setupChart (toLineChart *chart)
- void displayMessage (const QString &str)
- void addRecentFile (const QString &filename)

#### Public Slots

- void windowsMenu (void)
- void statusMenu (void)
- void contextHelp (void)
- void windowActivated (QWidget *)
- void showFileMenu (void)
- void checkCaching (void)
- void saveSession (void)
- void loadSession (void)
- void closeSession (void)
- void changeConnection (void)

#### Signals

- void sqlEditor (const QString &str)
- void chartAdded (toLineChart *chart)
- void chartSetup (toLineChart *chart)
- void chartRemoved (toLineChart *chart)
- void addedConnection (const QString &str)
- void removedConnection (const QString &str)
- void addedToolWidget (toToolWidget *tool)
- void removedToolWidget (toToolWidget *tool)
- void willCommit (toConnection &conn,bool cmt)

#### Public Static Methods

- static void setEditWidget (toEditWidget *edit)
- static void editEnable (toEditWidget *edit)
- static void editDisable (toEditWidget *edit)

#### Public Members

- static const int TO_FILE_MENU
- static const int TO_EDIT_MENU
- static const int TO_TOOLS_MENU
- static const int TO_WINDOWS_MENU
- static const int TO_HELP_MENU
- static const int TO_TOOL_MENU_ID
- static const int TO_TOOL_MENU_ID_END
- static const int TO_LAST_FILE_ID
- static const int TO_LAST_FILE_ID_END
- static const int TO_TOOL_ABOUT_ID
- static const int TO_TOOL_ABOUT_ID_END

## Detailed Description

This class defines the main window. Observe that this class will have different baseclass depending on if TOra is a Qt or KDE application. In the case of Qt this will be a QMainWindow descendant.

static const int TO_FILE_MENU

### TO_FILE_MENU

static const int TO_EDIT_MENU

### TO_EDIT_MENU

static const int TO_TOOLS_MENU

### TO_TOOLS_MENU

static const int TO_WINDOWS_MENU

### TO_WINDOWS_MENU

static const int TO_HELP_MENU

### TO_HELP_MENU

static const int TO_TOOL_MENU_ID

### TO_TOOL_MENU_ID

static const int TO_TOOL_MENU_ID_END

### TO_TOOL_MENU_ID_END

static const int TO_LAST_FILE_ID

### TO_LAST_FILE_ID

static const int TO_LAST_FILE_ID_END

### TO_LAST_FILE_ID_END

static const int TO_TOOL_ABOUT_ID

### TO_TOOL_ABOUT_ID

static const int TO_TOOL_ABOUT_ID_END

### TO_TOOL_ABOUT_ID_END

toMain ()

### toMain

Create main window. Always NULL as parent.

QWorkspace * workspace ()

### workspace

Get the workspace widget of the main window.

Returns: Workspace widget.

toConnection & currentConnection (void)

### currentConnection

Get the current database connection

Returns: Reference to current connection.

void setEditWidget (toEditWidget *edit)

### setEditWidget

[static]

Set the widget to edit through menues and toolbar.

void editEnable (toEditWidget *edit)

### editEnable

[static]

Set available menu items in user interface. It is not enough to just call this function to make open for instance to actually work. It is a lot of more especially in commandCallback and editFileMenu. Will only update if this is the current editing widget.

void editDisable (toEditWidget *edit)

### editDisable

[static]

Disable all the current available items in the user interface (That editEnable can enable). If specified widget has the focus the edit widget is cleared.

toEditWidget * editWidget ()

### editWidget

Get current edit widget

bool close (bool del)

### close

[virtual]

Close window

Parameters:

del | If user interaction is allowed.

Returns: True if close was allowed, otherwise false.

void createDefault (void)

### createDefault

Create the default tool for the current connection.

This is the tool with the highest priority, usually the SQL worksheet.

void setCoordinates (int,int)

### setCoordinates

Set coordinates in the statusbar.

Used to indicate current cursor position by child widgets.

QPopupMenu * fileMenu ()

### fileMenu

Get the file menu.

Returns: File menu

QPopupMenu * editMenu ()

### editMenu

Get the edit menu.

Returns: Edit menu

QPopupMenu * toolsMenu ()

### toolsMenu

Get the tools menu.

Returns: Tools menu

QPopupMenu * helpMenu ()

### helpMenu

Get the help menu.

Returns: Help menu

void updateKeepAlive ()

### updateKeepAlive

std::list<QString> connections (void)

### connections

Get a list of currently open connections.

Returns: List of connection names. The returned list can then be used by connection to get the actual connection.

toConnection & connection (const QString &)

### connection

Get a connection identified by a string.

Returns: A reference to a connection.

Throws: QString, If, connection, wasn't, found.

void setNeedCommit (toConnection &conn,bool needCommit=true)

### setNeedCommit

Set if a connection needs to be commited. Also updates visual feedback in interface.

void editSQL (const QString &str)

### editSQL

Edit an SQL statement in the SQL editor if any connected.

Parameters:

str | Identifier of the SQL to edit.

void registerSQLEditor (int toolid)

### registerSQLEditor

Register a tool which to use as an SQL editor. When something is to be edited first a toolwindow will be created and the sqlEditor will be emited, so the SQL editor must connect to this signal as well.

Parameters:

toolid | Which tool identifier to register as the SQL editor. This is the value which is passed to the toTool::customSetup member.

void toolWidgetAdded (toToolWidget *tool)

### toolWidgetAdded

Called by toTool when a new tool is created.

Parameters:

tool | The tool widget created.

void toolWidgetRemoved (toToolWidget *tool)

### toolWidgetRemoved

Called by toToolWidget when a new tool is about to be destroyed.

Parameters:

tool | The tool widget created.

void exportData (std::map<QCString,QString> &data,const QCString &prefix)

### exportData

[virtual]

Export data to a map.

Parameters:

data | A map that can be used to recreate the session.
prefix | Prefix to add to the map.

void importData (std::map<QCString,QString> &data,const QCString &prefix)

### importData

[virtual]

Import data

Parameters:

data | Data to read from a map.
prefix | Prefix to read data from.

QToolBar * editToolbar ()

### editToolbar

Get edit toolbar pointer.

QToolBar * connectionToolbar ()

### connectionToolbar

Get connection toolbar pointer.

void addChart (toLineChart *chart)

### addChart

Added chart.

void removeChart (toLineChart *chart)

### removeChart

Removed chart.

void setupChart (toLineChart *chart)

### setupChart

Setup chart.

void displayMessage (const QString &str)

### displayMessage

Display status message in dialog.

void addRecentFile (const QString &filename)

### addRecentFile

Add recent file

void sqlEditor (const QString &str)

### sqlEditor

[signal]

Invoked to start editing an SQL identifier.

Parameters:

str | Identifier to start editing.

void chartAdded (toLineChart *chart)

### chartAdded

[signal]

Invoked when a new chart is created.

void chartSetup (toLineChart *chart)

### chartSetup

[signal]

Invoked before a chart is destroyed.

void chartRemoved (toLineChart *chart)

### chartRemoved

[signal]

Invoked before a chart is destroyed.

void addedConnection (const QString &str)

### addedConnection

[signal]

Invoked when a connection is added.

Parameters:

str | Connection identifier.

void removedConnection (const QString &str)

### removedConnection

[signal]

Invoked when a connection is removed.

Parameters:

str | Connection identifier.

void addedToolWidget (toToolWidget *tool)

### addedToolWidget

[signal]

Invoked when a tool window is created.

Parameters:

tool | The tool created.

void removedToolWidget (toToolWidget *tool)

### removedToolWidget

[signal]

Invoked when a tool window is closed.

Parameters:

tool | Tool about to be removed.

void willCommit (toConnection &conn,bool cmt)

### willCommit

[signal]

Emitted before a commit or rollback is made to the current connection.

Parameters:

conn | Connection that is commited
cmt | True if commit, false if rollback.

void windowsMenu (void)

### windowsMenu

[slot]

Used to enable/disable entries in the windows menu

void statusMenu (void)

### statusMenu

[slot]

Used to fill the status menu with the latest status entries

void contextHelp (void)

### contextHelp

[slot]

Display context help.

void windowActivated (QWidget *)

### windowActivated

[slot]

Called when active window is changed.

void showFileMenu (void)

### showFileMenu

[slot]

Used to enable/disable entries in the file menu

void checkCaching (void)

### checkCaching

[slot]

Check if object caching is done.

void saveSession (void)

### saveSession

[slot]

Save the current TOra session

void loadSession (void)

### loadSession

[slot]

Load a session (Merge with current)

void closeSession (void)

### closeSession

[slot]

Close all windows and connections.

void changeConnection (void)

### changeConnection

[slot]

Change current connection

Generated by: nneul on skyhawk on Wed Feb 23 19:49:58 2005, using kdoc 2.0a54.