X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Futil.cpp;h=14435bde118fe4d0367aaf73b84e40c12d9f7188;hb=712781ef33198acb7267e02ee6f8f9bfc8598d5a;hp=8b9231e19f8cd4fb22f3416c74c7958639e81e62;hpb=e052c6532456d818b804ce726c8a6e66c81ad8a0;p=quassel.git 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