author | drw <drw> | 2003-05-20 01:12:44 (UTC) |
---|---|---|
committer | drw <drw> | 2003-05-20 01:12:44 (UTC) |
commit | 9fc801668f8a8b6534a1262170b4a93cb7833b4a (patch) (unidiff) | |
tree | 62bd9855368992eda78f2ea1dd2f1bd97e1a5b3c | |
parent | 5e86b57756459ebab4e0df224b833a38ec9ba223 (diff) | |
download | opie-9fc801668f8a8b6534a1262170b4a93cb7833b4a.zip opie-9fc801668f8a8b6534a1262170b4a93cb7833b4a.tar.gz opie-9fc801668f8a8b6534a1262170b4a93cb7833b4a.tar.bz2 |
Apply davipt's patch for datebook's week view (needed for proper translation of day abbreviations for Tuesday and Thursday). If looks good, should apply to 0.99
-rw-r--r-- | core/pim/datebook/datebookweek.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp index e49ed28..2ad7aa9 100644 --- a/core/pim/datebook/datebookweek.cpp +++ b/core/pim/datebook/datebookweek.cpp | |||
@@ -47,131 +47,131 @@ DateBookWeekItem::DateBookWeekItem( const EffectiveEvent e ) | |||
47 | c = Qt::green; | 47 | c = Qt::green; |
48 | } else { | 48 | } else { |
49 | c = ev.event().hasAlarm() ? Qt::red : Qt::blue; | 49 | c = ev.event().hasAlarm() ? Qt::red : Qt::blue; |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | void DateBookWeekItem::setGeometry( int x, int y, int w, int h ) | 53 | void DateBookWeekItem::setGeometry( int x, int y, int w, int h ) |
54 | { | 54 | { |
55 | r.setRect( x, y, w, h ); | 55 | r.setRect( x, y, w, h ); |
56 | } | 56 | } |
57 | 57 | ||
58 | 58 | ||
59 | //------------------=--------------------------------------------- | 59 | //------------------=--------------------------------------------- |
60 | 60 | ||
61 | DateBookWeekView::DateBookWeekView( bool ap, bool startOnMonday, | 61 | DateBookWeekView::DateBookWeekView( bool ap, bool startOnMonday, |
62 | QWidget *parent, const char *name ) | 62 | QWidget *parent, const char *name ) |
63 | : QScrollView( parent, name ), ampm( ap ), bOnMonday( startOnMonday ), | 63 | : QScrollView( parent, name ), ampm( ap ), bOnMonday( startOnMonday ), |
64 | showingEvent( false ) | 64 | showingEvent( false ) |
65 | { | 65 | { |
66 | items.setAutoDelete( true ); | 66 | items.setAutoDelete( true ); |
67 | 67 | ||
68 | viewport()->setBackgroundMode( PaletteBase ); | 68 | viewport()->setBackgroundMode( PaletteBase ); |
69 | 69 | ||
70 | header = new QHeader( this ); | 70 | header = new QHeader( this ); |
71 | header->addLabel( "" ); | 71 | header->addLabel( "" ); |
72 | 72 | ||
73 | header->setMovingEnabled( false ); | 73 | header->setMovingEnabled( false ); |
74 | header->setResizeEnabled( false ); | 74 | header->setResizeEnabled( false ); |
75 | header->setClickEnabled( false, 0 ); | 75 | header->setClickEnabled( false, 0 ); |
76 | initNames(); | 76 | initNames(); |
77 | 77 | ||
78 | 78 | ||
79 | connect( header, SIGNAL(clicked(int)), this, SIGNAL(showDay(int)) ); | 79 | connect( header, SIGNAL(clicked(int)), this, SIGNAL(showDay(int)) ); |
80 | 80 | ||
81 | QObject::connect(qApp, SIGNAL(clockChanged(bool)), | 81 | QObject::connect(qApp, SIGNAL(clockChanged(bool)), |
82 | this, SLOT(slotChangeClock(bool))); | 82 | this, SLOT(slotChangeClock(bool))); |
83 | 83 | ||
84 | QFontMetrics fm( font() ); | 84 | QFontMetrics fm( font() ); |
85 | rowHeight = fm.height()+2; | 85 | rowHeight = fm.height()+2; |
86 | 86 | ||
87 | resizeContents( width(), 24*rowHeight ); | 87 | resizeContents( width(), 24*rowHeight ); |
88 | } | 88 | } |
89 | 89 | ||
90 | void DateBookWeekView::initNames() | 90 | void DateBookWeekView::initNames() |
91 | { | 91 | { |
92 | static bool bFirst = true; | 92 | static bool bFirst = true; |
93 | if ( bFirst ) { | 93 | if ( bFirst ) { |
94 | if ( bOnMonday ) { | 94 | if ( bOnMonday ) { |
95 | header->addLabel( tr("M", "Monday" ) ); | 95 | header->addLabel( tr("Mo", "Monday" ) ); |
96 | header->addLabel( tr("T", "Tuesday") ); | 96 | header->addLabel( tr("Tu", "Tuesday") ); |
97 | header->addLabel( tr("W", "Wednesday" ) ); | 97 | header->addLabel( tr("We", "Wednesday" ) ); |
98 | header->addLabel( tr("T", "Thursday" ) ); | 98 | header->addLabel( tr("Th", "Thursday" ) ); |
99 | header->addLabel( tr("F", "Friday" ) ); | 99 | header->addLabel( tr("Fr", "Friday" ) ); |
100 | header->addLabel( tr("S", "Saturday" ) ); | 100 | header->addLabel( tr("Sa", "Saturday" ) ); |
101 | header->addLabel( tr("S", "Sunday" ) ); | 101 | header->addLabel( tr("Su", "Sunday" ) ); |
102 | } else { | 102 | } else { |
103 | header->addLabel( tr("S", "Sunday" ) ); | 103 | header->addLabel( tr("Su", "Sunday" ) ); |
104 | header->addLabel( tr("M", "Monday") ); | 104 | header->addLabel( tr("Mo", "Monday") ); |
105 | header->addLabel( tr("T", "Tuesday") ); | 105 | header->addLabel( tr("Tu", "Tuesday") ); |
106 | header->addLabel( tr("W", "Wednesday" ) ); | 106 | header->addLabel( tr("We", "Wednesday" ) ); |
107 | header->addLabel( tr("T", "Thursday" ) ); | 107 | header->addLabel( tr("Th", "Thursday" ) ); |
108 | header->addLabel( tr("F", "Friday" ) ); | 108 | header->addLabel( tr("Fr", "Friday" ) ); |
109 | header->addLabel( tr("S", "Saturday" ) ); | 109 | header->addLabel( tr("Sa", "Saturday" ) ); |
110 | } | 110 | } |
111 | bFirst = false; | 111 | bFirst = false; |
112 | } else { | 112 | } else { |
113 | // we are change things... | 113 | // we are change things... |
114 | if ( bOnMonday ) { | 114 | if ( bOnMonday ) { |
115 | header->setLabel( 1, tr("M", "Monday") ); | 115 | header->setLabel( 1, tr("Mo", "Monday") ); |
116 | header->setLabel( 2, tr("T", "Tuesday") ); | 116 | header->setLabel( 2, tr("Tu", "Tuesday") ); |
117 | header->setLabel( 3, tr("W", "Wednesday" ) ); | 117 | header->setLabel( 3, tr("We", "Wednesday" ) ); |
118 | header->setLabel( 4, tr("T", "Thursday" ) ); | 118 | header->setLabel( 4, tr("Th", "Thursday" ) ); |
119 | header->setLabel( 5, tr("F", "Friday" ) ); | 119 | header->setLabel( 5, tr("Fr", "Friday" ) ); |
120 | header->setLabel( 6, tr("S", "Saturday" ) ); | 120 | header->setLabel( 6, tr("Sa", "Saturday" ) ); |
121 | header->setLabel( 7, tr("S", "Sunday" ) ); | 121 | header->setLabel( 7, tr("Su", "Sunday" ) ); |
122 | } else { | 122 | } else { |
123 | header->setLabel( 1, tr("S", "Sunday" ) ); | 123 | header->setLabel( 1, tr("Su", "Sunday" ) ); |
124 | header->setLabel( 2, tr("M", "Monday") ); | 124 | header->setLabel( 2, tr("Mo", "Monday") ); |
125 | header->setLabel( 3, tr("T", "Tuesday") ); | 125 | header->setLabel( 3, tr("Tu", "Tuesday") ); |
126 | header->setLabel( 4, tr("W", "Wednesday" ) ); | 126 | header->setLabel( 4, tr("We", "Wednesday" ) ); |
127 | header->setLabel( 5, tr("T", "Thursday" ) ); | 127 | header->setLabel( 5, tr("Th", "Thursday" ) ); |
128 | header->setLabel( 6, tr("F", "Friday" ) ); | 128 | header->setLabel( 6, tr("Fr", "Friday" ) ); |
129 | header->setLabel( 7, tr("S", "Saturday" ) ); | 129 | header->setLabel( 7, tr("Sa", "Saturday" ) ); |
130 | } | 130 | } |
131 | } | 131 | } |
132 | } | 132 | } |
133 | 133 | ||
134 | 134 | ||
135 | 135 | ||
136 | void DateBookWeekView::showEvents( QValueList<EffectiveEvent> &ev ) | 136 | void DateBookWeekView::showEvents( QValueList<EffectiveEvent> &ev ) |
137 | { | 137 | { |
138 | items.clear(); | 138 | items.clear(); |
139 | QValueListIterator<EffectiveEvent> it; | 139 | QValueListIterator<EffectiveEvent> it; |
140 | for ( it = ev.begin(); it != ev.end(); ++it ) { | 140 | for ( it = ev.begin(); it != ev.end(); ++it ) { |
141 | DateBookWeekItem *i = new DateBookWeekItem( *it ); | 141 | DateBookWeekItem *i = new DateBookWeekItem( *it ); |
142 | if(!((i->event().end().hour()==0) && (i->event().end().minute()==0) && (i->event().startDate()!=i->event().date()))) {// Skip events ending at 00:00 starting at another day. | 142 | if(!((i->event().end().hour()==0) && (i->event().end().minute()==0) && (i->event().startDate()!=i->event().date()))) {// Skip events ending at 00:00 starting at another day. |
143 | positionItem( i ); | 143 | positionItem( i ); |
144 | items.append( i ); | 144 | items.append( i ); |
145 | } | 145 | } |
146 | } | 146 | } |
147 | viewport()->update(); | 147 | viewport()->update(); |
148 | } | 148 | } |
149 | 149 | ||
150 | void DateBookWeekView::moveToHour( int h ) | 150 | void DateBookWeekView::moveToHour( int h ) |
151 | { | 151 | { |
152 | int offset = h*rowHeight; | 152 | int offset = h*rowHeight; |
153 | setContentsPos( 0, offset ); | 153 | setContentsPos( 0, offset ); |
154 | } | 154 | } |
155 | 155 | ||
156 | void DateBookWeekView::keyPressEvent( QKeyEvent *e ) | 156 | void DateBookWeekView::keyPressEvent( QKeyEvent *e ) |
157 | { | 157 | { |
158 | e->ignore(); | 158 | e->ignore(); |
159 | } | 159 | } |
160 | 160 | ||
161 | void DateBookWeekView::slotChangeClock( bool c ) | 161 | void DateBookWeekView::slotChangeClock( bool c ) |
162 | { | 162 | { |
163 | ampm = c; | 163 | ampm = c; |
164 | viewport()->update(); | 164 | viewport()->update(); |
165 | } | 165 | } |
166 | 166 | ||
167 | static inline int db_round30min( int m ) | 167 | static inline int db_round30min( int m ) |
168 | { | 168 | { |
169 | if ( m < 15 ) | 169 | if ( m < 15 ) |
170 | m = 0; | 170 | m = 0; |
171 | else if ( m < 45 ) | 171 | else if ( m < 45 ) |
172 | m = 1; | 172 | m = 1; |
173 | else | 173 | else |
174 | m = 2; | 174 | m = 2; |
175 | 175 | ||
176 | return m; | 176 | return m; |
177 | } | 177 | } |