kexi
kexiformdataiteminterface.cpp
00001 /* This file is part of the KDE project 00002 Copyright (C) 2005-2006 Jaroslaw Staniek <js@iidea.pl> 00003 00004 This program is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this program; see the file COPYING. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #include "kexiformdataiteminterface.h" 00021 #include "kexiformscrollview.h" 00022 #include <kexidb/queryschema.h> 00023 #include <kexiutils/utils.h> 00024 00025 KexiFormDataItemInterface::KexiFormDataItemInterface() 00026 : KexiDataItemInterface() 00027 , m_columnInfo(0) 00028 , m_displayParametersForEnteredValue(0) 00029 , m_displayParametersForDefaultValue(0) 00030 , m_displayDefaultValue(false) 00031 { 00032 } 00033 00034 KexiFormDataItemInterface::~KexiFormDataItemInterface() 00035 { 00036 delete m_displayParametersForEnteredValue; 00037 delete m_displayParametersForDefaultValue; 00038 } 00039 00040 void KexiFormDataItemInterface::undoChanges() 00041 { 00042 // m_disable_signalValueChanged = true; 00043 setValueInternal(QString::null, false); 00044 // m_disable_signalValueChanged = false; 00045 } 00046 00047 KexiDB::Field* KexiFormDataItemInterface::field() const 00048 { 00049 return m_columnInfo ? m_columnInfo->field : 0; 00050 } 00051 00052 void KexiFormDataItemInterface::setDisplayDefaultValue(QWidget* widget, bool displayDefaultValue) 00053 { 00054 m_displayDefaultValue = displayDefaultValue; 00055 if (!m_displayParametersForDefaultValue) { 00056 m_displayParametersForEnteredValue = new KexiDisplayUtils::DisplayParameters(widget); 00057 m_displayParametersForDefaultValue = new KexiDisplayUtils::DisplayParameters(); 00058 KexiDisplayUtils::initDisplayForDefaultValue(*m_displayParametersForDefaultValue, widget); 00059 } 00060 } 00061 00062 void KexiFormDataItemInterface::cancelEditor() 00063 { 00064 QWidget *parentWidget = dynamic_cast<QWidget*>(this)->parentWidget(); 00065 KexiFormScrollView* view = KexiUtils::findParent<KexiFormScrollView>(parentWidget, "KexiFormScrollView"); 00066 if (view) 00067 view->cancelEditor(); 00068 }