Diffstat (limited to 'noncore/apps/checkbook/listedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/checkbook/listedit.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/apps/checkbook/listedit.cpp b/noncore/apps/checkbook/listedit.cpp index 37f05f0..d00e305 100644 --- a/noncore/apps/checkbook/listedit.cpp +++ b/noncore/apps/checkbook/listedit.cpp | |||
@@ -10,111 +10,111 @@ | |||
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 | #include <qlayout.h> | 30 | #include <qlayout.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qlistview.h> | 32 | #include <qlistview.h> |
33 | #include <qwidgetstack.h> | 33 | #include <qwidgetstack.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
37 | 37 | ||
38 | 38 | ||
39 | // --- ListEdit --------------------------------------------------------------- | 39 | // --- ListEdit --------------------------------------------------------------- |
40 | ListEdit::ListEdit( QWidget *parent, const char *sName ) | 40 | ListEdit::ListEdit( QWidget *parent, const char *sName ) |
41 | : QWidget(parent, sName), TableDef(sName) | 41 | : QWidget(parent, sName), TableDef(sName) |
42 | { | 42 | { |
43 | // get font height | 43 | // get font height |
44 | int fh = fontMetrics().height(); | 44 | int fh = fontMetrics().height(); |
45 | 45 | ||
46 | // create layout | 46 | // create layout |
47 | QGridLayout *layout=new QGridLayout(this); | 47 | QGridLayout *layout=new QGridLayout(this); |
48 | layout->setSpacing( 2 ); | 48 | layout->setSpacing( 2 ); |
49 | layout->setMargin( 4 ); | 49 | layout->setMargin( 4 ); |
50 | 50 | ||
51 | // type table | 51 | // type table |
52 | _typeTable = new QListView( this ); | 52 | _typeTable = new QListView( this ); |
53 | ColumnDef *def=first(); | 53 | ColumnDef *def=first(); |
54 | while( def ) { | 54 | while( def ) { |
55 | _typeTable->addColumn( def->getName() ); | 55 | _typeTable->addColumn( def->getName() ); |
56 | def=next(); | 56 | def=next(); |
57 | } | 57 | } |
58 | connect( _typeTable, SIGNAL( clicked(QListViewItem *, const QPoint &, int) ), this, SLOT( slotClick(QListViewItem *, const QPoint &, int ) ) ); | 58 | connect( _typeTable, SIGNAL( clicked(QListViewItem*,const QPoint&,int) ), this, SLOT( slotClick(QListViewItem*,const QPoint&,int) ) ); |
59 | layout->addMultiCellWidget(_typeTable, 0,4,0,4); | 59 | layout->addMultiCellWidget(_typeTable, 0,4,0,4); |
60 | _currentItem=NULL; | 60 | _currentItem=NULL; |
61 | 61 | ||
62 | // edit field | 62 | // edit field |
63 | _stack=new QWidgetStack( this ); | 63 | _stack=new QWidgetStack( this ); |
64 | _stack->setMaximumHeight(fh+5); | 64 | _stack->setMaximumHeight(fh+5); |
65 | layout->addMultiCellWidget(_stack, 5,5,0,2); | 65 | layout->addMultiCellWidget(_stack, 5,5,0,2); |
66 | _typeEdit = new QLineEdit( _stack ); | 66 | _typeEdit = new QLineEdit( _stack ); |
67 | _stack->raiseWidget(_typeEdit ); | 67 | _stack->raiseWidget(_typeEdit ); |
68 | connect( _typeEdit, SIGNAL( textChanged(const QString &) ), this, SLOT( slotEditChanged(const QString &) ) ); | 68 | connect( _typeEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotEditChanged(const QString&) ) ); |
69 | 69 | ||
70 | // combo box | 70 | // combo box |
71 | _box=new QComboBox( _stack ); | 71 | _box=new QComboBox( _stack ); |
72 | connect( _box, SIGNAL( activated(const QString &) ), this, SLOT( slotActivated(const QString &) ) ); | 72 | connect( _box, SIGNAL( activated(const QString&) ), this, SLOT( slotActivated(const QString&) ) ); |
73 | 73 | ||
74 | 74 | ||
75 | // add button | 75 | // add button |
76 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/add" ), tr( "Add" ), this ); | 76 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/add" ), tr( "Add" ), this ); |
77 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotAdd() ) ); | 77 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotAdd() ) ); |
78 | layout->addWidget( btn, 5, 3 ); | 78 | layout->addWidget( btn, 5, 3 ); |
79 | 79 | ||
80 | // delete button | 80 | // delete button |
81 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this ); | 81 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this ); |
82 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDel() ) ); | 82 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDel() ) ); |
83 | layout->addWidget( btn, 5, 4 ); | 83 | layout->addWidget( btn, 5, 4 ); |
84 | } | 84 | } |
85 | 85 | ||
86 | // --- ~ListEdit -------------------------------------------------------------- | 86 | // --- ~ListEdit -------------------------------------------------------------- |
87 | ListEdit::~ListEdit() | 87 | ListEdit::~ListEdit() |
88 | { | 88 | { |
89 | } | 89 | } |
90 | 90 | ||
91 | 91 | ||
92 | // --- slotEditTypeChanged ---------------------------------------------------- | 92 | // --- slotEditTypeChanged ---------------------------------------------------- |
93 | void ListEdit::slotEditChanged(const QString &str) | 93 | void ListEdit::slotEditChanged(const QString &str) |
94 | { | 94 | { |
95 | if( !_currentItem || _currentColumn<0 ) return; | 95 | if( !_currentItem || _currentColumn<0 ) return; |
96 | _currentItem->setText(_currentColumn, str); | 96 | _currentItem->setText(_currentColumn, str); |
97 | } | 97 | } |
98 | 98 | ||
99 | // --- slotAddType ------------------------------------------------------------ | 99 | // --- slotAddType ------------------------------------------------------------ |
100 | void ListEdit::slotAdd() | 100 | void ListEdit::slotAdd() |
101 | { | 101 | { |
102 | // construct new row | 102 | // construct new row |
103 | QString args[8]; | 103 | QString args[8]; |
104 | ColumnDef *pCol=this->first(); | 104 | ColumnDef *pCol=this->first(); |
105 | int i=0; | 105 | int i=0; |
106 | while( pCol && i<8 ) { | 106 | while( pCol && i<8 ) { |
107 | args[i++]=pCol->getNewValue(); | 107 | args[i++]=pCol->getNewValue(); |
108 | pCol=this->next(); | 108 | pCol=this->next(); |
109 | } | 109 | } |
110 | _currentItem=new QListViewItem(_typeTable, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7] ); | 110 | _currentItem=new QListViewItem(_typeTable, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7] ); |
111 | 111 | ||
112 | // fix uniques | 112 | // fix uniques |
113 | fixTypes(); | 113 | fixTypes(); |
114 | 114 | ||
115 | // display col 0 of new value | 115 | // display col 0 of new value |
116 | QPoint pnt; | 116 | QPoint pnt; |
117 | slotClick(_currentItem, pnt, 0); | 117 | slotClick(_currentItem, pnt, 0); |
118 | _typeTable->setSelected( _currentItem, true ); | 118 | _typeTable->setSelected( _currentItem, true ); |
119 | 119 | ||
120 | // make it selected | 120 | // make it selected |