| 1 | /* This file is part of the KDE libraries |
| 2 | SPDX-FileCopyrightText: 2008 Chusslove Illich <caslav.ilic@gmx.net> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 | */ |
| 6 | |
| 7 | #ifndef COMMON_HELPERS_P_H |
| 8 | #define COMMON_HELPERS_P_H |
| 9 | |
| 10 | #include <QString> |
| 11 | |
| 12 | // Standalone (pure Qt) functionality needed internally in more than |
| 13 | // one source file on localization. |
| 14 | |
| 15 | /*! |
| 16 | * \internal |
| 17 | * |
| 18 | * Removes accelerator marker from a UI text label. |
| 19 | * |
| 20 | * Accelerator marker is not always a plain ampersand (&), |
| 21 | * so it is not enough to just remove it by QString::remove(). |
| 22 | * The label may contain escaped markers ("&&") which must be resolved |
| 23 | * and skipped, as well as CJK-style markers ("Foo (&F)") where |
| 24 | * the whole parenthesis construct should be removed. |
| 25 | * Therefore always use this function to remove accelerator marker |
| 26 | * from UI labels. |
| 27 | * |
| 28 | * \a label UI label which may contain an accelerator marker |
| 29 | * Returns label without the accelerator marker |
| 30 | */ |
| 31 | QString removeAcceleratorMarker(const QString &label); |
| 32 | |
| 33 | #endif |
| 34 | |