https://bugzilla.novell.com/show_bug.cgi?id=438855
User sh@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=438855#c11
--- Comment #11 from Stefan Hundhammer 2008-11-05 09:27:21 MST ---
That font handling is in YQApplication::setLangFonts() in
http://svn.opensuse.org/svn/yast/trunk/qt/src/YQApplication.cc,
and I don't see any relevant change there since the 11.0 release.
svn log http://svn.opensuse.org/svn/yast/trunk/qt/src/YQApplication.cc
------------------------------------------------------------------------
r51212 | sh-sh-sh | 2008-09-17 12:39:21 +0200 (Mi, 17. Sep 2008) | 1 line
Fixed bnc #399502: Layout for right-to-left languages
------------------------------------------------------------------------
r49679 | tgoettlicher | 2008-08-05 11:08:13 +0200 (Di, 05. Aug 2008) | 2 lines
Fixed bnc #409612: popup menu during installation becomes hidden because of
NULL parent
------------------------------------------------------------------------
r47643 | coolo | 2008-05-17 16:36:56 +0200 (Sa, 17. Mai 2008) | 2 lines
reinit fontconfig on language change
------------------------------------------------------------------------
r47642 | coolo | 2008-05-17 15:56:40 +0200 (Sa, 17. Mai 2008) | 2 lines
fix support of lang_fonts
------------------------------------------------------------------------
So even though the last two changes do indeed deal with those fonts, they were
done weeks before the 11.0 release (2008-06-12). And after that time, there was
no change anywhere near the relevant code:
svn diff -r 47643
http://svn.opensuse.org/svn/yast/trunk/qt/src/YQApplication.cc
Index: YQApplication.cc
===================================================================
--- YQApplication.cc (Revision 47643)
+++ YQApplication.cc (Revision 52947)
@@ -80,11 +80,21 @@
{
YApplication::setLanguage( language, encoding );
loadPredefinedQtTranslations();
+
+ bool oldReverseLayout = YApplication::reverseLayout();
+ setLayoutDirection( language );
setLangFonts( language, encoding );
+
+ if ( oldReverseLayout != YApplication::reverseLayout() )
+ {
+ YDialog * dialog = YDialog::topmostDialog( false ); // don't throw
+
+ if ( dialog )
+ dialog->recalcLayout();
+ }
}
-
void
YQApplication::loadPredefinedQtTranslations()
{
@@ -125,20 +135,48 @@
<< path << "/" << transFile << endl;
qApp->installTranslator( _qtTranslations );
+
+ if ( qApp->layoutDirection() == Qt::RightToLeft )
+ YApplication::setReverseLayout( true );
}
+}
+void
+YQApplication::setLayoutDirection( const string & language )
+{
+ QString lang( language.c_str() );
+
// Force reverse layout for Arabic and Hebrew
- if ( ( language.startsWith( "ar" ) || // Arabic
- language.startsWith( "he" ) ) // Hebrew
- && ! (qApp->layoutDirection() == Qt::RightToLeft) )
+ if ( lang.startsWith( "ar" ) || // Arabic
+ lang.startsWith( "he" ) ) // Hebrew
{
- yuiWarning() << "Using fallback rule for reverse layout for language
\""
- << language << "\"" << endl;
+ yuiMilestone() << "Using reverse layout for " << language << endl;
qApp->setLayoutDirection( Qt::RightToLeft );
+ YApplication::setReverseLayout( true );
}
+ else
+ {
+ qApp->setLayoutDirection( Qt::LeftToRight );
+ YApplication::setReverseLayout( false );
+ }
+
+ // Qt tries to figure that out by having translators translate a message
+ // "QT_LAYOUT_DIRECTION" to "RTL" for right-to-left languages (i.e.,
+ // Arabic, Hebrew) with QQapplication::tr(). This of course only works if
+ // there are translations for those languages for QTranslator in the first
+ // place, i.e. it only works if translations for the predefined Qt dialogs
+ // (file selection dialog etc.) are available - and being loaded.
+ //
+ // libqt4-x11 contains Arabic translations for those Qt standard dialogs
in
+ // /usr/share/qt4/translations/qt_ar.qm, but (as of Sept. 2008) no Hebrew
+ // translations.
+ //
+ // Anyway, that Qt standard way is not very reliable. And they only do it
+ // at program startup anyway. Any later loading of those translations will
+ // not help.
}
@@ -158,7 +196,9 @@
if ( _langFonts->status() != QSettings::NoError )
yuiError() << "Error reading " << _langFonts->fileName() << endl;
else
- yuiMilestone() << _langFonts->fileName() << " read OK" <<
qPrintable( _langFonts->allKeys().join( "-" ) ) << endl;
+ yuiMilestone() << _langFonts->fileName() << " read OK"
+ << qPrintable( _langFonts->allKeys().join( "-" ) )
+ << endl;
}
QString lang = language.c_str();
@@ -200,13 +240,7 @@
// setting the language loads fonts and we need to tell fontconfig
FcInitReinitialize();
-#if 0
- QFontDatabase database;
- int ret = database.addApplicationFont(
"/usr/share/fonts/truetype/ipag.ttf" );
- yuiMilestone() << "families " << qPrintable( database.families().join(
"-" ) ) << " " << ret << endl;
-#endif
-
- foreach (QWidget *widget, QApplication::allWidgets())
+ foreach ( QWidget *widget, QApplication::allWidgets() )
{
if ( widget->font().family() != oldFontFamily )
continue;
@@ -483,12 +517,18 @@
QString fileName;
bool tryAgain = false;
+ QWidget* parent = 0;
+ YDialog * currentDialog = YDialog::currentDialog( false );
+ if (currentDialog)
+ parent = (QWidget *) currentDialog->widgetRep();
+
+
do
{
// Leave the mouse cursor alone - this function might be called from
// some other widget, not only from UI::AskForSaveFileName().
- fileName = QFileDialog::getSaveFileName( 0, //
parent
+ fileName = QFileDialog::getSaveFileName( parent, //
parent
headline, //
caption
startWith, // dir
filter ); //
filter
@@ -512,7 +552,7 @@
msg = ( _( "%1 exists and is write-protected!\nReally
overwrite?" ) ).arg( fileName );
}
- int buttonNo = QMessageBox::information( 0, // parent widget
+ int buttonNo = QMessageBox::information( parent,
// Translators: Window
title for confirmation dialog
_( "Confirm" ),
msg,
@@ -588,7 +628,13 @@
"\n"
"Switch left and right mouse buttons?"
);
- int button = QMessageBox::question( 0,
+
+ QWidget* parent = 0;
+ YDialog * currentDialog = YDialog::currentDialog( false );
+ if (currentDialog)
+ parent = (QWidget *) currentDialog->widgetRep();
+
+ int button = QMessageBox::question( parent,
// Popup dialog caption
_( "Unexpected Click" ),
message,
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.