okular: do not look for and remove "0" in the zoom text

obviously not very locale aware (non-arabic digits?)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-03-14 19:12:52 +02:00
parent 234a83d61b
commit e8e2b5bd0a

View file

@ -3622,7 +3622,6 @@ void PageView::updateZoomText()
translated << i18n("Fit Width") << i18n("Fit Page") << i18n("Auto Fit");
// add percent items
const QString single_oh( "0" );
int idx = 0, selIdx = 3;
bool inserted = false; //use: "d->zoomMode != ZoomFixed" to hide Fit/* zoom ratio
int zoomValueCount = 11;
@ -3637,14 +3636,7 @@ void PageView::updateZoomText()
inserted = true;
if ( !inserted )
selIdx++;
// we do not need to display 2-digit precision
QString localValue( KGlobal::locale()->formatNumber( value * 100.0, 1 ) );
const QChar decimalPoint = KGlobal::locale()->toLocale().decimalPoint();
localValue.remove( decimalPoint + single_oh );
// remove a trailing zero in numbers like 66.70
if ( localValue.right( 1 ) == QLatin1String( "0" ) && localValue.indexOf( decimalPoint ) > -1 )
localValue.chop( 1 );
translated << QString( "%1%" ).arg( localValue );
translated << QString( "%1%" ).arg( KGlobal::locale()->formatNumber( qFloor(value * 100.0), 0 ) );
}
d->aZoom->setItems( translated );