X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Futil.cpp;h=14435bde118fe4d0367aaf73b84e40c12d9f7188;hp=8b9231e19f8cd4fb22f3416c74c7958639e81e62;hb=f8275c3b697f1ee43d93bb4e5e688e87ca0405ce;hpb=7f3d50af3f94bd5fc423c83ac21c460da2edf88b diff --git a/src/common/util.cpp b/src/common/util.cpp index 8b9231e1..14435bde 100644 --- a/src/common/util.cpp +++ b/src/common/util.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-09 by the Quassel Project * + * Copyright (C) 2005-2010 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -60,6 +60,22 @@ QString stripFormatCodes(QString str) { return str; } +QString stripAcceleratorMarkers(const QString &label_) { + QString label = label_; + int p = 0; + forever { + p = label.indexOf('&', p); + if(p < 0 || p + 1 >= label.length()) + break; + + if(label.at(p + 1).isLetterOrNumber() || label.at(p + 1) == '&') + label.remove(p, 1); + + ++p; + } + return label; +} + QString decodeString(const QByteArray &input, QTextCodec *codec) { // First, we check if it's utf8. It is very improbable to encounter a string that looks like // valid utf8, but in fact is not. This means that if the input string passes as valid utf8, it