summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-02-05 15:27:19 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-02-05 16:32:49 (GMT)
commitcf14db1f16fffd7755d6200aaa6769a57a9da99d (patch)
tree76044d4b1eb8ccbcca8545f0c383363903c361ed /tools
parent662f94d478063f05155e3d2345aa6617f602ef38 (diff)
downloadQt-cf14db1f16fffd7755d6200aaa6769a57a9da99d.zip
Qt-cf14db1f16fffd7755d6200aaa6769a57a9da99d.tar.gz
Qt-cf14db1f16fffd7755d6200aaa6769a57a9da99d.tar.bz2
don't use QKeySequence::mnemonic() after all
it wastes cpu cycles, and it started flooding the console with irrelevant messages.
Diffstat (limited to 'tools')
-rw-r--r--tools/linguist/linguist/mainwindow.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp
index 008ebb1..6e5c656 100644
--- a/tools/linguist/linguist/mainwindow.cpp
+++ b/tools/linguist/linguist/mainwindow.cpp
@@ -94,6 +94,8 @@
#include <QUrl>
#include <QWhatsThis>
+#include <ctype.h>
+
QT_BEGIN_NAMESPACE
static const int MessageMS = 2500;
@@ -2356,13 +2358,28 @@ void MainWindow::updatePhraseDicts()
static bool haveMnemonic(const QString &str)
{
- QString mnemonic = QKeySequence::mnemonic(str);
- if (mnemonic == QLatin1String("Alt+Space")) {
- // "Nobody" ever really uses these, and they are highly annoying
- // because we get a lot of false positives.
- return false;
+ for (const ushort *p = (ushort *)str.constData();; ) { // Assume null-termination
+ ushort c = *p++;
+ if (!c)
+ break;
+ if (c == '&') {
+ c = *p++;
+ if (!c)
+ return false;
+ // "Nobody" ever really uses these alt-space, and they are highly annoying
+ // because we get a lot of false positives.
+ if (c != '&' && c != ' ' && QChar(c).isPrint()) {
+ const ushort *pp = p;
+ for (; ::isalpha(*p); p++) ;
+ if (pp == p || *p != ';')
+ return true;
+ // This looks like a HTML &entity;, so ignore it. As a HTML string
+ // won't contain accels anyway, we can stop scanning here.
+ break;
+ }
+ }
}
- return !mnemonic.isEmpty();
+ return false;
}
void MainWindow::updateDanger(const MultiDataIndex &index, bool verbose)