Skip to content
This repository was archived by the owner on Sep 24, 2023. It is now read-only.

Commit 66c8468

Browse files
OS X: Prevent multiple "Check for updates" menu entries
We have three main windows all readding the same actions to the menus. Check for updates is supposed to be in the app menu on OS X (ApplicationSpecificRole). Unfortunately, setting that flag causes up to three entries in the app menu. Thus move it to the File menu for the time being. Fixes #222 Change-Id: I4258565eb6d9f1b13800c2ce8b2bde948430b8d1 Reviewed-on: https://codereview.kdab.com/25793 Tested-by: Continuous Integration <[email protected]> Reviewed-by: Boyer de la Giroday Michel <[email protected]> Reviewed-by: Frank Osterfeld <[email protected]>
1 parent 55e3b56 commit 66c8468

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

Charm/ApplicationCore.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,12 @@ ApplicationCore::ApplicationCore( QObject* parent )
217217
connect( &m_actionExportTasks, SIGNAL(triggered()),
218218
&mainView(), SLOT(slotExportTasks()) );
219219
m_actionCheckForUpdates.setText( tr("Check for Updates...") );
220+
#if 0
221+
// TODO this role should be set to have the action in the app menu, but that
222+
// leads to duplicated entries, as each of the three main windows adds the action to the menu
223+
// and Qt doesn't prevent duplicates (#222)
220224
m_actionCheckForUpdates.setMenuRole( QAction::ApplicationSpecificRole );
225+
#endif
221226
connect( &m_actionCheckForUpdates, SIGNAL(triggered()),
222227
&mainView(), SLOT(slotCheckForUpdatesManual()) );
223228
m_actionEnterVacation.setText( tr( "Enter Vacation...") );
@@ -326,9 +331,16 @@ void ApplicationCore::createFileMenu( QMenuBar *menuBar )
326331
menu->addAction( &m_actionSyncTasks );
327332
menu->addAction( &m_actionImportTasks );
328333
menu->addAction( &m_actionExportTasks );
329-
#ifndef Q_OS_OSX
330-
menu->addSeparator();
334+
335+
#ifdef Q_OS_OSX
336+
if ( !QString::fromLatin1(UPDATE_CHECK_URL).isEmpty() ) {
337+
menu->addSeparator();
338+
menu->addAction( &m_actionCheckForUpdates );
339+
}
340+
#else
341+
menu->addSeparator(); // Separator before quit
331342
#endif
343+
332344
menu->addAction( &m_actionQuit );
333345
menuBar->addMenu( menu );
334346
}
@@ -338,7 +350,7 @@ void ApplicationCore::createHelpMenu( QMenuBar *menuBar )
338350
auto menu = new QMenu( menuBar );
339351
menu->setTitle( tr( "Help" ) );
340352
menu->addAction( &m_actionAboutDialog );
341-
#if defined(Q_OS_OSX) || defined(Q_OS_WIN)
353+
#ifdef Q_OS_WIN
342354
if ( !QString::fromLatin1(UPDATE_CHECK_URL).isEmpty() ) {
343355
menu->addAction( &m_actionCheckForUpdates );
344356
}

0 commit comments

Comments
 (0)