[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    [last-minute-patch] KOffice 1.5.1: Possible data loss in Kexi forms
From:       Jarosław_Staniek <js () iidea ! pl>
Date:       2006-05-18 12:02:25
Message-ID: 446C6251.8080204 () iidea ! pl
[Download RAW message or body]

Dear packagers,
As an effect of intensive checks, a relatively important bug has been found 
and fixed as soon as possible in Kexi; unfourtanely a few hours after 
publishing the tarball.

In case you don't mind applying the patch before packaging KOffice 1.5.1, I've 
attached it here. I am sorry for the inconvenience.


Details:

Forms: fixed saving data changes for db-aware checkboxes
   (fixed by setting StrongFocus policy as default)

-- 
regards / pozdrawiam,
  Jaroslaw Staniek / OpenOffice Polska

Sponsored by OpenOffice Polska to work on
* Kexi & KOffice: http://www.kexi-project.org | http://koffice.org/kexi
* KDE3 & KDE4 Libraries For Developing MS Windows Applications:
                   http://www.kdelibs.com/wiki
See also:
* Kexi For MS Windows: http://kexi.pl/wiki/index.php/Kexi_for_MS_Windows
* Kexi Support:        http://www.kexi-project.org/support.html

["kexi_checkbox_data_saving.patch" (text/plain)]

Index: kexi/plugins/forms/kexidataprovider.cpp
===================================================================
--- kexi/plugins/forms/kexidataprovider.cpp	(revision 542130)
+++ kexi/plugins/forms/kexidataprovider.cpp	(revision 542131)
@@ -92,7 +92,8 @@
  	for (KexiFormDataItemInterfaceToIntMap::ConstIterator it = m_fieldNumbersForDataItems.constBegin(); 
 		it!=m_fieldNumbersForDataItems.constEnd(); ++it)
 	{
-		kexipluginsdbg << "fill data of '" << it.key()->dataSource() <<  "' at idx=" << it.data() << endl;
+		kexipluginsdbg << "fill data of '" << it.key()->dataSource() <<  "' at idx=" << it.data() 
+			<< " data=" << row.at(it.data()) << endl;
 		it.key()->setValue( row.at(it.data()) );
 	}
 }
Index: kexi/plugins/forms/widgets/kexidbautofield.cpp
===================================================================
--- kexi/plugins/forms/widgets/kexidbautofield.cpp	(revision 542130)
+++ kexi/plugins/forms/widgets/kexidbautofield.cpp	(revision 542131)
@@ -446,8 +446,11 @@
 		@todo look at makeFirstCharacterUpperCaseInAutoLabels setting [bool]
 		(see doc/dev/settings.txt) */
 			if (!text.isEmpty()) {
-				realText = text[0].upper();
-				realText += (text.mid(1) + ": ");
+				realText = text[0].upper() + text.mid(1);
+				if (m_widgetType!=Boolean) {
+//! @todo ":" suffix looks weird for checkbox; remove this condition when [x] is displayed _after_ label
+					realText += ": ";
+				}
 			}
 		}
 		else
Index: kexi/plugins/forms/widgets/kexidbcheckbox.cpp
===================================================================
--- kexi/plugins/forms/widgets/kexidbcheckbox.cpp	(revision 542130)
+++ kexi/plugins/forms/widgets/kexidbcheckbox.cpp	(revision 542131)
@@ -27,7 +27,9 @@
  : QCheckBox(text, parent, name), KexiFormDataItemInterface()
 {
 	m_invalidState = false;
+//! todo: tristate 
 	setTristate(true);
+	setFocusPolicy(QWidget::StrongFocus);
 	connect(this, SIGNAL(stateChanged(int)), this, SLOT(slotStateChanged(int)));
 }
 
@@ -56,13 +58,16 @@
 
 void KexiDBCheckBox::setValueInternal(const QVariant &add, bool )
 {
-	setState( add.isNull() ? NoChange : (add.toBool() ? On : Off) );
+//	setState( add.isNull() ? NoChange : (add.toBool() ? On : Off) );
+	setState( m_origValue.isNull() ? NoChange : (m_origValue.toBool() ? On : Off) );
 }
 
 QVariant
 KexiDBCheckBox::value()
 {
-	return QVariant( isChecked(), 3 );
+	if (state()==NoChange)
+		return QVariant();
+	return QVariant(state()==On, 1);
 }
 
 void KexiDBCheckBox::slotStateChanged(int )


_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic