summaryrefslogtreecommitdiff
authorzecke <zecke>2002-12-17 19:23:58 (UTC)
committer zecke <zecke>2002-12-17 19:23:58 (UTC)
commit59d5865053c8e722339a63d05c73eb923350620f (patch) (unidiff)
tree289a5874504d00957a4950d0074e0f484d1c59f5
parent7459ea6f560b01290086a0919fc5808291973b33 (diff)
downloadopie-59d5865053c8e722339a63d05c73eb923350620f.zip
opie-59d5865053c8e722339a63d05c73eb923350620f.tar.gz
opie-59d5865053c8e722339a63d05c73eb923350620f.tar.bz2
a QTableItem is no QObject so better use QObject::tr
besides that tableitems is dead... and I do drawing myself so better look at the tableview if you want to have that translated CCMAIL: cniehaus@kde.org
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/tableitems.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/pim/todo/tableitems.cpp b/core/pim/todo/tableitems.cpp
index a636de6..216b740 100644
--- a/core/pim/todo/tableitems.cpp
+++ b/core/pim/todo/tableitems.cpp
@@ -9,48 +9,50 @@
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This program is distributed in the hope that 12    .i_,=:_.      -<s. This program is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28#include "tableview.h" 28#include "tableview.h"
29 29
30#include "tableitems.h" 30#include "tableitems.h"
31#include <string.h> 31#include <string.h>
32 32
33#include <qobject.h>
34
33using namespace Todo; 35using namespace Todo;
34 36
35CheckItem::CheckItem( QTable* t, 37CheckItem::CheckItem( QTable* t,
36 const QString& sortKey, 38 const QString& sortKey,
37 int uid, 39 int uid,
38 const QArray<int>& lis) 40 const QArray<int>& lis)
39 : OCheckItem(t, sortKey), m_uid(uid ), m_cat( lis ) 41 : OCheckItem(t, sortKey), m_uid(uid ), m_cat( lis )
40{ 42{
41} 43}
42CheckItem::~CheckItem() { 44CheckItem::~CheckItem() {
43} 45}
44void CheckItem::setChecked( bool b ) { 46void CheckItem::setChecked( bool b ) {
45 OCheckItem::setChecked(b); 47 OCheckItem::setChecked(b);
46} 48}
47void CheckItem::toggle() { 49void CheckItem::toggle() {
48 TableView* view = static_cast<TableView*>( table() ); 50 TableView* view = static_cast<TableView*>( table() );
49 OTodo ev = view->find( view->current() ); 51 OTodo ev = view->find( view->current() );
50 ev.setCompleted(!isChecked() ); 52 ev.setCompleted(!isChecked() );
51 //view->updateFromTable( ev ); 53 //view->updateFromTable( ev );
52 54
53 OCheckItem::toggle(); 55 OCheckItem::toggle();
54 table()->updateCell( row(), col() ); 56 table()->updateCell( row(), col() );
55} 57}
56int CheckItem::uid() const { 58int CheckItem::uid() const {
@@ -134,48 +136,48 @@ QString DueTextItem::key() const {
134 if(m_off == 0 ){ 136 if(m_off == 0 ){
135 key.append("b"); 137 key.append("b");
136 }else if( m_off > 0 ){ 138 }else if( m_off > 0 ){
137 key.append("c"); 139 key.append("c");
138 }else if( m_off < 0 ){ 140 }else if( m_off < 0 ){
139 key.append("a"); 141 key.append("a");
140 } 142 }
141 key.append(QString::number(m_off ) ); 143 key.append(QString::number(m_off ) );
142 }else{ 144 }else{
143 key.append("d"); 145 key.append("d");
144 } 146 }
145 return key; 147 return key;
146} 148}
147void DueTextItem::setCompleted( bool comp ) { 149void DueTextItem::setCompleted( bool comp ) {
148 m_completed = comp; 150 m_completed = comp;
149 table()->updateCell( row(), col() ); 151 table()->updateCell( row(), col() );
150} 152}
151void DueTextItem::setToDoEvent( const OTodo& ev ) { 153void DueTextItem::setToDoEvent( const OTodo& ev ) {
152 m_hasDate = ev.hasDueDate(); 154 m_hasDate = ev.hasDueDate();
153 m_completed = ev.isCompleted(); 155 m_completed = ev.isCompleted();
154 156
155 if( ev.hasDueDate() ){ 157 if( ev.hasDueDate() ){
156 QDate today = QDate::currentDate(); 158 QDate today = QDate::currentDate();
157 m_off = today.daysTo(ev.dueDate() ); 159 m_off = today.daysTo(ev.dueDate() );
158 setText( tr( "%1 day(s)" ).arg( QString::number(m_off) ) ); 160 setText( QObject::tr( "%1 day(s)" ).arg( QString::number(m_off) ) );
159 }else{ 161 }else{
160 setText("n.d." ); 162 setText("n.d." );
161 m_off = 0; 163 m_off = 0;
162 } 164 }
163} 165}
164void DueTextItem::paint( QPainter* p, const QColorGroup &cg, 166void DueTextItem::paint( QPainter* p, const QColorGroup &cg,
165 const QRect& cr, bool selected ) { 167 const QRect& cr, bool selected ) {
166 QColorGroup cg2(cg); 168 QColorGroup cg2(cg);
167 169
168 QColor text = cg.text(); 170 QColor text = cg.text();
169 if( m_hasDate && !m_completed ){ 171 if( m_hasDate && !m_completed ){
170 if( m_off < 0 ){ 172 if( m_off < 0 ){
171 cg2.setColor(QColorGroup::Text, QColor(red ) ); 173 cg2.setColor(QColorGroup::Text, QColor(red ) );
172 }else if( m_off == 0 ){ 174 }else if( m_off == 0 ){
173 cg2.setColor(QColorGroup::Text, QColor(yellow) ); // orange isn't predefined 175 cg2.setColor(QColorGroup::Text, QColor(yellow) ); // orange isn't predefined
174 }else if( m_off > 0){ 176 }else if( m_off > 0){
175 cg2.setColor(QColorGroup::Text, QColor(green ) ); 177 cg2.setColor(QColorGroup::Text, QColor(green ) );
176 } 178 }
177 } 179 }
178 QTableItem::paint(p, cg2, cr, selected ); 180 QTableItem::paint(p, cg2, cr, selected );
179 /* restore default color */ 181 /* restore default color */
180 cg2.setColor(QColorGroup::Text, text ); 182 cg2.setColor(QColorGroup::Text, text );
181} 183}