Bug 379171 - [PATCH] MPa and PSI aren't marked as common units
Summary: [PATCH] MPa and PSI aren't marked as common units
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kunitconversion
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.33.0
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: John Layt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-24 18:33 UTC by Nate Graham
Modified: 2017-07-22 07:52 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch (2.42 KB, patch)
2017-04-24 19:46 UTC, Nate Graham
Details
Patch (1.76 KB, patch)
2017-07-21 01:28 UTC, Nate Graham
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2017-04-24 18:33:20 UTC
Linux Distro: openSUSE Tumbleweed
Plasma version: 5.9.4

Summary:
I often find myself wanting to convert between MPa and PSI and vice versa, via KRunner. Simply writing the thing to be converted doesn't show MPa or PSI in the list of displayed conversions; you need to explicitly request it ("1900 PSI in MPa or "13.1 MPa in PSI").


Steps to reproduce:
1. Activate KRunner
2. Type in "1900 PSI" or "13.1 MPa"


Actual results:
Krunner shows conversions for atmospheres, bars, inches of mercury, hectopascals, and pascals.


Expected results:
There should be a conversion to megapascals (MPa) or pounds per square foot (PSI)--both of which are commonly used in the construction trades.


Additional information:
IMHO MPa and PSI are more useful than hectopascals, and they should replace it.

I'd be happy to submit a patch, but I wasn't able to find the source for this runner.
Comment 1 Kai Uwe Broulik 2017-04-24 18:36:51 UTC
Re-assigning to KUnitconversion framework which the units runner uses, it just asks it "what are the common units for 'pressure'" and then it returns these, and while it knows MPa and psi they're not flagged as "common" in there.
Comment 2 Kai Uwe Broulik 2017-04-24 18:38:00 UTC
Btw if you want to give it a go, you can find the definitions for pressure in kunitconversion/src/pressure.cpp, note the addUnit vs addCommonUnit
Comment 3 Nate Graham 2017-04-24 18:38:37 UTC
Ok great, I can submit a patch for that! Thanks for your help!
Comment 4 Nate Graham 2017-04-24 19:46:29 UTC
Created attachment 105176 [details]
Patch
Comment 5 Christoph Feck 2017-04-27 11:57:19 UTC
Hektopascal certainly is a very common unit in meteorology (at least here in Germany).
Comment 6 Nate Graham 2017-07-21 01:28:34 UTC
Created attachment 106772 [details]
Patch

Here's a new patch that doesn't change anything for HPa, and just marks MPa and PSI as common.
Comment 7 Kai Uwe Broulik 2017-07-21 06:16:58 UTC
Thanks for your patch. Please upload it to phabricator.kde.org for developers to review it - patches on Bugzilla get easily overlooked.
Comment 8 Nate Graham 2017-07-21 13:14:24 UTC
Thanks. Here you go: https://phabricator.kde.org/D6808
Comment 9 Albert Astals Cid 2017-07-22 07:52:22 UTC
Git commit 11a8590d0e83a474d76aa6f2d90b0d4b5fadaebc by Albert Astals Cid, on behalf of Nathaniel Graham.
Committed on 22/07/2017 at 07:51.
Pushed by aacid into branch 'master'.

Mark MPa and PSI as common units

Differential Revision: https://phabricator.kde.org/D6808

M  +2    -2    src/pressure.cpp

https://commits.kde.org/kunitconversion/11a8590d0e83a474d76aa6f2d90b0d4b5fadaebc