[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-07 20:42:18
Message-ID: 20050407204218.0910F63E () office ! kde ! org
[Download RAW message or body]
CVS commit by treat:
* Include Virtual Fields in the Data Report output
M +35 -3 datareport.cpp 1.8
M +14 -5 datatable.cpp 1.28
M +1 -0 datatable.h 1.18
--- kdeextragear-1/datakiosk/src/datareport.cpp #1.7:1.8
@@ -272,4 +272,7 @@ void DataReport::refreshReport()
QStringList tt = QStringList::split( ", ", select.join( "" ) );
+ DataRecordList records;
+ QSqlRecord *record = new QSqlRecord();
+
QStringList::Iterator it3 = tt.begin();
for ( ; it3 != tt.end(); ++it3 )
@@ -278,8 +281,13 @@ void DataReport::refreshReport()
text = query.value( i ).toString();
+ QString field = ( QStringList::split( ".", ( *it3 ) ) [ 1 ] ).stripWhiteSpace();
+
+ QSqlField f( field, query.value( i ).type() );
+ f.setValue( query.value( i ) );
+ record->append( f );
+
DataTableList::Iterator it4 = list.begin();
for ( ; it4 != list.end(); ++it4 )
{
- QString field = ( QStringList::split( ".", ( *it3 ) ) [ 1 ] ).stripWhiteSpace();
DataRelation *relation = ( *it4 ) ->dataRelation( field );
@@ -304,8 +312,32 @@ void DataReport::refreshReport()
row.append( " " );
}
- row.append( "/>" );
- /* kdDebug() << row.join( "" ) << endl;*/
+
+ DataTableList::Iterator it7 = list.begin();
+ for ( ; it7 != list.end(); ++it7 )
+ {
+ records[ ( *it7 )->tableName() ] = record;
+ }
+
+ DataTableList::Iterator it5 = list.begin();
+ for ( ; it5 != list.end(); ++it5 )
+ {
+ DataFieldList fields = ( *it5 )->calculatedFields();
+ DataFieldList::iterator it6 = fields.begin();
+ for ( ; it6 != fields.end(); ++it6 )
+ {
+ row.append( ( *it5 )->tableName() );
+ row.append( "." );
+ row.append( ( *it6 )->name() );
+ row.append( "=\"" );
+ row.append( ( *it6 )->calculateField( records ).toString() );
+ row.append( "\"" );
+ row.append( " " );
+ }
}
+ row.append( "/>\n" );
+ }
+
+ kdDebug() << row.join( "" ) << endl;
xml += row.join( "" );
xml += "</KugarData>";
--- kdeextragear-1/datakiosk/src/datatable.cpp #1.27:1.28
@@ -507,5 +507,4 @@ void DataTable::slotUpdate()
m_tableEdit->setCurrentRow( -1 );
emit myCurrentChanged( 0L );
-/* calculateFieldsInTree();*/
}
else if ( m_tableView->currentSelection() != -1 )
@@ -640,9 +639,12 @@ QString DataTable::uniqueDataFieldName(
}
-void DataTable::calculateFieldsInTree()
+DataFieldList DataTable::calculatedFields()
{
- DataTableList tables = m_project->childrenOfDataTable( this );
- for ( DataTableList::Iterator it = tables.begin(); it != tables.end(); ++it )
- ( *it )->dataTableEdit()->calculateFields();
+ DataFieldList list;
+ DataFieldList::iterator it = m_fieldList.begin();
+ for ( ; it != m_fieldList.end(); ++it )
+ if ( ( *it )->isVirtual() )
+ list.append( ( *it ) );
+ return list;
}
@@ -656,4 +658,11 @@ DataRecordList DataTable::recordsInTree(
}
+void DataTable::calculateFieldsInTree()
+{
+ DataTableList tables = m_project->childrenOfDataTable( this );
+ for ( DataTableList::Iterator it = tables.begin(); it != tables.end(); ++it )
+ ( *it )->dataTableEdit()->calculateFields();
+}
+
void DataTable::addVirtualField()
{
--- kdeextragear-1/datakiosk/src/datatable.h #1.17:1.18
@@ -157,4 +157,5 @@ public:
QString uniqueDataFieldName( const QString &suggest = i18n( "DataField" ) );
+ DataFieldList calculatedFields();
DataRecordList recordsInTree();
void calculateFieldsInTree();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic