Git commit 144dee0f134043a0bf5600912573d39f78179a7a by Aaron Seigo. Committed on 13/02/2013 at 14:01. Pushed by aseigo into branch 'master'. the thread handling is consistent and fast enough to drop the '=3D' require= ment now M +4 -7 plasma/generic/runners/calculator/calculatorrunner.cpp http://commits.kde.org/kde-workspace/144dee0f134043a0bf5600912573d39f78179a= 7a diff --git a/plasma/generic/runners/calculator/calculatorrunner.cpp b/plasm= a/generic/runners/calculator/calculatorrunner.cpp index 684bc4e..54c3b72 100644 --- a/plasma/generic/runners/calculator/calculatorrunner.cpp +++ b/plasma/generic/runners/calculator/calculatorrunner.cpp @@ -49,6 +49,7 @@ CalculatorRunner::CalculatorRunner( QObject* parent, cons= t QVariantList &args ) = QString description =3D i18n("Calculates the value of :q: when :q: is = made up of numbers and " "mathematical symbols such as +, -, /, * an= d ^."); + addSyntax(Plasma::RunnerSyntax(":q:", description)); addSyntax(Plasma::RunnerSyntax("=3D:q:", description)); addSyntax(Plasma::RunnerSyntax(":q:=3D", description)); } @@ -63,11 +64,11 @@ CalculatorRunner::~CalculatorRunner() void CalculatorRunner::powSubstitutions(QString& cmd) { if (cmd.contains("e+", Qt::CaseInsensitive)) { - cmd=3Dcmd.replace("e+", "*10^", Qt::CaseInsensitive); + cmd =3D cmd.replace("e+", "*10^", Qt::CaseInsensitive); } = if (cmd.contains("e-", Qt::CaseInsensitive)) { - cmd=3Dcmd.replace("e-", "*10^-", Qt::CaseInsensitive); + cmd =3D cmd.replace("e-", "*10^-", Qt::CaseInsensitive); } = // the below code is scary mainly because we have to honor priority @@ -204,7 +205,7 @@ void CalculatorRunner::match(Plasma::RunnerContext &con= text) //no meanless space between friendly guys: helps simplify code cmd =3D cmd.trimmed().remove(' '); = - if (cmd.length() < 4) { + if (cmd.length() < 3) { return; } = @@ -226,9 +227,6 @@ void CalculatorRunner::match(Plasma::RunnerContext &con= text) cmd.remove(0, cmd.indexOf('=3D') + 1); } else if (cmd.endsWith('=3D')) { cmd.chop(1); - } else { - // we don't have an actionable equation here - return; } = if (cmd.isEmpty()) { @@ -241,7 +239,6 @@ void CalculatorRunner::match(Plasma::RunnerContext &con= text) #endif = QString result =3D calculate(cmd); - if (!result.isEmpty() && result !=3D cmd) { if (toHex) { result =3D "0x" + QString::number(result.toInt(), 16).toUpper(= );