[QGIS Commit] r9223 - in trunk/qgis/src: app app/composer ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Aug 31 03:39:37 EDT 2008


Author: telwertowski
Date: 2008-08-31 03:39:36 -0400 (Sun, 31 Aug 2008)
New Revision: 9223

Modified:
   trunk/qgis/src/app/composer/qgscomposer.cpp
   trunk/qgis/src/app/composer/qgscomposer.h
   trunk/qgis/src/app/qgisapp.cpp
   trunk/qgis/src/app/qgisapp.h
   trunk/qgis/src/app/qgsattributetabledisplay.cpp
   trunk/qgis/src/app/qgsattributetabledisplay.h
   trunk/qgis/src/ui/qgsattributetablebase.ui
   trunk/qgis/src/ui/qgscomposerbase.ui
Log:
Add Mac menubars for PrintComposer and AttributeTable windows.


Modified: trunk/qgis/src/app/composer/qgscomposer.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposer.cpp	2008-08-30 23:51:32 UTC (rev 9222)
+++ trunk/qgis/src/app/composer/qgscomposer.cpp	2008-08-31 07:39:36 UTC (rev 9223)
@@ -38,10 +38,12 @@
 #include "qgscontexthelp.h"
 #include "qgscursors.h"
 
+#include <QCloseEvent>
 #include <QDesktopWidget>
 #include <QFileDialog>
 #include <QFileInfo>
 #include <QMatrix>
+#include <QMenuBar>
 #include <QMessageBox>
 #include <QPainter>
 
@@ -68,18 +70,40 @@
 
   QString myIconPath = QgsApplication::activeThemePath();
 
-  QAction* moveItemContentAction = new QAction( QIcon( QPixmap( myIconPath + "mActionMoveItemContent.png" ) ), tr( "Move Item content" ), 0 );
+  // Actions defined in qgscomposerbase.ui:
+  // mActionAddNewMap
+  // mActionAddNewLegend
+  // mActionAddNewLabel
+  // mActionAddNewScalebar
+  // mActionAddImage
+  // mActionSelectMoveItem
+
+  QAction* moveItemContentAction = new QAction( QIcon( QPixmap( myIconPath + "mActionMoveItemContent.png" ) ),
+                                                tr( "Move Content" ), 0 );
+  moveItemContentAction->setToolTip( tr( "Move item content" ) );
   moveItemContentAction->setCheckable( true );
   connect( moveItemContentAction, SIGNAL( triggered() ), this, SLOT( moveItemContent() ) );
   toolBar->addAction( moveItemContentAction );
   //toolBar->addAction(QIcon(QPixmap(myIconPath+"mActionMoveItemContent.png")), tr("Move Item content"), this, SLOT(moveItemContent()));
 
-  toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionGroupItems.png" ) ), tr( "&Group Items" ), this, SLOT( groupItems() ) );
-  toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionUngroupItems.png" ) ), tr( "&Ungroup Items" ), this, SLOT( ungroupItems() ) );
-  toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionRaiseItems.png" ) ), tr( "Raise selected items" ), this, SLOT( raiseSelectedItems() ) );
-  toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionLowerItems.png" ) ), tr( "Lower selected items" ), this, SLOT( lowerSelectedItems() ) );
-  toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionMoveItemsToTop.png" ) ), tr( "Move selected items to top" ), this, SLOT( moveSelectedItemsToTop() ) );
-  toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionMoveItemsToBottom.png" ) ), tr( "Move selected items to bottom" ), this, SLOT( moveSelectedItemsToBottom() ) );
+  QAction* groupItemsAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionGroupItems.png" ) ),
+                                                  tr( "&Group" ), this, SLOT( groupItems() ) );
+  groupItemsAction->setToolTip( tr( "Group items" ) );
+  QAction* ungroupItemsAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionUngroupItems.png" ) ),
+                                                    tr( "&Ungroup" ), this, SLOT( ungroupItems() ) );
+  ungroupItemsAction->setToolTip( tr( "Ungroup items" ) );
+  QAction* raiseItemsAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionRaiseItems.png" ) ),
+                                                  tr( "Raise" ), this, SLOT( raiseSelectedItems() ) );
+  raiseItemsAction->setToolTip( tr( "Raise selected items" ) );
+  QAction* lowerItemsAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionLowerItems.png" ) ),
+                                                  tr( "Lower" ), this, SLOT( lowerSelectedItems() ) );
+  lowerItemsAction->setToolTip( tr( "Lower selected items" ) );
+  QAction* moveItemsToTopAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionMoveItemsToTop.png" ) ),
+                                                      tr( "Bring to Front" ), this, SLOT( moveSelectedItemsToTop() ) );
+  moveItemsToTopAction->setToolTip( tr( "Move selected items to top" ) );
+  QAction* moveItemsToBottomAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionMoveItemsToBottom.png" ) ),
+                                                         tr( "Send to Back" ), this, SLOT( moveSelectedItemsToBottom() ) );
+  moveItemsToBottomAction->setToolTip( tr( "Move selected items to bottom" ) );
 
   QActionGroup* toggleActionGroup = new QActionGroup( this );
   toggleActionGroup->addAction( moveItemContentAction );
@@ -105,6 +129,68 @@
   mActionAddNewScalebar->setCheckable( true );
   mActionAddImage->setCheckable( true );
 
+#ifdef Q_WS_MAC
+  QMenu *appMenu = menuBar()->addMenu( tr( "QGIS" ) );
+  appMenu->addAction( QgisApp::instance()->actionAbout() );
+  appMenu->addAction( QgisApp::instance()->actionOptions() );
+
+  QMenu *fileMenu = menuBar()->addMenu( tr( "File" ) );
+  fileMenu->addAction( mActionOpenTemplate );
+  fileMenu->addSeparator();
+  QAction *closeAction = fileMenu->addAction( tr( "Close" ), this, SLOT( close() ), tr( "Ctrl+W" ) );
+  fileMenu->addAction( mActionSaveTemplateAs );
+  fileMenu->addAction( mActionExportAsImage );
+  fileMenu->addAction( mActionExportAsSVG );
+  fileMenu->addSeparator();
+  fileMenu->addAction( mActionPrint );
+
+  QMenu *editMenu = menuBar()->addMenu( tr( "Edit" ) );
+  QAction *undoAction = editMenu->addAction( tr( "&Undo" ), this, SLOT( undo() ), tr( "Ctrl+Z" ) );
+  undoAction->setEnabled( false );
+  editMenu->addSeparator();
+  QAction *cutAction = editMenu->addAction( tr( "Cu&t" ), this, SLOT( cut() ), tr( "Ctrl+X" ) );
+  cutAction->setEnabled( false );
+  QAction *copyAction = editMenu->addAction( tr( "&Copy" ), this, SLOT( copy() ), tr( "Ctrl+C" ) );
+  copyAction->setEnabled( false );
+  QAction *pasteAction = editMenu->addAction( tr( "&Paste" ), this, SLOT( paste() ), tr( "Ctrl+V" ) );
+  pasteAction->setEnabled( false );
+  QAction *deleteAction = editMenu->addAction( tr( "Delete" ) );
+  deleteAction->setEnabled( false );
+
+  QMenu *viewMenu = menuBar()->addMenu( tr( "View" ) );
+  viewMenu->addAction( mActionZoomIn );
+  viewMenu->addAction( mActionZoomOut );
+  viewMenu->addAction( mActionZoomAll );
+  viewMenu->addSeparator();
+  viewMenu->addAction( mActionRefreshView );
+
+  QMenu *layoutMenu = menuBar()->addMenu( tr( "Layout" ) );
+  layoutMenu->addAction( mActionAddNewMap );
+  layoutMenu->addAction( mActionAddNewLabel );
+  layoutMenu->addAction( mActionAddNewScalebar );
+  layoutMenu->addAction( mActionAddNewLegend );
+  layoutMenu->addAction( mActionAddImage );
+  layoutMenu->addAction( mActionSelectMoveItem );
+  layoutMenu->addAction( moveItemContentAction );
+  layoutMenu->addSeparator();
+  layoutMenu->addAction( groupItemsAction );
+  layoutMenu->addAction( ungroupItemsAction );
+  layoutMenu->addAction( raiseItemsAction );
+  layoutMenu->addAction( lowerItemsAction );
+  layoutMenu->addAction( moveItemsToTopAction );
+  layoutMenu->addAction( moveItemsToBottomAction );
+  
+#ifndef Q_WS_MAC64 /* assertion failure in NSMenuItem setSubmenu (Qt 4.5.0-snapshot-20080830) */
+  menuBar()->addMenu( QgisApp::instance()->windowMenu() );
+
+  menuBar()->addMenu( QgisApp::instance()->helpMenu() );
+#endif
+
+  // Create action to select this window and add it to Window menu
+  mWindowAction = new QAction( windowTitle(), this );
+  connect( mWindowAction, SIGNAL( triggered() ), this, SLOT( activate() ) );
+#endif
+
   mQgis = qgis;
   mFirstTime = true;
 
@@ -208,10 +294,55 @@
   {
     show(); //make sure the window is displayed - with a saved project, it's possible to not have already called show()
     //is that a bug?
-    raise(); //bring the composer window to the front
+    activate(); //bring the composer window to the front
   }
 }
 
+void QgsComposer::activate()
+{
+  raise();
+  setWindowState( windowState() & ~Qt::WindowMinimized );
+  activateWindow();
+}
+
+#ifdef Q_WS_MAC
+void QgsComposer::changeEvent( QEvent* event )
+{
+  QMainWindow::changeEvent( event );
+  switch ( event->type() )
+  {
+  case QEvent::ActivationChange:
+    if ( QApplication::activeWindow() == this )
+    {
+      mWindowAction->setChecked( true );
+    }
+    break;
+
+  default:
+    break;
+  }
+}
+
+void QgsComposer::closeEvent( QCloseEvent *event )
+{
+  QMainWindow::closeEvent( event );
+  if ( event->isAccepted() )
+  {
+    QgisApp::instance()->removeWindow( mWindowAction );
+  }
+}
+
+void QgsComposer::showEvent( QShowEvent *event )
+{
+  QMainWindow::showEvent( event );
+  // add to menu if (re)opening window (event not due to unminimize)
+  if ( !event->spontaneous() )
+  {
+    QgisApp::instance()->addWindow( mWindowAction );
+  }
+}
+#endif
+
 void QgsComposer::showCompositionOptions( QWidget *w )
 {
   QWidget* currentWidget = mItemStackedWidget->currentWidget();

Modified: trunk/qgis/src/app/composer/qgscomposer.h
===================================================================
--- trunk/qgis/src/app/composer/qgscomposer.h	2008-08-30 23:51:32 UTC (rev 9222)
+++ trunk/qgis/src/app/composer/qgscomposer.h	2008-08-31 07:39:36 UTC (rev 9223)
@@ -92,12 +92,24 @@
     //! Restore the window and toolbar state
     void restoreWindowState();
 
+  protected:
     //! Move event
-    void moveEvent( QMoveEvent * );
+    virtual void moveEvent( QMoveEvent * );
 
     //! Resize event
-    void resizeEvent( QResizeEvent * );
+    virtual void resizeEvent( QResizeEvent * );
 
+#ifdef Q_WS_MAC
+    //! Change event (update window menu on ActivationChange)
+    virtual void changeEvent( QEvent * );
+
+    //! Close event (remove window from menu)
+    virtual void closeEvent( QCloseEvent * );
+
+    //! Show event (add window to menu)
+    virtual void showEvent( QShowEvent * );
+#endif
+
   public slots:
     //! Zoom to full extent of the paper
     void on_mActionZoomAll_activated( void );
@@ -205,11 +217,15 @@
 
     void setSelectionTool();
 
+  private slots:
 
+    //! Raise, unminimize and activate this window
+    void activate();
+
   private:
-    //! Set teh pixmap / icons on the toolbar buttons
+    //! Set the pixmap / icons on the toolbar buttons
     void setupTheme();
-    /**Etablishes the signal slot connection for the class*/
+    /**Establishes the signal slot connection for the class*/
     void connectSlots();
 
     //! Set buttons up
@@ -245,6 +261,11 @@
     //! To know which item to show if selection changes
     QMap<QgsComposerItem*, QWidget*> mItemWidgetMap;
 
+#ifdef Q_WS_MAC
+    //! Window menu action to select this window
+    QAction *mWindowAction;
+#endif
+
     //! Help context id
     static const int context_id = 985715179;
 

Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2008-08-30 23:51:32 UTC (rev 9222)
+++ trunk/qgis/src/app/qgisapp.cpp	2008-08-31 07:39:36 UTC (rev 9223)
@@ -368,7 +368,6 @@
 #ifdef Q_WS_MAC
   // action for Window menu (create before generating WindowTitleChange event))
   mWindowAction = new QAction( this );
-  mWindowAction->setCheckable( true );
   connect( mWindowAction, SIGNAL( triggered() ), this, SLOT( activate() ) );
 
   // add this window to Window menu
@@ -571,6 +570,7 @@
   mActionExit = new QAction( getThemeIcon( "mActionFileExit.png" ), tr( "Exit" ), this );
   mActionExit->setShortcut( tr( "Ctrl+Q", "Exit QGIS" ) );
   mActionExit->setStatusTip( tr( "Exit QGIS" ) );
+  mActionExit->setMenuRole( QAction::QuitRole ); // put in Application menu on Mac OS X
   connect( mActionExit, SIGNAL( triggered() ), this, SLOT( fileExit() ) );
 
   // Edit Menu Items
@@ -870,14 +870,13 @@
   mActionOptions = new QAction( getThemeIcon( "mActionOptions.png" ), tr( "Options..." ), this );
   // mActionOptions->setShortcut(tr("Alt+O","Change various QGIS options"));
   mActionOptions->setStatusTip( tr( "Change various QGIS options" ) );
-  mActionOptions->setMenuRole( QAction::PreferencesRole );
+  mActionOptions->setMenuRole( QAction::PreferencesRole ); // put in application menu on Mac OS X
   connect( mActionOptions, SIGNAL( triggered() ), this, SLOT( options() ) );
 
   mActionCustomProjection = new QAction( getThemeIcon( "mActionCustomProjection.png" ), tr( "Custom CRS..." ), this );
   // mActionCustomProjection->setShortcut(tr("Alt+I","Manage custom projections"));
   mActionCustomProjection->setStatusTip( tr( "Manage custom coordinate reference systems" ) );
-  // mActionCustomProjection->setMenuRole(QAction::ApplicationSpecificRole);
-  mActionCustomProjection->setMenuRole( QAction::PreferencesRole );
+  // mActionCustomProjection->setMenuRole( QAction::ApplicationSpecificRole ); // put in application menu on Mac OS X
   connect( mActionCustomProjection, SIGNAL( triggered() ), this, SLOT( customProjection() ) );
 
 #ifdef Q_WS_MAC
@@ -886,11 +885,11 @@
   mActionWindowMinimize = new QAction( tr( "Minimize" ), this );
   mActionWindowMinimize->setShortcut( tr( "Ctrl+M", "Minimize Window" ) );
   mActionWindowMinimize->setStatusTip( tr( "Minimizes the active window to the dock" ) );
-  connect( mActionWindowMinimize, SIGNAL( triggered() ), this, SLOT( showMinimized() ) );
+  connect( mActionWindowMinimize, SIGNAL( triggered() ), this, SLOT( showActiveWindowMinimized() ) );
 
   mActionWindowZoom = new QAction( tr( "Zoom" ), this );
   mActionWindowZoom->setStatusTip( tr( "Toggles between a predefined size and the window size set by the user" ) );
-  connect( mActionWindowZoom, SIGNAL( triggered() ), this, SLOT( toggleMaximized() ) );
+  connect( mActionWindowZoom, SIGNAL( triggered() ), this, SLOT( toggleActiveWindowMaximized() ) );
 
   mActionWindowAllToFront = new QAction( tr( "Bring All to Front" ), this );
   mActionWindowAllToFront->setStatusTip( tr( "Bring forward all open windows" ) );
@@ -924,6 +923,7 @@
 
   mActionAbout = new QAction( getThemeIcon( "mActionHelpAbout.png" ), tr( "About" ), this );
   mActionAbout->setStatusTip( tr( "About QGIS" ) );
+  mActionAbout->setMenuRole( QAction::AboutRole ); // put in application menu on Mac OS X
   connect( mActionAbout, SIGNAL( triggered() ), this, SLOT( about() ) );
 }
 
@@ -3530,12 +3530,32 @@
   }
 }
 
-void QgisApp::toggleMaximized()
+void QgisApp::showActiveWindowMinimized()
 {
-  if ( isMaximized() ) showNormal();
-  else showMaximized();
+  QWidget *window = QApplication::activeWindow();
+  if ( window )
+  {
+    window->showMinimized();
+  }
 }
 
+void QgisApp::toggleActiveWindowMaximized()
+{
+  QWidget *window = QApplication::activeWindow();
+  if ( window )
+  {
+    if ( window->isMaximized() ) window->showNormal();
+    else window->showMaximized();
+  }
+}
+
+void QgisApp::activate()
+{
+  raise();
+  setWindowState( windowState() & ~Qt::WindowMinimized );
+  activateWindow();
+}
+
 void QgisApp::bringAllToFront()
 {
 #ifdef Q_WS_MAC
@@ -3549,10 +3569,17 @@
 #ifdef Q_WS_MAC
 void QgisApp::addWindow( QAction *action )
 {
+  mWindowActions->addAction( action );
   mWindowMenu->addAction( action );
-  mWindowActions->addAction( action );
+  action->setCheckable( true );
   action->setChecked( true );
 }
+
+void QgisApp::removeWindow( QAction *action )
+{
+  mWindowActions->removeAction( action );
+  mWindowMenu->removeAction( action );
+}
 #endif
 
 void QgisApp::stopRendering()
@@ -4657,13 +4684,31 @@
 
 void QgisApp::changeEvent( QEvent* event )
 {
+  QMainWindow::changeEvent( event );
 #ifdef Q_WS_MAC
-  if ( event->type() == QEvent::WindowTitleChange )
+  switch ( event->type() )
   {
+  case QEvent::ActivationChange:
+    if ( QApplication::activeWindow() == this )
+    {
+      mWindowAction->setChecked( true );
+    }
+    // this should not be necessary since the action is part of an action group
+    // however this check is not cleared if PrintComposer is closed and reopened
+    else
+    {
+      mWindowAction->setChecked( false );
+    }
+    break;
+
+  case QEvent::WindowTitleChange:
     mWindowAction->setText( windowTitle() );
+    break;
+
+  default:
+    break;
   }
 #endif
-  QWidget::changeEvent( event );
 }
 
 void QgisApp::closeEvent( QCloseEvent* event )

Modified: trunk/qgis/src/app/qgisapp.h
===================================================================
--- trunk/qgis/src/app/qgisapp.h	2008-08-30 23:51:32 UTC (rev 9222)
+++ trunk/qgis/src/app/qgisapp.h	2008-08-31 07:39:36 UTC (rev 9223)
@@ -143,10 +143,6 @@
     //! Returns a pointer to the internal clipboard
     QgsClipboard * clipboard();
 
-    void dragEnterEvent( QDragEnterEvent * );
-
-    void dropEvent( QDropEvent * );
-
     /** Setup the proxy settings from the QSettings environment.
       * This is not called by default in the constructor. Rather,
       * the application must explicitly call setupProx(). If
@@ -187,6 +183,8 @@
 #ifdef Q_WS_MAC
     //! Add window item to Window menu
     void addWindow( QAction *action );
+    //! Remove window item from Window menu
+    void removeWindow( QAction *action );
 #endif
 
     //! Actions to be inserted in menus and toolbars
@@ -337,6 +335,19 @@
      */
     void editPaste( QgsMapLayer * destinationLayer = 0 );
 
+  protected:
+
+    //! Handle state changes (WindowTitleChange)
+    virtual void changeEvent( QEvent * event );
+    //! Have some control over closing of the application
+    virtual void closeEvent( QCloseEvent * event );
+
+    virtual void dragEnterEvent( QDragEnterEvent * event );
+    virtual void dropEvent( QDropEvent * event );
+
+    //! reimplements widget keyPress event so we can check if cancel was pressed
+    virtual void keyPressEvent( QKeyEvent * event );
+
   private slots:
     //! About QGis
     void about();
@@ -346,8 +357,6 @@
     //! Add a databaselayer to the map
     void addDatabaseLayer();
     //#endif
-    //! reimplements widget keyPress event so we can check if cancel was pressed
-    void keyPressEvent( QKeyEvent * e );
     /** toggles whether the current selected layer is in overview or not */
     void inOverview();
     //! Slot to show the map coordinate position of the mouse cursor
@@ -543,9 +552,15 @@
     //! Toggle full screen mode
     void toggleFullScreen();
 
-    //! Toggle maximized mode
-    void toggleMaximized();
+    //! Set minimized mode of active window
+    void showActiveWindowMinimized();
 
+    //! Toggle maximized mode of active window
+    void toggleActiveWindowMaximized();
+
+    //! Raise, unminimize and activate this window
+    void activate();
+
     //! Bring forward all open windows
     void bringAllToFront();
 
@@ -600,10 +615,6 @@
     void pasteTransformations();
     //! check to see if file is dirty and if so, prompt the user th save it
     bool saveDirty();
-    //! Handle state changes
-    virtual void changeEvent( QEvent* event );
-    //! Have some control over closing of the application
-    virtual void closeEvent( QCloseEvent* event );
 
     /// QgisApp aren't copyable
     QgisApp( QgisApp const & );

Modified: trunk/qgis/src/app/qgsattributetabledisplay.cpp
===================================================================
--- trunk/qgis/src/app/qgsattributetabledisplay.cpp	2008-08-30 23:51:32 UTC (rev 9222)
+++ trunk/qgis/src/app/qgsattributetabledisplay.cpp	2008-08-31 07:39:36 UTC (rev 9223)
@@ -32,6 +32,7 @@
 #include "qgscontexthelp.h"
 
 #include <QCloseEvent>
+#include <QMenuBar>
 #include <QMessageBox>
 #include <QIcon>
 #include <QPixmap>
@@ -131,6 +132,51 @@
   setWindowTitle( tr( "Attribute table - " ) + layer->name() );
 
 #ifdef Q_WS_MAC
+  QMenuBar *menuBar = new QMenuBar( this );
+
+  QMenu *appMenu = menuBar->addMenu( tr( "QGIS" ) );
+  appMenu->addAction( QgisApp::instance()->actionAbout() );
+  appMenu->addAction( QgisApp::instance()->actionOptions() );
+
+  QMenu *fileMenu = menuBar->addMenu( tr( "File" ) );
+  QAction *closeAction = fileMenu->addAction( tr( "Close" ), this, SLOT( close() ), tr( "Ctrl+W" ) );
+
+  QMenu *editMenu = menuBar->addMenu( tr( "Edit" ) );
+  QAction *undoAction = editMenu->addAction( tr( "&Undo" ), this, SLOT( undo() ), tr( "Ctrl+Z" ) );
+  undoAction->setEnabled( false );
+  editMenu->addSeparator();
+  QAction *cutAction = editMenu->addAction( tr( "Cu&t" ), this, SLOT( cut() ), tr( "Ctrl+X" ) );
+  cutAction->setEnabled( false );
+  QAction *copyAction = editMenu->addAction(
+    mCopySelectedRowsButton->icon(), tr( "&Copy" ), this, SLOT( copySelectedRowsToClipboard() ), tr( "Ctrl+C" ) );
+  QAction *pasteAction = editMenu->addAction( tr( "&Paste" ), this, SLOT( paste() ), tr( "Ctrl+V" ) );
+  pasteAction->setEnabled( false );
+  QAction *deleteAction = editMenu->addAction(
+    mRemoveSelectionButton->icon(), tr( "Delete" ), this, SLOT( removeSelection() ) );
+
+  QMenu *layerMenu = menuBar->addMenu( tr( "Layer" ) );
+  QAction *zoomToSelectedAction = layerMenu->addAction(
+    mZoomMapToSelectedRowsButton->icon(), tr( "Zoom to Selection" ), this, SLOT( zoomMapToSelectedRows() ), tr( "Ctrl+J" ) );
+  layerMenu->addSeparator();
+  QAction *toggleEditingAction = layerMenu->addAction(
+    mToggleEditingButton->icon(), tr( "Toggle Editing" ), this, SLOT( toggleEditing() ) );
+  toggleEditingAction->setEnabled( mToggleEditingButton->isEnabled() );
+  toggleEditingAction->setCheckable( true );
+  toggleEditingAction->setChecked( mToggleEditingButton->isChecked() );
+  connect( mToggleEditingButton, SIGNAL( toggled( bool ) ), toggleEditingAction, SLOT( setChecked( bool ) ) );
+
+  QMenu *tableMenu = menuBar->addMenu( tr( "Table" ) );
+  QAction *moveToTopAction = tableMenu->addAction(
+    mSelectedToTopButton->icon(), tr( "Move to Top" ), this, SLOT( selectedToTop() ) );
+  QAction *invertAction = tableMenu->addAction(
+    mInvertSelectionButton->icon(), tr( "Invert" ), this, SLOT( invertSelection() ) );
+  
+#ifndef Q_WS_MAC64 /* assertion failure in NSMenuItem setSubmenu (Qt 4.5.0-snapshot-20080830) */
+  menuBar->addMenu( QgisApp::instance()->windowMenu() );
+
+  menuBar->addMenu( QgisApp::instance()->helpMenu() );
+#endif
+
   // Create action to select this window and add it to Window menu
   mWindowAction = new QAction( windowTitle(), this );
   connect( mWindowAction, SIGNAL( triggered() ), this, SLOT( activate() ) );
@@ -143,12 +189,32 @@
   smTables.remove( mLayer );
 }
 
+#ifdef Q_WS_MAC
+void QgsAttributeTableDisplay::changeEvent( QEvent* event )
+{
+  QDialog::changeEvent( event );
+  switch ( event->type() )
+  {
+  case QEvent::ActivationChange:
+    if ( QApplication::activeWindow() == this )
+    {
+      mWindowAction->setChecked( true );
+    }
+    break;
+
+  default:
+    break;
+  }
+}
+#endif
+
 void QgsAttributeTableDisplay::closeEvent( QCloseEvent *ev )
 {
+  QDialog::closeEvent( ev );
+
   if ( mDock == NULL )
     saveWindowLocation();
 
-  ev->ignore();
   deleteLater();
 }
 

Modified: trunk/qgis/src/app/qgsattributetabledisplay.h
===================================================================
--- trunk/qgis/src/app/qgsattributetabledisplay.h	2008-08-30 23:51:32 UTC (rev 9222)
+++ trunk/qgis/src/app/qgsattributetabledisplay.h	2008-08-31 07:39:36 UTC (rev 9223)
@@ -51,6 +51,11 @@
     void setAttributeActions( const QgsAttributeAction &actions );
     void selectRowsWithId( const QgsFeatureIds &ids );
 
+#ifdef Q_WS_MAC
+    //! Change event (update window menu on ActivationChange)
+    virtual void changeEvent( QEvent *event );
+#endif
+
     virtual void closeEvent( QCloseEvent *ev );
 
     /** array of feature IDs that match last searched condition */

Modified: trunk/qgis/src/ui/qgsattributetablebase.ui
===================================================================
--- trunk/qgis/src/ui/qgsattributetablebase.ui	2008-08-30 23:51:32 UTC (rev 9222)
+++ trunk/qgis/src/ui/qgsattributetablebase.ui	2008-08-31 07:39:36 UTC (rev 9223)
@@ -101,7 +101,7 @@
    <item row="0" column="4" >
     <widget class="QToolButton" name="mZoomMapToSelectedRowsButton" >
      <property name="toolTip" >
-      <string>Zoom map to the selected rows (Ctrl-F)</string>
+      <string>Zoom map to the selected rows (Ctrl-J)</string>
      </property>
      <property name="whatsThis" >
       <string>Zoom map to the selected rows</string>
@@ -110,7 +110,7 @@
       <string/>
      </property>
      <property name="shortcut" >
-      <string>Ctrl+F</string>
+      <string>Ctrl+J</string>
      </property>
     </widget>
    </item>

Modified: trunk/qgis/src/ui/qgscomposerbase.ui
===================================================================
--- trunk/qgis/src/ui/qgscomposerbase.ui	2008-08-30 23:51:32 UTC (rev 9222)
+++ trunk/qgis/src/ui/qgscomposerbase.ui	2008-08-31 07:39:36 UTC (rev 9223)
@@ -252,7 +252,7 @@
     <iconset>../themes/default/mActionFileOpen.png</iconset>
    </property>
    <property name="text" >
-    <string>&amp;Open Template ...</string>
+    <string>&amp;Open Template...</string>
    </property>
   </action>
   <action name="mActionSaveTemplateAs" >
@@ -276,7 +276,7 @@
     <iconset>../themes/default/mActionZoomFullExtent.png</iconset>
    </property>
    <property name="text" >
-    <string>Zoom All</string>
+    <string>Zoom Full</string>
    </property>
   </action>
   <action name="mActionZoomIn" >
@@ -300,6 +300,9 @@
     <iconset>../themes/default/mActionAddRasterLayer.png</iconset>
    </property>
    <property name="text" >
+    <string>Add Map</string>
+   </property>
+   <property name="toolTip" >
     <string>Add new map</string>
    </property>
   </action>
@@ -308,6 +311,9 @@
     <iconset>../themes/default/mActionLabel.png</iconset>
    </property>
    <property name="text" >
+    <string>Add Label</string>
+   </property>
+   <property name="toolTip" >
     <string>Add new label</string>
    </property>
   </action>
@@ -316,6 +322,9 @@
     <iconset>../themes/default/mActionAddLegend.png</iconset>
    </property>
    <property name="text" >
+    <string>Add Vector Legend</string>
+   </property>
+   <property name="toolTip" >
     <string>Add new vect legend</string>
    </property>
   </action>
@@ -324,6 +333,9 @@
     <iconset>../themes/default/mActionPan.png</iconset>
    </property>
    <property name="text" >
+    <string>Move Item</string>
+   </property>
+   <property name="toolTip" >
     <string>Select/Move item</string>
    </property>
   </action>
@@ -332,7 +344,7 @@
     <iconset>../themes/default/mActionExportMapServer.png</iconset>
    </property>
    <property name="text" >
-    <string>Export as image</string>
+    <string>Export as Image...</string>
    </property>
   </action>
   <action name="mActionExportAsSVG" >
@@ -340,7 +352,7 @@
     <iconset>../themes/default/mActionSaveAsSVG.png</iconset>
    </property>
    <property name="text" >
-    <string>Export as SVG</string>
+    <string>Export as SVG...</string>
    </property>
   </action>
   <action name="mActionAddNewScalebar" >
@@ -348,6 +360,9 @@
     <iconset>../../plugins/scale_bar/icon.xpm</iconset>
    </property>
    <property name="text" >
+    <string>Add Scalebar</string>
+   </property>
+   <property name="toolTip" >
     <string>Add new scalebar</string>
    </property>
   </action>
@@ -356,6 +371,9 @@
     <iconset>../themes/default/mActionDraw.png</iconset>
    </property>
    <property name="text" >
+    <string>Refresh</string>
+   </property>
+   <property name="toolTip" >
     <string>Refresh view</string>
    </property>
   </action>



More information about the QGIS-commit mailing list