Skip to content

Commit

Permalink
Remove ampersand from menu and button text before compare (GoldenChee…
Browse files Browse the repository at this point in the history
…tah#3298)

To avoid issues with kde injecting them, it is not pretty
but simple and safe.
Fixes GoldenCheetah#1852
Fixes GoldenCheetah#2930
  • Loading branch information
amtriathlon authored and flo committed Jan 26, 2020
1 parent fa4e329 commit 48aaa37
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/Charts/HomeWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,11 @@ HomeWindow::rightClick(const QPoint & /*pos*/)
void
HomeWindow::addChartFromMenu(QAction*action)
{
// & removed to avoid issues with kde AutoCheckAccelerators
QString actionText = QString(action->text()).replace("&", "");
GcWinID id = GcWindowTypes::None;
for (int i=0; GcWindows[i].relevance; i++) {
if (GcWindows[i].name == action->text()) {
if (GcWindows[i].name == actionText) {
id = GcWindows[i].id;
break;
}
Expand Down
8 changes: 6 additions & 2 deletions src/Gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,9 +820,11 @@ MainWindow::setChartMenu(QMenu *menu)
void
MainWindow::addChart(QAction*action)
{
// & removed to avoid issues with kde AutoCheckAccelerators
QString actionText = QString(action->text()).replace("&", "");
GcWinID id = GcWindowTypes::None;
for (int i=0; GcWindows[i].relevance; i++) {
if (GcWindows[i].name == action->text()) {
if (GcWindows[i].name == actionText) {
id = GcWindows[i].id;
break;
}
Expand Down Expand Up @@ -2099,8 +2101,10 @@ MainWindow::uploadCloud(QAction *action)
{
// upload current ride, if we have one
if (currentTab->context->ride) {
// & removed to avoid issues with kde AutoCheckAccelerators
QString actionText = QString(action->text()).replace("&", "");

if (action->text() == "University of Kent") {
if (actionText == "University of Kent") {
#if QT_VERSION > 0x50000
CloudService *db = CloudServiceFactory::instance().newService(action->data().toString(), currentTab->context);
KentUniversityUploadDialog uploader(this, db, currentTab->context->ride);
Expand Down
3 changes: 2 additions & 1 deletion src/Gui/RideImportWizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,8 @@ RideImportWizard::abortClicked()
// NOTE: abort button morphs into save and finish button later - so all 3 variants are processed here

// if done when labelled abort we kill off this dialog
QString label = abortButton->text();
// & removed to avoid issues with kde AutoCheckAccelerators
QString label = QString(abortButton->text()).replace("&", "");

// Process "ABORT"
if (label == tr("Abort")) {
Expand Down

0 comments on commit 48aaa37

Please sign in to comment.