kexi
kexidataiteminterface.cpp
00001 /* This file is part of the KDE project 00002 Copyright (C) 2005 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 "kexidataiteminterface.h" 00021 00022 #include <kdebug.h> 00023 00024 KexiDataItemChangesListener::KexiDataItemChangesListener() 00025 { 00026 } 00027 00028 KexiDataItemChangesListener::~KexiDataItemChangesListener() 00029 { 00030 } 00031 00032 //----------------------------------------------- 00033 00034 KexiDataItemInterface::KexiDataItemInterface() 00035 : m_listener(0) 00036 , m_parentDataItemInterface(0) 00037 , m_hasFocusableWidget(true) 00038 , m_disable_signalValueChanged(false) 00039 , m_acceptEditorAfterDeleteContents(false) 00040 { 00041 } 00042 00043 KexiDataItemInterface::~KexiDataItemInterface() 00044 { 00045 } 00046 00047 void KexiDataItemInterface::setValue(const QVariant& value, const QVariant& add, bool removeOld) 00048 { 00049 m_disable_signalValueChanged = true; //to prevent emmiting valueChanged() 00050 //needed? clear(); 00051 m_origValue = value; 00052 setValueInternal(add, removeOld); 00053 m_disable_signalValueChanged = false; 00054 } 00055 00056 void KexiDataItemInterface::signalValueChanged() 00057 { 00058 if (m_disable_signalValueChanged || isReadOnly()) 00059 return; 00060 if (m_parentDataItemInterface) { 00061 m_parentDataItemInterface->signalValueChanged(); 00062 return; 00063 } 00064 if (m_listener) 00065 m_listener->valueChanged(this); 00066 } 00067 00068 bool KexiDataItemInterface::valueChanged() 00069 { 00070 // bool ok; 00071 // kdDebug() << m_origValue.toString() << " ? " << value(ok).toString() << endl; 00072 // return (m_origValue != value(ok)) && ok; 00073 kdDebug() << "KexiDataItemInterface::valueChanged(): " << m_origValue.toString() << " ? " << value().toString() << endl; 00074 return m_origValue != value(); 00075 } 00076 00077 /* 00078 void KexiDataItemInterface::setValue(const QVariant& value) 00079 { 00080 m_disable_signalValueChanged = true; //to prevent emmiting valueChanged() 00081 setValueInternal( value ); 00082 m_disable_signalValueChanged = false; 00083 }*/ 00084 00085 void KexiDataItemInterface::installListener(KexiDataItemChangesListener* listener) 00086 { 00087 m_listener = listener; 00088 } 00089 00090 void KexiDataItemInterface::showFocus( const QRect& r, bool readOnly ) 00091 { 00092 Q_UNUSED(r); 00093 Q_UNUSED(readOnly); 00094 } 00095 00096 void KexiDataItemInterface::hideFocus() 00097 { 00098 } 00099 00100 void KexiDataItemInterface::clickedOnContents() 00101 { 00102 } 00103 00104 bool KexiDataItemInterface::valueIsValid() 00105 { 00106 return true; 00107 }