KCALC: Local real values to or from clipboard

Signed-off-by: Roman Savochenko <roman@home.home>
feat/kcalc-clipboardRealValues
Roman Savochenko 6 months ago
parent 6deb3b43d1
commit cdcdbedbc1

@ -153,6 +153,14 @@
<string>Group digits</string> <string>Group digits</string>
</property> </property>
</widget> </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> </vbox>
</widget> </widget>
<spacer> <spacer>

@ -83,6 +83,10 @@
<label>Whether to group digits.</label> <label>Whether to group digits.</label>
<default>true</default> <default>true</default>
</entry> </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"> <entry name="ShowStat" type="Bool">
<label>Whether to show statistical buttons.</label> <label>Whether to show statistical buttons.</label>
<default>false</default> <default>false</default>

@ -102,7 +102,8 @@ void KCalcDisplay::slotCut(void)
void KCalcDisplay::slotCopy(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) if (_num_base == NB_HEX)
txt.prepend( "0x" ); txt.prepend( "0x" );
(TQApplication::clipboard())->setText(txt, TQClipboard::Clipboard); (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) else // _num_base == NB_DECIMAL && ! tmp_str.startsWith("0x", false)
{ {
tmp_str.replace(" ", "").replace(",", "."); //Normalization from the most localized numbers
setAmount(KNumber(tmp_str)); setAmount(KNumber(tmp_str));
if (_beep && _display_amount == KNumber::NotDefined) if (_beep && _display_amount == KNumber::NotDefined)
KNotifyClient::beep(); KNotifyClient::beep();

Loading…
Cancel
Save