void MainWindow::createWindowMenu()
{
    qDebug("MainWindow createWindowMenu()");
    menuBar()->addMenu(windowMenu);
    connect(windowMenu, SIGNAL(aboutToShow()), this, SLOT(windowMenuAboutToShow()));
    //Do not allow the Window Menu to be torn off. It's a pain in the ass to maintain.
    windowMenu->setTearOffEnabled(false);

}
CMDIWindow::CMDIWindow(QWidget* parent)
: CMyWindow(parent, 0, true, WType_TopLevel)
{
#ifdef DEBUG
  qDebug("CMDIWindow::CMDIWindow()");
#endif
  
  setName("MainWindow");
  setMinimumSize(320, 240);
  
  setCaption(QString(APPLICATION) + " " + QString(VERSION) + QString(BRANCH));
  setIcon(getPixmapIcon("applicationIcon"));
  
  setCentralWidget( new QWidget( this, "qt_central_widget" ) );
  CMDIWindowLayout = new QGridLayout( centralWidget(), 1, 1, 2, 2, "CMDIWindowLayout"); 
   
  myApp()->createWorkspace(centralWidget());
  myApp()->workSpace()->setScrollBarsEnabled(true);
  
  CMDIWindowLayout->addWidget(myApp()->workSpace(), 0, 0);
  
  consoleMenu = new QPopupMenu(this, "ConsoleMenu");
  
  QAction * consoleExitAction = new QAction (tr("Exit"), getPixmapIcon("exitIcon"),
    tr("E&xit"), 0, this, "consoleExitAction");  //Exit should not be CAction 
  consoleExitAction->addTo(consoleMenu);
  connect(consoleExitAction, SIGNAL(activated()), this, SLOT(close()));
  
  menuBar()->insertItem(tr("&Console"), consoleMenu);  
   
  new COptionsMenu(this, menuBar(), "OptionsMenu");
#ifndef NO_MYSQLCC_PLUGINS
  new CPluginsMenu(this, menuBar(), "PluginsMenu");
#endif
  new CHotKeyEditorMenu(this, menuBar(), "HotKeyEditor");

  windowMenu = new QPopupMenu(this, "WindowMenu");
  windowMenu->setCheckable(true);
  menuBar()->insertItem(tr("&Window"), windowMenu);
  new CHelpMenu(this, menuBar(), "HelpMenu");

  if (!loadWindowSettings())
    setGeometry((int)(myApp()->desktop()->width() - (myApp()->desktop()->width() - (myApp()->desktop()->width() / 2)) * 1.5) / 2,
    (int)(myApp()->desktop()->height() - (myApp()->desktop()->height() -  (myApp()->desktop()->height() / 2)) * 1.5) / 2,
    (int)((myApp()->desktop()->width() - (myApp()->desktop()->width() / 2)) * 1.5),
    (int)((myApp()->desktop()->height() - (myApp()->desktop()->height() / 2)) * 1.5));
  
  consoleWindow = 0;
  connect(windowMenu, SIGNAL(aboutToShow()), this, SLOT(windowMenuAboutToShow()));
}