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_parentDataItemInterface) {
00059         m_parentDataItemInterface->signalValueChanged();
00060         return;
00061     }
00062     if (!m_listener || m_disable_signalValueChanged || isReadOnly())
00063         return;
00064     m_listener->valueChanged(this);
00065 }
00066 
00067 bool KexiDataItemInterface::valueChanged()
00068 {
00069 //  bool ok;
00070 //  kdDebug() << m_origValue.toString() << " ? " << value(ok).toString() << endl;
00071 //  return (m_origValue != value(ok)) && ok;
00072     kdDebug() << "KexiDataItemInterface::valueChanged(): " << m_origValue.toString() << " ? " << value().toString() << endl;
00073     return m_origValue != value();
00074 }
00075 
00076 /*
00077 void KexiDataItemInterface::setValue(const QVariant& value)
00078 {
00079     m_disable_signalValueChanged = true; //to prevent emmiting valueChanged()
00080     setValueInternal( value );
00081     m_disable_signalValueChanged = false;
00082 }*/
00083 
00084 void KexiDataItemInterface::installListener(KexiDataItemChangesListener* listener)
00085 {
00086     m_listener = listener;
00087 }
00088 
00089 void KexiDataItemInterface::showFocus( const QRect& r, bool readOnly )
00090 {
00091     Q_UNUSED(r);
00092     Q_UNUSED(readOnly);
00093 }
00094 
00095 void KexiDataItemInterface::hideFocus()
00096 {
00097 }
00098 
00099 void KexiDataItemInterface::clickedOnContents()
00100 {
00101 }
00102 
00103 bool KexiDataItemInterface::valueIsValid()
00104 {
00105     return true;
00106 }
KDE Home | KDE Accessibility Home | Description of Access Keys