Diffstat (limited to 'noncore/apps/checkbook/listedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/checkbook/listedit.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/noncore/apps/checkbook/listedit.cpp b/noncore/apps/checkbook/listedit.cpp index d00e305..5026c9d 100644 --- a/noncore/apps/checkbook/listedit.cpp +++ b/noncore/apps/checkbook/listedit.cpp | |||
@@ -6,56 +6,61 @@ | |||
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "listedit.h" | 29 | #include "listedit.h" |
30 | |||
31 | /* OPIE */ | ||
32 | #include <opie2/odebug.h> | ||
33 | #include <qpe/resource.h> | ||
34 | using namespace Opie::Core; | ||
35 | |||
36 | /* QT */ | ||
30 | #include <qlayout.h> | 37 | #include <qlayout.h> |
31 | #include <qlineedit.h> | 38 | #include <qlineedit.h> |
32 | #include <qlistview.h> | 39 | #include <qlistview.h> |
33 | #include <qwidgetstack.h> | 40 | #include <qwidgetstack.h> |
34 | #include <qcombobox.h> | 41 | #include <qcombobox.h> |
35 | #include <qpushbutton.h> | 42 | #include <qpushbutton.h> |
36 | #include <qpe/resource.h> | ||
37 | |||
38 | 43 | ||
39 | // --- ListEdit --------------------------------------------------------------- | 44 | // --- ListEdit --------------------------------------------------------------- |
40 | ListEdit::ListEdit( QWidget *parent, const char *sName ) | 45 | ListEdit::ListEdit( QWidget *parent, const char *sName ) |
41 | : QWidget(parent, sName), TableDef(sName) | 46 | : QWidget(parent, sName), TableDef(sName) |
42 | { | 47 | { |
43 | // get font height | 48 | // get font height |
44 | int fh = fontMetrics().height(); | 49 | int fh = fontMetrics().height(); |
45 | 50 | ||
46 | // create layout | 51 | // create layout |
47 | QGridLayout *layout=new QGridLayout(this); | 52 | QGridLayout *layout=new QGridLayout(this); |
48 | layout->setSpacing( 2 ); | 53 | layout->setSpacing( 2 ); |
49 | layout->setMargin( 4 ); | 54 | layout->setMargin( 4 ); |
50 | 55 | ||
51 | // type table | 56 | // type table |
52 | _typeTable = new QListView( this ); | 57 | _typeTable = new QListView( this ); |
53 | ColumnDef *def=first(); | 58 | ColumnDef *def=first(); |
54 | while( def ) { | 59 | while( def ) { |
55 | _typeTable->addColumn( def->getName() ); | 60 | _typeTable->addColumn( def->getName() ); |
56 | def=next(); | 61 | def=next(); |
57 | } | 62 | } |
58 | connect( _typeTable, SIGNAL( clicked(QListViewItem*,const QPoint&,int) ), this, SLOT( slotClick(QListViewItem*,const QPoint&,int) ) ); | 63 | connect( _typeTable, SIGNAL( clicked(QListViewItem*,const QPoint&,int) ), this, SLOT( slotClick(QListViewItem*,const QPoint&,int) ) ); |
59 | layout->addMultiCellWidget(_typeTable, 0,4,0,4); | 64 | layout->addMultiCellWidget(_typeTable, 0,4,0,4); |
60 | _currentItem=NULL; | 65 | _currentItem=NULL; |
61 | 66 | ||
@@ -281,49 +286,49 @@ void ListEdit::slotClick(QListViewItem *itm, const QPoint &pnt, int col) | |||
281 | if( _currentColumn<0 ) _currentColumn=0; | 286 | if( _currentColumn<0 ) _currentColumn=0; |
282 | ColumnDef *pDef=this->at(_currentColumn); | 287 | ColumnDef *pDef=this->at(_currentColumn); |
283 | if( pDef->isType(ColumnDef::typeString) ) { | 288 | if( pDef->isType(ColumnDef::typeString) ) { |
284 | _typeEdit->setText( _currentItem->text(_currentColumn) ); | 289 | _typeEdit->setText( _currentItem->text(_currentColumn) ); |
285 | _stack->raiseWidget(_typeEdit); | 290 | _stack->raiseWidget(_typeEdit); |
286 | } else if( pDef->isType(ColumnDef::typeList) ){ | 291 | } else if( pDef->isType(ColumnDef::typeList) ){ |
287 | _box->clear(); | 292 | _box->clear(); |
288 | _box->insertStringList( pDef->getValueList() ); | 293 | _box->insertStringList( pDef->getValueList() ); |
289 | QStringList::Iterator itr; | 294 | QStringList::Iterator itr; |
290 | int i=0; | 295 | int i=0; |
291 | for(itr=pDef->getValueList().begin(); itr!=pDef->getValueList().end(); itr++) { | 296 | for(itr=pDef->getValueList().begin(); itr!=pDef->getValueList().end(); itr++) { |
292 | if( (*itr)==_currentItem->text(_currentColumn) ) { | 297 | if( (*itr)==_currentItem->text(_currentColumn) ) { |
293 | _box->setCurrentItem(i); | 298 | _box->setCurrentItem(i); |
294 | i=-1; | 299 | i=-1; |
295 | break; | 300 | break; |
296 | } | 301 | } |
297 | i++; | 302 | i++; |
298 | } | 303 | } |
299 | if( i>=0 ) { | 304 | if( i>=0 ) { |
300 | _box->insertItem( _currentItem->text(_currentColumn) ); | 305 | _box->insertItem( _currentItem->text(_currentColumn) ); |
301 | _box->setCurrentItem(i); | 306 | _box->setCurrentItem(i); |
302 | } | 307 | } |
303 | _stack->raiseWidget(_box); | 308 | _stack->raiseWidget(_box); |
304 | } else { | 309 | } else { |
305 | qDebug( "Unsupported column type for column %s", (const char *)pDef->getName() ); | 310 | odebug << "Unsupported column type for column " << (const char *)pDef->getName() << "" << oendl; |
306 | _typeEdit->setText(""); | 311 | _typeEdit->setText(""); |
307 | _stack->raiseWidget(_typeEdit); | 312 | _stack->raiseWidget(_typeEdit); |
308 | } | 313 | } |
309 | } | 314 | } |
310 | 315 | ||
311 | 316 | ||
312 | // --- addColumnDef ----------------------------------------------------------- | 317 | // --- addColumnDef ----------------------------------------------------------- |
313 | void ListEdit::addColumnDef(ColumnDef *pDef) | 318 | void ListEdit::addColumnDef(ColumnDef *pDef) |
314 | { | 319 | { |
315 | _typeTable->addColumn( pDef->getName() ); | 320 | _typeTable->addColumn( pDef->getName() ); |
316 | _vColumns.append(pDef); | 321 | _vColumns.append(pDef); |
317 | } | 322 | } |
318 | 323 | ||
319 | // --- addData ---------------------------------------------------------------- | 324 | // --- addData ---------------------------------------------------------------- |
320 | void ListEdit::addData(QStringList &lst) | 325 | void ListEdit::addData(QStringList &lst) |
321 | { | 326 | { |
322 | // run through list | 327 | // run through list |
323 | QStringList::Iterator itr; | 328 | QStringList::Iterator itr; |
324 | for(itr=lst.begin(); itr!=lst.end(); itr++) { | 329 | for(itr=lst.begin(); itr!=lst.end(); itr++) { |
325 | QStringList split=QStringList::split(";", *itr, true); | 330 | QStringList split=QStringList::split(";", *itr, true); |
326 | QStringList::Iterator entry; | 331 | QStringList::Iterator entry; |
327 | QString args[8]; | 332 | QString args[8]; |
328 | int i=0; | 333 | int i=0; |
329 | for(entry=split.begin(); entry!=split.end() && i<8; entry++, i++) { | 334 | for(entry=split.begin(); entry!=split.end() && i<8; entry++, i++) { |