[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-bugs-dist
Subject: [Bug 102381] In the Edit Form,
From: Adam Treat <manyoso () yahoo ! com>
Date: 2005-03-29 23:42:32
Message-ID: 20050329234232.1377.qmail () ktown ! kde ! org
[Download RAW message or body]
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
http://bugs.kde.org/show_bug.cgi?id=102381
manyoso yahoo com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
------- Additional Comments From manyoso yahoo com 2005-03-30 01:42 -------
CVS commit by treat:
* Handle null values in the edit form.
BUGS:102381
M +2 -1 datatable.cpp 1.24
M +26 -1 datatableedit.cpp 1.13
M +39 -5 datatableeditorfactory.cpp 1.24
M +5 -3 datatableeditorfactory.h 1.14
--- kdeextragear-1/datakiosk/src/datatable.cpp #1.23:1.24
@ -455,7 +455,8 @ void DataTable::slotUpdate()
if ( m_tableView->currentSelection() == -1 && m_tableView->numRows() < 1 )
{
+ m_tableEdit->setCurrentRow( -1 );
emit myCurrentChanged( 0L );
}
- else
+ else if ( m_tableView->currentSelection() != -1 )
{
m_tableEdit->setCurrentRow( m_tableView->currentRow() );
--- kdeextragear-1/datakiosk/src/datatableedit.cpp #1.12:1.13
@ -17,8 +17,8 @
#include <qpalette.h>
#include <qpushbutton.h>
-#include <qsqlform.h>
#include <qlabel.h>
#include <qpainter.h>
+#include <qsqlform.h>
#include <qdrawutil.h>
@ -158,4 +158,16 @ QFrame* DataTableEdit::getFormBox() cons
void DataTableEdit::setCurrentRow( int row )
{
+ if ( row == -1 )
+ {
+ form()->clearValues( true );
+ setEnabled( FALSE );
+ m_scroll->viewport()->hide();
+ }
+ else if ( !isEnabled() )
+ {
+ setEnabled( TRUE );
+ m_scroll->viewport()->show();
+ }
+
seek( row, FALSE);
}
@ -238,4 +250,17 @ void DataTableEdit::readFields()
m_refreshing = true;
QDataBrowser::readFields();
+
+ QLayoutIterator it = m_formLayout->iterator();
+ QLayoutItem *item;
+ while ( (item = it.current()) != 0 )
+ {
+ DataEditorBase *editor = ::qt_cast<DataEditorBase*>( item->widget() );
+ if ( editor->getField()->isNull() )
+ {
+ editor->setNullValue( "" ); //needs to sync with QDataTable::nullText
+ }
+ ++it;
+ }
+
m_refreshing = false;
}
--- kdeextragear-1/datakiosk/src/datatableeditorfactory.cpp #1.23:1.24
@ -228,4 +228,32 @ bool DataEditorBase::currentEdited() con
}
+void DataEditorBase::setNullValue( const QString txt )
+{
+ if ( ::qt_cast<QLineEdit*>( m_editor ) )
+ {
+ ( ( QLineEdit* ) m_editor ) ->setText( txt );
+ }
+
+// else if ( ::qt_cast<DateEdit*>( m_editor ) )
+// {
+// ( ( DateEdit* ) m_editor ) ->setText( txt );
+// }
+//
+// else if ( ::qt_cast<TimeEdit*>( m_editor ) )
+// {
+// ( ( TimeEdit* ) m_editor ) ->setText( txt );
+// }
+//
+// else if ( ::qt_cast<DateTimeEdit*>( m_editor ) )
+// {
+// ( ( DateTimeEdit* ) m_editor ) ->setText( txt );
+// }
+
+ else if ( ::qt_cast<RelationCombo*>( m_editor ) )
+ {
+ ( ( RelationCombo* ) m_editor ) ->setNullValue( txt );
+ }
+}
+
void DataEditorBase::editorChanged( const QString &txt )
{
@ -457,15 +485,21 @ void RelationCombo::initializeFields( bo
}
-int RelationCombo::relationId() const
+QString RelationCombo::relationId() const
{
- return m_relationId;
+ return QString::number( m_relationId );
}
-void RelationCombo::setRelationId( int id )
+void RelationCombo::setRelationId( const QString &id )
{
if ( m_constrained )
initializeFields();
- setCurrentId( id );
+ setCurrentId( id.toInt() );
+}
+
+void RelationCombo::setNullValue( const QString txt )
+{
+ setCurrentItem( -1 );
+ setCurrentText( txt );
}
--- kdeextragear-1/datakiosk/src/datatableeditorfactory.h #1.13:1.14
@ -56,4 +56,5 @ public:
QSize getRecommendedSize () const;
bool currentEdited() const;
+ void setNullValue( const QString txt );
signals:
@ -104,5 +105,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 *m_dataTable,
@ -110,6 +111,7 @ public:
const char *name = 0 );
- int relationId() const;
- void setRelationId( int id );
+ 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