summaryrefslogtreecommitdiff
path: root/noncore/apps/checkbook/listedit.cpp
Unidiff
Diffstat (limited to 'noncore/apps/checkbook/listedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/checkbook/listedit.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/noncore/apps/checkbook/listedit.cpp b/noncore/apps/checkbook/listedit.cpp
index 99a6531..37f05f0 100644
--- a/noncore/apps/checkbook/listedit.cpp
+++ b/noncore/apps/checkbook/listedit.cpp
@@ -95,48 +95,52 @@ void ListEdit::slotEditChanged(const QString &str)
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 ------------------------------------------------------------
100void ListEdit::slotAdd() 100void 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
120 // make it selected
121 _typeEdit->setCursorPosition(0);
122 _typeEdit->setSelection(0, _typeEdit->text().length() );
119} 123}
120 124
121// --- slotDel ------------------------------------------------------------- 125// --- slotDel -------------------------------------------------------------
122void ListEdit::slotDel() 126void ListEdit::slotDel()
123{ 127{
124 if( !_currentItem ) return; 128 if( !_currentItem ) return;
125 delete _currentItem; 129 delete _currentItem;
126 _currentItem=NULL; 130 _currentItem=NULL;
127 _typeEdit->setText(""); 131 _typeEdit->setText("");
128 _stack->raiseWidget(_typeEdit); 132 _stack->raiseWidget(_typeEdit);
129} 133}
130 134
131 135
132// --- fixTypes ---------------------------------------------------------------- 136// --- fixTypes ----------------------------------------------------------------
133// Makes sure all entries have a unique name and empty entries are replaced 137// Makes sure all entries have a unique name and empty entries are replaced
134// by a generic string. The first version performs the operation on a particular 138// by a generic string. The first version performs the operation on a particular
135// column, whereas the 2nd does it for all unique columns. 139// column, whereas the 2nd does it for all unique columns.
136class ColMap { 140class ColMap {
137 public: 141 public:
138 ColMap(QString sValue, QListViewItem *pEntry) { 142 ColMap(QString sValue, QListViewItem *pEntry) {
139 _sValue=sValue; 143 _sValue=sValue;
140 _pEntry=pEntry; 144 _pEntry=pEntry;
141 } 145 }
142 QString &getValue() { return(_sValue); } 146 QString &getValue() { return(_sValue); }