Let Command construct its description (former defaultText) itself.

Instead of doing it duplicated in the general and the fakevim shortcut
settings.

Change-Id: Id4b0e5b0630f1e94c825528f1c038776dc205aa3
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Eike Ziller
2012-01-06 17:13:18 +01:00
committed by hjk
parent de26dad959
commit f7ca05e4b9
10 changed files with 55 additions and 73 deletions

View File

@@ -239,14 +239,25 @@ void CommandPrivate::setKeySequence(const QKeySequence &key)
m_isKeyInitialized = true;
}
void CommandPrivate::setDefaultText(const QString &text)
void CommandPrivate::setDescription(const QString &text)
{
m_defaultText = text;
}
QString CommandPrivate::defaultText() const
QString CommandPrivate::description() const
{
return m_defaultText;
if (!m_defaultText.isEmpty())
return m_defaultText;
if (action()) {
QString text = action()->text();
text.remove(QRegExp(QLatin1String("&(?!&)")));
if (!text.isEmpty())
return text;
} else if (shortcut()) {
if (!shortcut()->whatsThis().isEmpty())
return shortcut()->whatsThis();
}
return id().toString();
}
Id CommandPrivate::id() const
@@ -332,16 +343,6 @@ QKeySequence Shortcut::keySequence() const
return m_shortcut->key();
}
void Shortcut::setDefaultText(const QString &text)
{
m_defaultText = text;
}
QString Shortcut::defaultText() const
{
return m_defaultText;
}
void Shortcut::setCurrentContext(const Core::Context &context)
{
foreach (int ctxt, m_context) {