diff options
author | Roman Savochenko <roman@home.home> | 2023-11-21 19:52:40 +0200 |
---|---|---|
committer | Roman Savochenko <roman@home.home> | 2023-11-21 19:52:40 +0200 |
commit | cdcdbedbc1a82db8d6888bf9889766ec93899274 (patch) | |
tree | 98b72e6415a636d8fd4a7af12cc21f0d57d566fe | |
parent | 6deb3b43d145638070e9b7ad77eb9a10f4d3a72e (diff) | |
download | tdeutils-cdcdbedbc1a82db8d6888bf9889766ec93899274.tar.gz tdeutils-cdcdbedbc1a82db8d6888bf9889766ec93899274.zip |
KCALC: Local real values to or from clipboardfeat/kcalc-clipboardRealValues
Signed-off-by: Roman Savochenko <roman@home.home>
-rw-r--r-- | kcalc/general.ui | 8 | ||||
-rw-r--r-- | kcalc/kcalc.kcfg | 4 | ||||
-rw-r--r-- | kcalc/kcalcdisplay.cpp | 5 |
3 files changed, 16 insertions, 1 deletions
diff --git a/kcalc/general.ui b/kcalc/general.ui index bd04b29..1547284 100644 --- a/kcalc/general.ui +++ b/kcalc/general.ui @@ -153,6 +153,14 @@ <string>Group digits</string> </property> </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>kcfg_CopyToBufNoLocale</cstring> + </property> + <property name="text"> + <string>Copy real values to the buffer in not localized view</string> + </property> + </widget> </vbox> </widget> <spacer> diff --git a/kcalc/kcalc.kcfg b/kcalc/kcalc.kcfg index f098654..1e74850 100644 --- a/kcalc/kcalc.kcfg +++ b/kcalc/kcalc.kcfg @@ -83,6 +83,10 @@ <label>Whether to group digits.</label> <default>true</default> </entry> + <entry name="CopyToBufNoLocale" type="Bool" key="cptobufnolocale"> + <label>Copy real values to the buffer in not localized view.</label> + <default>false</default> + </entry> <entry name="ShowStat" type="Bool"> <label>Whether to show statistical buttons.</label> <default>false</default> diff --git a/kcalc/kcalcdisplay.cpp b/kcalc/kcalcdisplay.cpp index 1c620b0..1dac94f 100644 --- a/kcalc/kcalcdisplay.cpp +++ b/kcalc/kcalcdisplay.cpp @@ -102,7 +102,8 @@ void KCalcDisplay::slotCut(void) void KCalcDisplay::slotCopy(void) { - TQString txt = TQLabel::text(); + TQString txt = (_num_base == NB_DECIMAL && KCalcSettings::copyToBufNoLocale()) ? + _display_amount.toTQString(KCalcSettings::precision(), _fixed_precision) : TQLabel::text(); if (_num_base == NB_HEX) txt.prepend( "0x" ); (TQApplication::clipboard())->setText(txt, TQClipboard::Clipboard); @@ -142,6 +143,8 @@ void KCalcDisplay::slotPaste(bool bClipboard) } else // _num_base == NB_DECIMAL && ! tmp_str.startsWith("0x", false) { + tmp_str.replace(" ", "").replace(",", "."); //Normalization from the most localized numbers + setAmount(KNumber(tmp_str)); if (_beep && _display_amount == KNumber::NotDefined) KNotifyClient::beep(); |