~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to kexi/widget/tableview/kexitableedit.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2006-04-20 21:38:53 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060420213853-j5lxluqvymxt2zny
Tags: 1:1.5.0-0ubuntu2
UbuntuĀ uploadĀ 

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
   You should have received a copy of the GNU Library General Public License
16
16
   along with this program; see the file COPYING.  If not, write to
17
 
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
 
   Boston, MA 02111-1307, USA.
 
17
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
18
 * Boston, MA 02110-1301, USA.
19
19
 */
20
20
 
21
21
#include "kexitableedit.h"
69
69
        m_rightMargin = 0;//TODO
70
70
}
71
71
 
72
 
/*KexiTableEdit::KexiTableEdit(QVariant value, QWidget* parent, const char* name)
73
 
: QWidget(parent, name)
74
 
 ,m_origValue(value), 
75
 
 ,m_field(0)
76
 
 ,m_type(f.type()) //copied because the rest of code uses m_type
77
 
 ,m_view(0)
78
 
{
79
 
        m_type = f.type(); //copied because the rest of code uses m_type
80
 
        m_field = &f;
81
 
        setPaletteBackgroundColor( palette().color(QPalette::Active, QColorGroup::Base) );
82
 
//      installEventFilter(this);
83
 
}*/
84
 
 
85
72
KexiTableEdit::~KexiTableEdit()
86
73
{
87
74
}
88
75
 
89
 
/* moved to KexiDataItemInterface
90
 
void KexiTableEdit::init(const QVariant& value, const QVariant& add, bool removeOld)
91
 
{
92
 
        clear();
93
 
        m_origValue = value;
94
 
        init(add, removeOld);
95
 
}
96
 
*/
97
 
 
98
76
void KexiTableEdit::setViewWidget(QWidget *v)
99
77
{
100
78
        m_view = v;
114
92
        }
115
93
}
116
94
 
117
 
#if 0 //moved
118
 
void KexiTableEdit::showFocus( const QRect& /*r*/ )
119
 
{
120
 
}
121
 
 
122
 
void KexiTableEdit::hideFocus()
123
 
{
124
 
}
125
 
#endif
126
 
 
127
95
bool
128
96
KexiTableEdit::eventFilter(QObject* watched, QEvent* e)
129
97
{
156
124
//      return QWidget::eventFilter(watched, e);
157
125
}
158
126
 
159
 
/* moved to KexiDataItemInterface
160
 
bool KexiTableEdit::valueChanged()
161
 
{
162
 
        bool ok;
163
 
        kdDebug() << m_origValue.toString() << " ? " << value(ok).toString() << endl;
164
 
        return (m_origValue != value(ok)) && ok;
165
 
}
166
 
*/
167
 
 
168
127
void KexiTableEdit::paintFocusBorders( QPainter *p, QVariant &, int x, int y, int w, int h )
169
128
{
170
129
        p->drawRect(x, y, w, h);
229
188
                x = 5;
230
189
//              y_offset = 0;
231
190
#endif*/
232
 
                switch (m_column->field()->type()) {
233
 
                case KexiDB::Field::Time:
 
191
//              switch (m_column->field()->type()) {
 
192
/*moved         case KexiDB::Field::Time:
234
193
                        //it was QDateTime - a hack needed because QVariant(QTime) has broken isNull()
235
194
                        if (!val.isNull()) {
236
195
                                txt = val.toTime().toString(Qt::LocalDate);
237
196
                        }
238
197
                        break;
239
198
                case KexiDB::Field::Date:
240
 
                        txt = val.toDate().toString(Qt::LocalDate);
 
199
                        if (val.toDate().isValid())
 
200
                                txt = val.toDate().toString(Qt::LocalDate);
241
201
                        break;
242
202
                case KexiDB::Field::DateTime:
243
 
                        if (!val.toDate().isNull())
 
203
                        if (!val.toDateTime().isNull())
244
204
                                txt = val.toDate().toString(Qt::LocalDate) + " " + val.toTime().toString(Qt::LocalDate);
245
 
                        break;
246
 
                default:
247
 
                        if (!val.isNull()) {
248
 
                                txt = val.toString();
249
 
                        }
 
205
                        break;*/
 
206
//              default:
 
207
                if (!val.isNull()) {
 
208
                        txt = val.toString();
250
209
                }
 
210
//              }
251
211
                align |= AlignLeft;
252
212
        }
253
 
 
254
213
}
255
214
 
256
215
void KexiTableEdit::paintSelectionBackground( QPainter *p, bool /*focused*/,