[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-i18n-doc
Subject: Re: Plural handling
From: Hasso Tepper <hasso () kde ! org>
Date: 2006-03-23 20:27:53
Message-ID: 200603232227.54066.hasso () kde ! org
[Download RAW message or body]
Nicolas Goutte wrote:
> On Wednesday 22 March 2006 12:24, Hasso Tepper wrote:
> > 2) What to do about stuff coming from *.ui files? Some of them handle
> > singular case in hackish way (for example with setSpecialValueText()
> > in case of QSpinBox), but that's not the correct way of course.
>
> I do not think that it is possible at all, as the uic compiler cannot
> handle it.
After some experiments I found out that it can be done though. Proof of
concept patch attached. What do you think? Maybe there are some drawbacks
I don't see? And note that I volunteer to fix things myself, I need just
confirmation that I don't screw up something.
regards,
--
Hasso Tepper
KDE Estonian Team
["ui-plurals-proof.patch" (text/x-diff)]
Index: korganizer/koeditoralarms_base.ui
===================================================================
--- korganizer/koeditoralarms_base.ui (revision 521648)
+++ korganizer/koeditoralarms_base.ui (working copy)
@@ -139,7 +139,7 @@
<bool>false</bool>
</property>
<property name="suffix">
- <string> time(s)</string>
+ <string></string>
</property>
<property name="maxValue">
<number>500</number>
@@ -189,7 +189,7 @@
<string>every </string>
</property>
<property name="suffix">
- <string> Minute(s)</string>
+ <string></string>
</property>
<property name="maxValue">
<number>999</number>
@@ -652,10 +652,30 @@
<receiver>mRepeatCount</receiver>
<slot>setEnabled(bool)</slot>
</connection>
+ <connection>
+ <sender>mRepeatCount</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>KOEditorAlarms_base</receiver>
+ <slot>repeatCountChanged(int)</slot>
+ </connection>
+ <connection>
+ <sender>mRepeatInterval</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>KOEditorAlarms_base</receiver>
+ <slot>repeatIntervalChanged(int)</slot>
+ </connection>
</connections>
<includes>
<include location="global" impldecl="in declaration">addresseelineedit.h</include>
+ <include location="local" impldecl="in implementation">koeditoralarms_base.ui.h</include>
</includes>
+<slots>
+ <slot access="private" specifier="non virtual">repeatCountChanged( int value )</slot>
+ <slot access="private" specifier="non virtual">repeatIntervalChanged( int value )</slot>
+</slots>
+<functions>
+ <function access="private" specifier="non virtual">init()</function>
+</functions>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
<includehint>kurlrequester.h</includehint>
Index: korganizer/koeditoralarms_base.ui.h
===================================================================
--- korganizer/koeditoralarms_base.ui.h (revision 0)
+++ korganizer/koeditoralarms_base.ui.h (revision 0)
@@ -0,0 +1,27 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you want to add, delete, or rename functions or slots, use
+** Qt Designer to update this file, preserving your code.
+**
+** You should not define a constructor or destructor in this file.
+** Instead, write your code in functions called init() and destroy().
+** These will automatically be called by the form's constructor and
+** destructor.
+*****************************************************************************/
+
+void KOEditorAlarms_base::init()
+{
+ repeatCountChanged( mRepeatCount->value() );
+ repeatIntervalChanged ( mRepeatInterval->value() );
+}
+
+void KOEditorAlarms_base::repeatCountChanged(int value)
+{
+ mRepeatCount->setSuffix( i18n(" time", " times", value));
+}
+
+void KOEditorAlarms_base::repeatIntervalChanged( int value )
+{
+ mRepeatInterval->setSuffix( i18n(" minute", " minutes", value));
+}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic