~ubuntu-branches/ubuntu/maverick/datakiosk/maverick

« back to all changes in this revision

Viewing changes to src/src/fieldeditordialogimpl.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-06-27 22:48:06 UTC
  • Revision ID: james.westby@ubuntu.com-20050627224806-8farkci1dc2onhbs
Tags: upstream-0.7
ImportĀ upstreamĀ versionĀ 0.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
*   Copyright (C) 2005 by Adam Treat                                      *
 
3
*   treat@kde.org                                                         *
 
4
*                                                                         *
 
5
*   This program is free software; you can redistribute it and/or modify  *
 
6
*   it under the terms of the GNU General Public License as published by  *
 
7
*   the Free Software Foundation; either version 2 of the License, or     *
 
8
*   (at your option) any later version.                                   *
 
9
*                                                                         *
 
10
***************************************************************************/
 
11
 
 
12
#include "fieldeditordialogimpl.h"
 
13
 
 
14
#include "datafield.h"
 
15
#include "datatable.h"
 
16
 
 
17
#include <qcheckbox.h>
 
18
#include <qlineedit.h>
 
19
 
 
20
#include <qlabel.h>
 
21
#include <qgroupbox.h>
 
22
#include <qlayout.h>
 
23
 
 
24
#include <kiconloader.h>
 
25
 
 
26
FieldEditorDialog::FieldEditorDialog( DataField *dataField,
 
27
        DataTable *parentTable,
 
28
        bool configure,
 
29
        QWidget *parent,
 
30
        const char *name )
 
31
        : FieldEditorDialogBase( parent, name ),
 
32
        m_dataField( dataField ),
 
33
        m_parentTable( parentTable ),
 
34
        m_configure( configure )
 
35
{
 
36
    setMinimumSize( 800, 600 );
 
37
    setCaption( i18n("Field Editor Dialog") );
 
38
 
 
39
    wizard1->setPixmap( UserIcon( "wizard_table_4" ) );
 
40
 
 
41
    setup();
 
42
}
 
43
 
 
44
FieldEditorDialog::~FieldEditorDialog()
 
45
{}
 
46
 
 
47
void FieldEditorDialog::calculatedToggled( bool toggled )
 
48
{
 
49
    m_dataField->setCalculated( toggled );
 
50
 
 
51
    if ( toggled )
 
52
    {
 
53
        editEquation->setEnabled( true );
 
54
        editEquation->setText( m_dataField->equation() );
 
55
    }
 
56
    else
 
57
    {
 
58
        editEquation->setEnabled( false );
 
59
        editEquation->setText( QString::null );
 
60
    }
 
61
}
 
62
 
 
63
void FieldEditorDialog::fieldNameChanged( const QString &name )
 
64
{
 
65
    m_dataField->setName( name );
 
66
}
 
67
 
 
68
void FieldEditorDialog::fieldLabelChanged( const QString &label )
 
69
{
 
70
    m_dataField->setLabel( label );
 
71
}
 
72
 
 
73
void FieldEditorDialog::fieldEquationChanged( const QString &equation )
 
74
{
 
75
    m_dataField->setEquation( equation );
 
76
}
 
77
 
 
78
void FieldEditorDialog::setup()
 
79
{
 
80
    editName->setEnabled( m_dataField->isVirtual() );
 
81
    editName->setText( m_dataField->name() );
 
82
 
 
83
    editLabel->setEnabled( true );
 
84
    editLabel->setText( m_dataField->label() );
 
85
 
 
86
    checkBoxCalculated->setEnabled( !m_dataField->isVirtual() );
 
87
    checkBoxCalculated->setChecked( m_dataField->calculated() );
 
88
}
 
89
 
 
90
void FieldEditorDialog::accept()
 
91
{
 
92
    if ( !m_dataField->isVirtual() )
 
93
        m_parentTable->initializeFields();
 
94
    m_parentTable->initializeEditorFields();
 
95
 
 
96
    FieldEditorDialogBase::accept();
 
97
}
 
98
 
 
99
#include "fieldeditordialogimpl.moc"