# 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)
- virtual bool close (bool del)
- void createDefault (void)
- void setCoordinates (int,int)
- QPopupMenu * fileMenu ()
- QPopupMenu * editMenu ()
- QPopupMenu * toolsMenu ()
- QPopupMenu * helpMenu ()
- 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 displayMessage (const QString &str)

#### Public Slots

- void windowsMenu (void)
- void statusMenu (void)
- void contextHelp (void)
- void windowActivated (QWidget *)
- void editFileMenu (void)
- void checkCaching (void)
- void changeConnection (void)

#### Signals

- void sqlEditor (const QString &str)
- void addedConnection (const QString &str)
- void removedConnection (const QString &str)
- 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_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_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.

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

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 displayMessage (const QString &str)

### displayMessage

Display status message in dialog.

void sqlEditor (const QString &str)

### sqlEditor

[signal]

Invoked to start editing an SQL identifier.

Parameters:

str | Identifier to start editing.

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 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 editFileMenu (void)

### editFileMenu

[slot]

Used to enable/disable entries in the edit & file menu

void checkCaching (void)

### checkCaching

[slot]

Check if object caching is done.

void changeConnection (void)

### changeConnection

[slot]

Change current connection