Commit cf14db1f16fffd7755d6200aaa6769a57a9da99d

  • avatar
  • Oswald Buddenhagen <oswald.buddenhagen @no…a.com>
  • Fri Feb 05 17:32:49 CET 2010
don't use QKeySequence::mnemonic() after all

it wastes cpu cycles, and it started flooding the console with
irrelevant messages.
  
9494#include <QUrl>
9595#include <QWhatsThis>
9696
97#include <ctype.h>
98
9799QT_BEGIN_NAMESPACE
98100
99101static const int MessageMS = 2500;
23582358
23592359static bool haveMnemonic(const QString &str)
23602360{
2361 QString mnemonic = QKeySequence::mnemonic(str);
2362 if (mnemonic == QLatin1String("Alt+Space")) {
2363 // "Nobody" ever really uses these, and they are highly annoying
2364 // because we get a lot of false positives.
2365 return false;
2361 for (const ushort *p = (ushort *)str.constData();; ) { // Assume null-termination
2362 ushort c = *p++;
2363 if (!c)
2364 break;
2365 if (c == '&') {
2366 c = *p++;
2367 if (!c)
2368 return false;
2369 // "Nobody" ever really uses these alt-space, and they are highly annoying
2370 // because we get a lot of false positives.
2371 if (c != '&' && c != ' ' && QChar(c).isPrint()) {
2372 const ushort *pp = p;
2373 for (; ::isalpha(*p); p++) ;
2374 if (pp == p || *p != ';')
2375 return true;
2376 // This looks like a HTML &entity;, so ignore it. As a HTML string
2377 // won't contain accels anyway, we can stop scanning here.
2378 break;
2379 }
2380 }
23662381 }
2367 return !mnemonic.isEmpty();
2382 return false;
23682383}
23692384
23702385void MainWindow::updateDanger(const MultiDataIndex &index, bool verbose)