[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdeextragear-1/datakiosk/src
From: Adam Treat <manyoso () yahoo ! com>
Date: 2005-04-21 20:06:47
Message-ID: 20050421200647.EC634651 () office ! kde ! org
[Download RAW message or body]
CVS commit by treat:
* Fix null value problems that presented themselves when updating child tables.
M +1 -0 datatable.cpp 1.31
M +1 -0 datatableedit.cpp 1.18
M +26 -5 datatableeditorfactory.cpp 1.32
M +7 -4 datatableeditorfactory.h 1.22
--- kdeextragear-1/datakiosk/src/datatable.cpp #1.30:1.31
@@ -708,4 +708,5 @@ void DataTable::setup()
QObject::connect( m_tableEdit, SIGNAL( selectedRow( int, bool ) ),
m_tableView, SLOT( slotSelectRow( int, bool ) ) );
+ m_propMap->insert( "DataLineEdit", "value" );
m_propMap->insert( "RelationCombo", "relationid" );
m_propMap->insert( "DateEdit", "date" );
--- kdeextragear-1/datakiosk/src/datatableedit.cpp #1.17:1.18
@@ -401,4 +401,5 @@ void DataTableEdit::handleError( const Q
err = error;
+ kdDebug() << "Error in query = " << sqlCursor()->lastQuery() << endl;
QDataBrowser::handleError( error );
}
--- kdeextragear-1/datakiosk/src/datatableeditorfactory.cpp #1.31:1.32
@@ -332,4 +332,21 @@ DataLineEdit::DataLineEdit( DataField* f
}
+QString DataLineEdit::value() const
+{
+ QString txt = text();
+
+ if ( txt == "" && m_field->type() != QVariant::String )
+ return "NULL";
+ else if ( txt == "" )
+ return QString::null;
+
+ return txt;
+}
+
+void DataLineEdit::setValue( const QString &value )
+{
+ setText( value );
+}
+
void DataLineEdit::setReadOnly( bool readOnly )
{
@@ -617,18 +634,22 @@ void RelationCombo::initializeFields( bo
}
-int RelationCombo::relationId() const
+QString RelationCombo::relationId() const
{
- return m_relationId;
+ QString txt = lineEdit()->text();
+ if ( txt == QString::null || txt == "" )
+ return "NULL";
+ else
+ return QString::number( m_relationId );
}
-void RelationCombo::setRelationId( int id )
+void RelationCombo::setRelationId( const QString &id )
{
if ( m_constraints.count() )
initializeFields();
- setCurrentId( id );
+ setCurrentId( id.toInt() );
}
-void RelationCombo::setNullValue( const QString txt )
+void RelationCombo::setNullValue( const QString &txt )
{
setCurrentItem( -1 );
--- kdeextragear-1/datakiosk/src/datatableeditorfactory.h #1.21:1.22
@@ -89,8 +89,11 @@ class DataLineEdit : public KLineEdit
{
Q_OBJECT
+ Q_PROPERTY( QString value READ value WRITE setValue )
public:
DataLineEdit( DataField* field, DataTable *dataTable,
QWidget *parent = 0, const char *name = 0 );
+ QString value() const;
+ void setValue( const QString &value );
bool calculateEditor();
@@ -151,5 +154,5 @@ class RelationCombo : public KComboTable
{
Q_OBJECT
- Q_PROPERTY( int relationid READ relationId WRITE setRelationId )
+ Q_PROPERTY( QString relationid READ relationId WRITE setRelationId )
public:
RelationCombo( DataField* field, DataTable *dataTable,
@@ -157,7 +160,7 @@ public:
const char *name = 0 );
- int relationId() const;
- void setRelationId( int id );
- void setNullValue( const QString txt );
+ QString relationId() const;
+ void setRelationId( const QString &id );
+ void setNullValue( const QString &txt );
signals:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic