author | zautrix <zautrix> | 2004-09-17 01:24:06 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-17 01:24:06 (UTC) |
commit | 35bc43cd453ab3f318e9a551670f6183d3001314 (patch) (unidiff) | |
tree | 2f5137a6e5efa8cd5b50cc7d40fe37c403517903 | |
parent | 0461502d8a19961121206e89ae4bc5b6b8a91a57 (diff) | |
download | kdepimpi-35bc43cd453ab3f318e9a551670f6183d3001314.zip kdepimpi-35bc43cd453ab3f318e9a551670f6183d3001314.tar.gz kdepimpi-35bc43cd453ab3f318e9a551670f6183d3001314.tar.bz2 |
include fixes
-rw-r--r-- | korganizer/koagendaitem.cpp | 2 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index a39feb1..f027343 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -1,426 +1,426 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qlabel.h> | 20 | #include <qlabel.h> |
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | #include <qhbox.h> | 22 | #include <qhbox.h> |
23 | #include <qvbox.h> | 23 | #include <qvbox.h> |
24 | #include <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qwhatsthis.h> | 25 | #include <qwhatsthis.h> |
26 | #include <qdragobject.h> | 26 | #include <qdragobject.h> |
27 | #include <qdrawutil.h> | 27 | #include <qdrawutil.h> |
28 | #include <qpainter.h> | 28 | #include <qpainter.h> |
29 | 29 | ||
30 | #include <kiconloader.h> | 30 | #include <kiconloader.h> |
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <kglobal.h> | 32 | #include <kglobal.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #ifndef DESKTOP_VERSION | 34 | #ifndef DESKTOP_VERSION |
35 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.h> |
36 | #define AGENDA_ICON_SIZE 5 | 36 | #define AGENDA_ICON_SIZE 5 |
37 | #else | 37 | #else |
38 | #define AGENDA_ICON_SIZE 7 | 38 | #define AGENDA_ICON_SIZE 7 |
39 | #endif | 39 | #endif |
40 | #include <libkcal/icaldrag.h> | 40 | #include <libkcal/icaldrag.h> |
41 | #include <libkcal/vcaldrag.h> | 41 | #include <libkcal/vcaldrag.h> |
42 | #include <libkdepim/kincidenceformatter.h> | 42 | #include <libkcal/kincidenceformatter.h> |
43 | extern int globalFlagBlockAgenda; | 43 | extern int globalFlagBlockAgenda; |
44 | extern int globalFlagBlockAgendaItemPaint; | 44 | extern int globalFlagBlockAgendaItemPaint; |
45 | extern int globalFlagBlockAgendaItemUpdate; | 45 | extern int globalFlagBlockAgendaItemUpdate; |
46 | 46 | ||
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | 48 | ||
49 | #include "koagendaitem.h" | 49 | #include "koagendaitem.h" |
50 | //#include "koagendaitem.moc" | 50 | //#include "koagendaitem.moc" |
51 | 51 | ||
52 | 52 | ||
53 | //-------------------------------------------------------------------------- | 53 | //-------------------------------------------------------------------------- |
54 | 54 | ||
55 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; | 55 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; |
56 | 56 | ||
57 | //-------------------------------------------------------------------------- | 57 | //-------------------------------------------------------------------------- |
58 | 58 | ||
59 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, | 59 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, |
60 | const char *name,WFlags) : | 60 | const char *name,WFlags) : |
61 | QWidget(parent, name), mIncidence(incidence), mDate(qd) | 61 | QWidget(parent, name), mIncidence(incidence), mDate(qd) |
62 | { | 62 | { |
63 | #ifndef DESKTOP_VERSION | 63 | #ifndef DESKTOP_VERSION |
64 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 64 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
65 | #endif | 65 | #endif |
66 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase | 66 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase |
67 | setWFlags ( wflags); | 67 | setWFlags ( wflags); |
68 | mAllDay = allday; | 68 | mAllDay = allday; |
69 | init ( incidence, qd ); | 69 | init ( incidence, qd ); |
70 | setMouseTracking(true); | 70 | setMouseTracking(true); |
71 | //setAcceptDrops(true); | 71 | //setAcceptDrops(true); |
72 | xPaintCoord = -1; | 72 | xPaintCoord = -1; |
73 | yPaintCoord = -1; | 73 | yPaintCoord = -1; |
74 | } | 74 | } |
75 | 75 | ||
76 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | 76 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) |
77 | { | 77 | { |
78 | mIncidence = incidence; | 78 | mIncidence = incidence; |
79 | mDate = qd; | 79 | mDate = qd; |
80 | mFirstMultiItem = 0; | 80 | mFirstMultiItem = 0; |
81 | mNextMultiItem = 0; | 81 | mNextMultiItem = 0; |
82 | mLastMultiItem = 0; | 82 | mLastMultiItem = 0; |
83 | computeText(); | 83 | computeText(); |
84 | 84 | ||
85 | if ( (incidence->type() == "Todo") && | 85 | if ( (incidence->type() == "Todo") && |
86 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && | 86 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && |
87 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { | 87 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { |
88 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) | 88 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) |
89 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; | 89 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; |
90 | else | 90 | else |
91 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; | 91 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; |
92 | } | 92 | } |
93 | else { | 93 | else { |
94 | QStringList categories = mIncidence->categories(); | 94 | QStringList categories = mIncidence->categories(); |
95 | QString cat = categories.first(); | 95 | QString cat = categories.first(); |
96 | if (cat.isEmpty()) { | 96 | if (cat.isEmpty()) { |
97 | mBackgroundColor =KOPrefs::instance()->mEventColor; | 97 | mBackgroundColor =KOPrefs::instance()->mEventColor; |
98 | } else { | 98 | } else { |
99 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); | 99 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | mColorGroup = QColorGroup( mBackgroundColor.light(), | 102 | mColorGroup = QColorGroup( mBackgroundColor.light(), |
103 | mBackgroundColor.dark(),mBackgroundColor.light(), | 103 | mBackgroundColor.dark(),mBackgroundColor.light(), |
104 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; | 104 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; |
105 | setBackgroundColor( mBackgroundColor ); | 105 | setBackgroundColor( mBackgroundColor ); |
106 | 106 | ||
107 | setCellXY(0,0,1); | 107 | setCellXY(0,0,1); |
108 | setCellXWidth(0); | 108 | setCellXWidth(0); |
109 | setSubCell(0); | 109 | setSubCell(0); |
110 | setSubCells(1); | 110 | setSubCells(1); |
111 | setMultiItem(0,0,0); | 111 | setMultiItem(0,0,0); |
112 | startMove(); | 112 | startMove(); |
113 | mSelected = true; | 113 | mSelected = true; |
114 | select(false); | 114 | select(false); |
115 | QString tipText = mIncidence->summary(); | 115 | QString tipText = mIncidence->summary(); |
116 | // QToolTip::add(this,tipText); | 116 | // QToolTip::add(this,tipText); |
117 | QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); | 117 | QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); |
118 | if ( !mIncidence->doesFloat() ) | 118 | if ( !mIncidence->doesFloat() ) |
119 | if ( mIncidence->type() == "Event" ) { | 119 | if ( mIncidence->type() == "Event" ) { |
120 | if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { | 120 | if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { |
121 | tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); | 121 | tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); |
122 | tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); | 122 | tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); |
123 | } | 123 | } |
124 | else { | 124 | else { |
125 | tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); | 125 | tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); |
126 | tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); | 126 | tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); |
127 | } | 127 | } |
128 | } | 128 | } |
129 | else if ( mIncidence->type() == "Todo" ) { | 129 | else if ( mIncidence->type() == "Todo" ) { |
130 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueTimeStr(); | 130 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueTimeStr(); |
131 | } | 131 | } |
132 | 132 | ||
133 | if (!mIncidence->location().isEmpty()) { | 133 | if (!mIncidence->location().isEmpty()) { |
134 | tipText += "\n"+i18n("Location: ")+mIncidence->location(); | 134 | tipText += "\n"+i18n("Location: ")+mIncidence->location(); |
135 | } | 135 | } |
136 | QToolTip::add(this,tipText,toolTipGroup(),""); | 136 | QToolTip::add(this,tipText,toolTipGroup(),""); |
137 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); | 137 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); |
138 | mFontPixelSize = fontinf.height();; | 138 | mFontPixelSize = fontinf.height();; |
139 | hide(); | 139 | hide(); |
140 | xPaintCoord = -1; | 140 | xPaintCoord = -1; |
141 | yPaintCoord = -1; | 141 | yPaintCoord = -1; |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | KOAgendaItem::~KOAgendaItem() | 145 | KOAgendaItem::~KOAgendaItem() |
146 | { | 146 | { |
147 | // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); | 147 | // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); |
148 | 148 | ||
149 | } | 149 | } |
150 | 150 | ||
151 | void KOAgendaItem::recreateIncidence() | 151 | void KOAgendaItem::recreateIncidence() |
152 | { | 152 | { |
153 | Incidence* newInc = mIncidence->clone(); | 153 | Incidence* newInc = mIncidence->clone(); |
154 | newInc->recreate(); | 154 | newInc->recreate(); |
155 | if ( mIncidence->doesRecur() ) { | 155 | if ( mIncidence->doesRecur() ) { |
156 | mIncidence->addExDate( mDate ); | 156 | mIncidence->addExDate( mDate ); |
157 | newInc->recurrence()->unsetRecurs(); | 157 | newInc->recurrence()->unsetRecurs(); |
158 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); | 158 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); |
159 | QTime tim = mIncidence->dtStart().time(); | 159 | QTime tim = mIncidence->dtStart().time(); |
160 | newInc->setDtStart( QDateTime(mDate, tim) ); | 160 | newInc->setDtStart( QDateTime(mDate, tim) ); |
161 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 161 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
162 | } | 162 | } |
163 | mIncidence = newInc; | 163 | mIncidence = newInc; |
164 | } | 164 | } |
165 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) | 165 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) |
166 | { | 166 | { |
167 | int size = AGENDA_ICON_SIZE; | 167 | int size = AGENDA_ICON_SIZE; |
168 | 168 | ||
169 | int yOff = 0; | 169 | int yOff = 0; |
170 | int xOff = 0; | 170 | int xOff = 0; |
171 | int x = pos().x() +3; | 171 | int x = pos().x() +3; |
172 | int y; | 172 | int y; |
173 | if ( mAllDay ) | 173 | if ( mAllDay ) |
174 | y = pos().y()+3; | 174 | y = pos().y()+3; |
175 | else | 175 | else |
176 | y = mCellYTop * ( height() / cellHeight() ) +3; | 176 | y = mCellYTop * ( height() / cellHeight() ) +3; |
177 | if (mIncidence->cancelled()) { | 177 | if (mIncidence->cancelled()) { |
178 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; | 178 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; |
179 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; | 179 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; |
180 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); | 180 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); |
181 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); | 181 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); |
182 | if ( horLayout ) | 182 | if ( horLayout ) |
183 | ++xOff; | 183 | ++xOff; |
184 | else | 184 | else |
185 | ++yOff; | 185 | ++yOff; |
186 | } | 186 | } |
187 | if (mIncidence->isAlarmEnabled()) { | 187 | if (mIncidence->isAlarmEnabled()) { |
188 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); | 188 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); |
189 | if ( horLayout ) | 189 | if ( horLayout ) |
190 | ++xOff; | 190 | ++xOff; |
191 | else | 191 | else |
192 | ++yOff; | 192 | ++yOff; |
193 | } | 193 | } |
194 | if (mIncidence->recurrence()->doesRecur()) { | 194 | if (mIncidence->recurrence()->doesRecur()) { |
195 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); | 195 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); |
196 | if ( horLayout ) | 196 | if ( horLayout ) |
197 | ++xOff; | 197 | ++xOff; |
198 | else | 198 | else |
199 | ++yOff; | 199 | ++yOff; |
200 | } | 200 | } |
201 | if (mIncidence->description().length() > 0) { | 201 | if (mIncidence->description().length() > 0) { |
202 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); | 202 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); |
203 | if ( horLayout ) | 203 | if ( horLayout ) |
204 | ++xOff; | 204 | ++xOff; |
205 | else | 205 | else |
206 | ++yOff; | 206 | ++yOff; |
207 | } | 207 | } |
208 | if (mIncidence->isReadOnly()) { | 208 | if (mIncidence->isReadOnly()) { |
209 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); | 209 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); |
210 | if ( horLayout ) | 210 | if ( horLayout ) |
211 | ++xOff; | 211 | ++xOff; |
212 | else | 212 | else |
213 | ++yOff; | 213 | ++yOff; |
214 | } | 214 | } |
215 | 215 | ||
216 | if (mIncidence->attendeeCount()>0) { | 216 | if (mIncidence->attendeeCount()>0) { |
217 | 217 | ||
218 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { | 218 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { |
219 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); | 219 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); |
220 | if ( horLayout ) | 220 | if ( horLayout ) |
221 | ++xOff; | 221 | ++xOff; |
222 | else | 222 | else |
223 | ++yOff; | 223 | ++yOff; |
224 | } else { | 224 | } else { |
225 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 225 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
226 | if (me!=0) { | 226 | if (me!=0) { |
227 | 227 | ||
228 | 228 | ||
229 | } else { | 229 | } else { |
230 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); | 230 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); |
231 | if ( horLayout ) | 231 | if ( horLayout ) |
232 | ++xOff; | 232 | ++xOff; |
233 | else | 233 | else |
234 | ++yOff; | 234 | ++yOff; |
235 | 235 | ||
236 | } | 236 | } |
237 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); | 237 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); |
238 | if ( horLayout ) | 238 | if ( horLayout ) |
239 | ++xOff; | 239 | ++xOff; |
240 | else | 240 | else |
241 | ++yOff; | 241 | ++yOff; |
242 | 242 | ||
243 | } | 243 | } |
244 | 244 | ||
245 | } | 245 | } |
246 | return ( yOff || xOff ); | 246 | return ( yOff || xOff ); |
247 | } | 247 | } |
248 | 248 | ||
249 | 249 | ||
250 | void KOAgendaItem::select(bool selected) | 250 | void KOAgendaItem::select(bool selected) |
251 | { | 251 | { |
252 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); | 252 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); |
253 | if (mSelected == selected) return; | 253 | if (mSelected == selected) return; |
254 | mSelected = selected; | 254 | mSelected = selected; |
255 | if ( ! isVisible() ) | 255 | if ( ! isVisible() ) |
256 | return; | 256 | return; |
257 | if ( firstMultiItem() ) | 257 | if ( firstMultiItem() ) |
258 | firstMultiItem()->select( selected ); | 258 | firstMultiItem()->select( selected ); |
259 | if ( !firstMultiItem() && nextMultiItem() ) { | 259 | if ( !firstMultiItem() && nextMultiItem() ) { |
260 | KOAgendaItem * placeItem = nextMultiItem(); | 260 | KOAgendaItem * placeItem = nextMultiItem(); |
261 | while ( placeItem ) { | 261 | while ( placeItem ) { |
262 | placeItem->select( selected ); | 262 | placeItem->select( selected ); |
263 | placeItem = placeItem->nextMultiItem(); | 263 | placeItem = placeItem->nextMultiItem(); |
264 | } | 264 | } |
265 | } | 265 | } |
266 | globalFlagBlockAgendaItemUpdate = 0; | 266 | globalFlagBlockAgendaItemUpdate = 0; |
267 | paintMe( selected ); | 267 | paintMe( selected ); |
268 | globalFlagBlockAgendaItemUpdate = 1; | 268 | globalFlagBlockAgendaItemUpdate = 1; |
269 | repaint( false ); | 269 | repaint( false ); |
270 | } | 270 | } |
271 | 271 | ||
272 | 272 | ||
273 | /* | 273 | /* |
274 | The eventFilter has to filter the mouse events of the agenda item childs. The | 274 | The eventFilter has to filter the mouse events of the agenda item childs. The |
275 | events are fed into the event handling method of KOAgendaItem. This allows the | 275 | events are fed into the event handling method of KOAgendaItem. This allows the |
276 | KOAgenda to handle the KOAgendaItems by using an eventFilter. | 276 | KOAgenda to handle the KOAgendaItems by using an eventFilter. |
277 | */ | 277 | */ |
278 | bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) | 278 | bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) |
279 | { | 279 | { |
280 | if (e->type() == QEvent::MouseButtonPress || | 280 | if (e->type() == QEvent::MouseButtonPress || |
281 | e->type() == QEvent::MouseButtonDblClick || | 281 | e->type() == QEvent::MouseButtonDblClick || |
282 | e->type() == QEvent::MouseButtonRelease || | 282 | e->type() == QEvent::MouseButtonRelease || |
283 | e->type() == QEvent::MouseMove) { | 283 | e->type() == QEvent::MouseMove) { |
284 | QMouseEvent *me = (QMouseEvent *)e; | 284 | QMouseEvent *me = (QMouseEvent *)e; |
285 | QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> | 285 | QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> |
286 | mapToGlobal(me->pos())); | 286 | mapToGlobal(me->pos())); |
287 | QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); | 287 | QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); |
288 | return event(&returnEvent); | 288 | return event(&returnEvent); |
289 | } else { | 289 | } else { |
290 | return false; | 290 | return false; |
291 | } | 291 | } |
292 | } | 292 | } |
293 | void KOAgendaItem::repaintMe( ) | 293 | void KOAgendaItem::repaintMe( ) |
294 | { | 294 | { |
295 | paintMe ( mSelected ); | 295 | paintMe ( mSelected ); |
296 | } | 296 | } |
297 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) | 297 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) |
298 | { | 298 | { |
299 | if ( globalFlagBlockAgendaItemUpdate && ! selected) | 299 | if ( globalFlagBlockAgendaItemUpdate && ! selected) |
300 | return; | 300 | return; |
301 | QPainter pa; | 301 | QPainter pa; |
302 | 302 | ||
303 | if ( mSelected ) { | 303 | if ( mSelected ) { |
304 | pa.begin( paintPixSel() ); | 304 | pa.begin( paintPixSel() ); |
305 | } else { | 305 | } else { |
306 | if ( mAllDay ) | 306 | if ( mAllDay ) |
307 | pa.begin( paintPixAllday() ); | 307 | pa.begin( paintPixAllday() ); |
308 | else | 308 | else |
309 | pa.begin( paintPix() ); | 309 | pa.begin( paintPix() ); |
310 | } | 310 | } |
311 | int x, yy, w, h; | 311 | int x, yy, w, h; |
312 | float nfh; | 312 | float nfh; |
313 | x = pos().x(); w = width(); h = height (); | 313 | x = pos().x(); w = width(); h = height (); |
314 | if ( mAllDay ) | 314 | if ( mAllDay ) |
315 | yy = y(); | 315 | yy = y(); |
316 | else | 316 | else |
317 | yy = mCellYTop * ( height() / cellHeight() ); | 317 | yy = mCellYTop * ( height() / cellHeight() ); |
318 | xPaintCoord= x; | 318 | xPaintCoord= x; |
319 | yPaintCoord = yy; | 319 | yPaintCoord = yy; |
320 | wPaintCoord = width(); | 320 | wPaintCoord = width(); |
321 | hPaintCoord = height(); | 321 | hPaintCoord = height(); |
322 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); | 322 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); |
323 | if ( paint == 0 ) | 323 | if ( paint == 0 ) |
324 | paint = &pa; | 324 | paint = &pa; |
325 | bool horLayout = ( w < h ); | 325 | bool horLayout = ( w < h ); |
326 | int maxhei = mFontPixelSize+4; | 326 | int maxhei = mFontPixelSize+4; |
327 | if ( horLayout ) | 327 | if ( horLayout ) |
328 | maxhei += AGENDA_ICON_SIZE -4; | 328 | maxhei += AGENDA_ICON_SIZE -4; |
329 | bool small = ( h < maxhei ); | 329 | bool small = ( h < maxhei ); |
330 | if ( ! small ) | 330 | if ( ! small ) |
331 | paint->setFont(KOPrefs::instance()->mAgendaViewFont); | 331 | paint->setFont(KOPrefs::instance()->mAgendaViewFont); |
332 | else { | 332 | else { |
333 | QFont f = KOPrefs::instance()->mAgendaViewFont; | 333 | QFont f = KOPrefs::instance()->mAgendaViewFont; |
334 | f.setBold( false ); | 334 | f.setBold( false ); |
335 | int fh = f.pointSize(); | 335 | int fh = f.pointSize(); |
336 | nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; | 336 | nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; |
337 | if ( nfh < 6 ) | 337 | if ( nfh < 6 ) |
338 | nfh = 6; | 338 | nfh = 6; |
339 | f.setPointSize( nfh ); | 339 | f.setPointSize( nfh ); |
340 | paint->setFont(f); | 340 | paint->setFont(f); |
341 | } | 341 | } |
342 | paint->fillRect ( x, yy, w, h, mBackgroundColor ); | 342 | paint->fillRect ( x, yy, w, h, mBackgroundColor ); |
343 | static const QPixmap completedPxmp = SmallIcon("greenhook16"); | 343 | static const QPixmap completedPxmp = SmallIcon("greenhook16"); |
344 | static const QPixmap overduePxmp = SmallIcon("redcross16"); | 344 | static const QPixmap overduePxmp = SmallIcon("redcross16"); |
345 | if ( mIncidence->type() == "Todo" ) { | 345 | if ( mIncidence->type() == "Todo" ) { |
346 | Todo* tempTodo = static_cast<Todo*>(mIncidence); | 346 | Todo* tempTodo = static_cast<Todo*>(mIncidence); |
347 | int xx = pos().x()+(width()-completedPxmp.width()-3 ); | 347 | int xx = pos().x()+(width()-completedPxmp.width()-3 ); |
348 | int yyy = yy+3; | 348 | int yyy = yy+3; |
349 | if ( tempTodo->isCompleted() ) | 349 | if ( tempTodo->isCompleted() ) |
350 | paint->drawPixmap ( xx, yyy, completedPxmp ); | 350 | paint->drawPixmap ( xx, yyy, completedPxmp ); |
351 | else { | 351 | else { |
352 | paint->drawPixmap ( xx, yyy, overduePxmp ); | 352 | paint->drawPixmap ( xx, yyy, overduePxmp ); |
353 | 353 | ||
354 | } | 354 | } |
355 | } | 355 | } |
356 | bool addIcon = false; | 356 | bool addIcon = false; |
357 | if ( ! small || w > 3 * h || h > 3* w ) | 357 | if ( ! small || w > 3 * h || h > 3* w ) |
358 | addIcon = updateIcons( paint, horLayout ); | 358 | addIcon = updateIcons( paint, horLayout ); |
359 | 359 | ||
360 | qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); | 360 | qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); |
361 | //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); | 361 | //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); |
362 | if ( ! small ) { | 362 | if ( ! small ) { |
363 | x += 3; yy += 3;w -= 6; h-= 5; | 363 | x += 3; yy += 3;w -= 6; h-= 5; |
364 | } else { | 364 | } else { |
365 | x += 2; yy += 1;w -= 4; h-= 4; | 365 | x += 2; yy += 1;w -= 4; h-= 4; |
366 | if ( nfh < 6.01 ) { | 366 | if ( nfh < 6.01 ) { |
367 | yy -= 2; | 367 | yy -= 2; |
368 | h += 4; | 368 | h += 4; |
369 | } | 369 | } |
370 | else | 370 | else |
371 | if ( nfh < h -2 ) | 371 | if ( nfh < h -2 ) |
372 | ++yy; | 372 | ++yy; |
373 | } | 373 | } |
374 | int align; | 374 | int align; |
375 | #ifndef DESKTOP_VERSION | 375 | #ifndef DESKTOP_VERSION |
376 | align = ( AlignLeft|WordBreak|AlignTop); | 376 | align = ( AlignLeft|WordBreak|AlignTop); |
377 | #else | 377 | #else |
378 | align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 378 | align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
379 | #endif | 379 | #endif |
380 | if ( addIcon ) { | 380 | if ( addIcon ) { |
381 | if ( ! horLayout ) { | 381 | if ( ! horLayout ) { |
382 | x += AGENDA_ICON_SIZE+3; | 382 | x += AGENDA_ICON_SIZE+3; |
383 | w -= (AGENDA_ICON_SIZE+3); | 383 | w -= (AGENDA_ICON_SIZE+3); |
384 | } | 384 | } |
385 | else { | 385 | else { |
386 | yy+= AGENDA_ICON_SIZE+2; | 386 | yy+= AGENDA_ICON_SIZE+2; |
387 | h -=(AGENDA_ICON_SIZE+3); | 387 | h -=(AGENDA_ICON_SIZE+3); |
388 | } | 388 | } |
389 | } | 389 | } |
390 | int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue(); | 390 | int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue(); |
391 | if ( colsum < 250 ) | 391 | if ( colsum < 250 ) |
392 | paint->setPen ( white); | 392 | paint->setPen ( white); |
393 | if ( x < 0 ) { | 393 | if ( x < 0 ) { |
394 | w = w+x-3; | 394 | w = w+x-3; |
395 | x = 3; | 395 | x = 3; |
396 | if ( w > parentWidget()->width() ){ | 396 | if ( w > parentWidget()->width() ){ |
397 | w = parentWidget()->width() - 6; | 397 | w = parentWidget()->width() - 6; |
398 | #ifndef DESKTOP_VERSION | 398 | #ifndef DESKTOP_VERSION |
399 | align = ( AlignCenter|WordBreak); | 399 | align = ( AlignCenter|WordBreak); |
400 | #else | 400 | #else |
401 | align = ( AlignCenter|BreakAnywhere|WordBreak); | 401 | align = ( AlignCenter|BreakAnywhere|WordBreak); |
402 | #endif | 402 | #endif |
403 | 403 | ||
404 | } | 404 | } |
405 | } | 405 | } |
406 | QRect dr; | 406 | QRect dr; |
407 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); | 407 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); |
408 | if ( mIncidence->cancelled() ){ | 408 | if ( mIncidence->cancelled() ){ |
409 | if ( ! small ) { | 409 | if ( ! small ) { |
410 | QFontMetrics fm ( paint->font() ); | 410 | QFontMetrics fm ( paint->font() ); |
411 | paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); | 411 | paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); |
412 | } | 412 | } |
413 | 413 | ||
414 | } | 414 | } |
415 | pa.end(); | 415 | pa.end(); |
416 | 416 | ||
417 | } | 417 | } |
418 | void KOAgendaItem::resizePixmap( int w , int h ) | 418 | void KOAgendaItem::resizePixmap( int w , int h ) |
419 | { | 419 | { |
420 | paintPix()->resize( w, h ); | 420 | paintPix()->resize( w, h ); |
421 | paintPixSel()->resize( w, h ); | 421 | paintPixSel()->resize( w, h ); |
422 | 422 | ||
423 | } | 423 | } |
424 | QPixmap * KOAgendaItem::paintPix() | 424 | QPixmap * KOAgendaItem::paintPix() |
425 | { | 425 | { |
426 | static QPixmap* mPaintPix = 0; | 426 | static QPixmap* mPaintPix = 0; |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index df60564..688d9e1 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1,436 +1,436 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qpopupmenu.h> | 20 | #include <qpopupmenu.h> |
21 | #include <qfont.h> | 21 | #include <qfont.h> |
22 | #include <qfontmetrics.h> | 22 | #include <qfontmetrics.h> |
23 | #include <qkeycode.h> | 23 | #include <qkeycode.h> |
24 | #include <qhbox.h> | 24 | #include <qhbox.h> |
25 | #include <qvbox.h> | 25 | #include <qvbox.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qtooltip.h> | 27 | #include <qtooltip.h> |
28 | #include <qpainter.h> | 28 | #include <qpainter.h> |
29 | #include <qwhatsthis.h> | 29 | #include <qwhatsthis.h> |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #else | 32 | #else |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #include <kdebug.h> | 36 | #include <kdebug.h> |
37 | #include <klocale.h> | 37 | #include <klocale.h> |
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kconfig.h> | 39 | #include <kconfig.h> |
40 | #include <kiconloader.h> | 40 | #include <kiconloader.h> |
41 | 41 | ||
42 | #include <kcalendarsystem.h> | 42 | #include <kcalendarsystem.h> |
43 | 43 | ||
44 | #ifndef KORG_NOPRINTER | 44 | #ifndef KORG_NOPRINTER |
45 | #include "calprinter.h" | 45 | #include "calprinter.h" |
46 | #endif | 46 | #endif |
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | #ifndef KORG_NOPLUGINS | 48 | #ifndef KORG_NOPLUGINS |
49 | #include "kocore.h" | 49 | #include "kocore.h" |
50 | #endif | 50 | #endif |
51 | #include "koglobals.h" | 51 | #include "koglobals.h" |
52 | #include <libkdepim/kincidenceformatter.h> | 52 | #include <libkcal/kincidenceformatter.h> |
53 | 53 | ||
54 | #include "komonthview.h" | 54 | #include "komonthview.h" |
55 | 55 | ||
56 | #define PIXMAP_SIZE 5 | 56 | #define PIXMAP_SIZE 5 |
57 | 57 | ||
58 | class KNOWhatsThis :public QWhatsThis | 58 | class KNOWhatsThis :public QWhatsThis |
59 | { | 59 | { |
60 | public: | 60 | public: |
61 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; | 61 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; |
62 | 62 | ||
63 | protected: | 63 | protected: |
64 | virtual QString text( const QPoint& p) | 64 | virtual QString text( const QPoint& p) |
65 | { | 65 | { |
66 | return _wid->getWhatsThisText(p) ; | 66 | return _wid->getWhatsThisText(p) ; |
67 | }; | 67 | }; |
68 | private: | 68 | private: |
69 | KNoScrollListBox* _wid; | 69 | KNoScrollListBox* _wid; |
70 | 70 | ||
71 | }; | 71 | }; |
72 | 72 | ||
73 | 73 | ||
74 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) | 74 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) |
75 | : QListBox(parent, name) | 75 | : QListBox(parent, name) |
76 | { | 76 | { |
77 | #ifndef DESKTOP_VERSION | 77 | #ifndef DESKTOP_VERSION |
78 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 78 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
79 | #endif | 79 | #endif |
80 | new KNOWhatsThis(this); | 80 | new KNOWhatsThis(this); |
81 | } | 81 | } |
82 | 82 | ||
83 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 83 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
84 | { | 84 | { |
85 | QListBoxItem* item = itemAt ( p ); | 85 | QListBoxItem* item = itemAt ( p ); |
86 | if ( ! item ) { | 86 | if ( ! item ) { |
87 | return i18n("Click in the cell or\non the date label\nto add an event!"); | 87 | return i18n("Click in the cell or\non the date label\nto add an event!"); |
88 | } | 88 | } |
89 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); | 89 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); |
90 | } | 90 | } |
91 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 91 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
92 | { | 92 | { |
93 | 93 | ||
94 | switch(e->key()) { | 94 | switch(e->key()) { |
95 | case Key_Right: | 95 | case Key_Right: |
96 | // if ( e->state() == Qt::ControlButton ) | 96 | // if ( e->state() == Qt::ControlButton ) |
97 | { | 97 | { |
98 | e->ignore(); | 98 | e->ignore(); |
99 | return; | 99 | return; |
100 | } | 100 | } |
101 | scrollBy(4,0); | 101 | scrollBy(4,0); |
102 | break; | 102 | break; |
103 | case Key_Left: | 103 | case Key_Left: |
104 | // if ( e->state() == Qt::ControlButton ) | 104 | // if ( e->state() == Qt::ControlButton ) |
105 | { | 105 | { |
106 | e->ignore(); | 106 | e->ignore(); |
107 | return; | 107 | return; |
108 | } | 108 | } |
109 | scrollBy(-4,0); | 109 | scrollBy(-4,0); |
110 | break; | 110 | break; |
111 | case Key_Up: | 111 | case Key_Up: |
112 | if(!count()) break; | 112 | if(!count()) break; |
113 | setCurrentItem((currentItem()+count()-1)%count()); | 113 | setCurrentItem((currentItem()+count()-1)%count()); |
114 | if(!itemVisible(currentItem())) { | 114 | if(!itemVisible(currentItem())) { |
115 | if((unsigned int) currentItem() == (count()-1)) { | 115 | if((unsigned int) currentItem() == (count()-1)) { |
116 | setTopItem(currentItem()-numItemsVisible()+1); | 116 | setTopItem(currentItem()-numItemsVisible()+1); |
117 | } else { | 117 | } else { |
118 | setTopItem(topItem()-1); | 118 | setTopItem(topItem()-1); |
119 | } | 119 | } |
120 | } | 120 | } |
121 | break; | 121 | break; |
122 | case Key_Down: | 122 | case Key_Down: |
123 | if(!count()) break; | 123 | if(!count()) break; |
124 | setCurrentItem((currentItem()+1)%count()); | 124 | setCurrentItem((currentItem()+1)%count()); |
125 | if(!itemVisible(currentItem())) { | 125 | if(!itemVisible(currentItem())) { |
126 | if(currentItem() == 0) { | 126 | if(currentItem() == 0) { |
127 | setTopItem(0); | 127 | setTopItem(0); |
128 | } else { | 128 | } else { |
129 | setTopItem(topItem()+1); | 129 | setTopItem(topItem()+1); |
130 | } | 130 | } |
131 | } | 131 | } |
132 | break; | 132 | break; |
133 | case Key_Shift: | 133 | case Key_Shift: |
134 | emit shiftDown(); | 134 | emit shiftDown(); |
135 | break; | 135 | break; |
136 | default: | 136 | default: |
137 | e->ignore(); | 137 | e->ignore(); |
138 | break; | 138 | break; |
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 142 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
143 | { | 143 | { |
144 | switch(e->key()) { | 144 | switch(e->key()) { |
145 | case Key_Shift: | 145 | case Key_Shift: |
146 | emit shiftUp(); | 146 | emit shiftUp(); |
147 | break; | 147 | break; |
148 | default: | 148 | default: |
149 | break; | 149 | break; |
150 | } | 150 | } |
151 | } | 151 | } |
152 | 152 | ||
153 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 153 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
154 | { | 154 | { |
155 | QListBox::mousePressEvent(e); | 155 | QListBox::mousePressEvent(e); |
156 | 156 | ||
157 | if(e->button() == RightButton) { | 157 | if(e->button() == RightButton) { |
158 | emit rightClick(); | 158 | emit rightClick(); |
159 | } | 159 | } |
160 | } | 160 | } |
161 | 161 | ||
162 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 162 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
163 | : QListBoxItem() | 163 | : QListBoxItem() |
164 | { | 164 | { |
165 | setText( s ); | 165 | setText( s ); |
166 | 166 | ||
167 | mIncidence = incidence; | 167 | mIncidence = incidence; |
168 | mDate = qd; | 168 | mDate = qd; |
169 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); | 169 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); |
170 | mRecur = false; | 170 | mRecur = false; |
171 | mAlarm = false; | 171 | mAlarm = false; |
172 | mReply = false; | 172 | mReply = false; |
173 | mInfo = false; | 173 | mInfo = false; |
174 | } | 174 | } |
175 | 175 | ||
176 | void MonthViewItem::paint(QPainter *p) | 176 | void MonthViewItem::paint(QPainter *p) |
177 | { | 177 | { |
178 | #if QT_VERSION >= 0x030000 | 178 | #if QT_VERSION >= 0x030000 |
179 | bool sel = isSelected(); | 179 | bool sel = isSelected(); |
180 | #else | 180 | #else |
181 | bool sel = selected(); | 181 | bool sel = selected(); |
182 | #endif | 182 | #endif |
183 | 183 | ||
184 | 184 | ||
185 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) | 185 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) |
186 | { | 186 | { |
187 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 187 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
188 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 188 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
189 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); | 189 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); |
190 | } | 190 | } |
191 | int x = 1; | 191 | int x = 1; |
192 | int y = 3;//(height() - mRecurPixmap.height()) /2; | 192 | int y = 3;//(height() - mRecurPixmap.height()) /2; |
193 | int size = PIXMAP_SIZE; | 193 | int size = PIXMAP_SIZE; |
194 | if ( QApplication::desktop()->width() < 300 ) | 194 | if ( QApplication::desktop()->width() < 300 ) |
195 | size = 3; | 195 | size = 3; |
196 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 196 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
197 | if ( mInfo ) { | 197 | if ( mInfo ) { |
198 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 198 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
199 | x += size + 1; | 199 | x += size + 1; |
200 | } | 200 | } |
201 | if ( mRecur ) { | 201 | if ( mRecur ) { |
202 | p->fillRect ( x, y,size,size, Qt::blue ); | 202 | p->fillRect ( x, y,size,size, Qt::blue ); |
203 | x += size + 1; | 203 | x += size + 1; |
204 | } | 204 | } |
205 | if ( mAlarm ) { | 205 | if ( mAlarm ) { |
206 | p->fillRect ( x, y,size,size, Qt::red ); | 206 | p->fillRect ( x, y,size,size, Qt::red ); |
207 | x += size + 1; | 207 | x += size + 1; |
208 | } | 208 | } |
209 | if ( mReply ) { | 209 | if ( mReply ) { |
210 | p->fillRect ( x, y,size,size, Qt::yellow ); | 210 | p->fillRect ( x, y,size,size, Qt::yellow ); |
211 | x += size + 1; | 211 | x += size + 1; |
212 | } | 212 | } |
213 | } | 213 | } |
214 | QFontMetrics fm = p->fontMetrics(); | 214 | QFontMetrics fm = p->fontMetrics(); |
215 | int yPos; | 215 | int yPos; |
216 | int pmheight = size; | 216 | int pmheight = size; |
217 | if( pmheight < fm.height() ) | 217 | if( pmheight < fm.height() ) |
218 | yPos = fm.ascent() + fm.leading()/2; | 218 | yPos = fm.ascent() + fm.leading()/2; |
219 | else | 219 | else |
220 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 220 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
221 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 221 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
222 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 222 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
223 | p->drawText( x, yPos, text() ); | 223 | p->drawText( x, yPos, text() ); |
224 | if ( mIncidence->cancelled() ) { | 224 | if ( mIncidence->cancelled() ) { |
225 | int wid = fm.width( text() ); | 225 | int wid = fm.width( text() ); |
226 | p->drawLine( x, yPos- fm.height()/2+2,x+wid, yPos- fm.height()/2 +2); | 226 | p->drawLine( x, yPos- fm.height()/2+2,x+wid, yPos- fm.height()/2 +2); |
227 | } | 227 | } |
228 | 228 | ||
229 | } | 229 | } |
230 | 230 | ||
231 | int MonthViewItem::height(const QListBox *lb) const | 231 | int MonthViewItem::height(const QListBox *lb) const |
232 | { | 232 | { |
233 | return lb->fontMetrics().lineSpacing()+1; | 233 | return lb->fontMetrics().lineSpacing()+1; |
234 | } | 234 | } |
235 | 235 | ||
236 | int MonthViewItem::width(const QListBox *lb) const | 236 | int MonthViewItem::width(const QListBox *lb) const |
237 | { | 237 | { |
238 | int size = PIXMAP_SIZE; | 238 | int size = PIXMAP_SIZE; |
239 | if ( QApplication::desktop()->width() < 300 ) | 239 | if ( QApplication::desktop()->width() < 300 ) |
240 | size = 3; | 240 | size = 3; |
241 | int x = 1; | 241 | int x = 1; |
242 | if ( mInfo ) { | 242 | if ( mInfo ) { |
243 | x += size + 1; | 243 | x += size + 1; |
244 | } | 244 | } |
245 | if( mRecur ) { | 245 | if( mRecur ) { |
246 | x += size+1; | 246 | x += size+1; |
247 | } | 247 | } |
248 | if( mAlarm ) { | 248 | if( mAlarm ) { |
249 | x += size+1; | 249 | x += size+1; |
250 | } | 250 | } |
251 | if( mReply ) { | 251 | if( mReply ) { |
252 | x += size+1; | 252 | x += size+1; |
253 | } | 253 | } |
254 | 254 | ||
255 | return( x + lb->fontMetrics().width( text() ) + 1 ); | 255 | return( x + lb->fontMetrics().width( text() ) + 1 ); |
256 | } | 256 | } |
257 | 257 | ||
258 | 258 | ||
259 | MonthViewCell::MonthViewCell( KOMonthView *parent) | 259 | MonthViewCell::MonthViewCell( KOMonthView *parent) |
260 | : QWidget( parent ), | 260 | : QWidget( parent ), |
261 | mMonthView( parent ) | 261 | mMonthView( parent ) |
262 | { | 262 | { |
263 | 263 | ||
264 | QVBoxLayout *topLayout = new QVBoxLayout( this ); | 264 | QVBoxLayout *topLayout = new QVBoxLayout( this ); |
265 | 265 | ||
266 | // mLabel = new QLabel( this );QPushButton | 266 | // mLabel = new QLabel( this );QPushButton |
267 | mLabel = new QPushButton( this ); | 267 | mLabel = new QPushButton( this ); |
268 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 268 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
269 | //mLabel->setLineWidth( 1 ); | 269 | //mLabel->setLineWidth( 1 ); |
270 | //mLabel->setAlignment( AlignCenter ); | 270 | //mLabel->setAlignment( AlignCenter ); |
271 | mLabel->setFlat( true ); | 271 | mLabel->setFlat( true ); |
272 | mItemList = new KNoScrollListBox( this ); | 272 | mItemList = new KNoScrollListBox( this ); |
273 | mItemList->setMinimumSize( 10, 10 ); | 273 | mItemList->setMinimumSize( 10, 10 ); |
274 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 274 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
275 | mItemList->setLineWidth( 1 ); | 275 | mItemList->setLineWidth( 1 ); |
276 | topLayout->addWidget( mItemList ); | 276 | topLayout->addWidget( mItemList ); |
277 | mLabel->raise(); | 277 | mLabel->raise(); |
278 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 278 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
279 | mStandardPalette = palette(); | 279 | mStandardPalette = palette(); |
280 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); | 280 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); |
281 | 281 | ||
282 | enableScrollBars( false ); | 282 | enableScrollBars( false ); |
283 | updateConfig(); | 283 | updateConfig(); |
284 | connect( mLabel, SIGNAL( clicked( )), | 284 | connect( mLabel, SIGNAL( clicked( )), |
285 | SLOT( newEvent() )); | 285 | SLOT( newEvent() )); |
286 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), | 286 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), |
287 | SLOT( defaultAction( QListBoxItem * ) ) ); | 287 | SLOT( defaultAction( QListBoxItem * ) ) ); |
288 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, | 288 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, |
289 | const QPoint &) ), | 289 | const QPoint &) ), |
290 | SLOT( contextMenu( QListBoxItem * ) ) ); | 290 | SLOT( contextMenu( QListBoxItem * ) ) ); |
291 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), | 291 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), |
292 | SLOT( selection( QListBoxItem * ) ) ); | 292 | SLOT( selection( QListBoxItem * ) ) ); |
293 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 293 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
294 | SLOT( cellClicked( QListBoxItem * ) ) ); | 294 | SLOT( cellClicked( QListBoxItem * ) ) ); |
295 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 295 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
296 | SLOT( selection( QListBoxItem * ) ) ); | 296 | SLOT( selection( QListBoxItem * ) ) ); |
297 | } | 297 | } |
298 | 298 | ||
299 | void MonthViewCell::setDate( const QDate &date ) | 299 | void MonthViewCell::setDate( const QDate &date ) |
300 | { | 300 | { |
301 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 301 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
302 | 302 | ||
303 | mDate = date; | 303 | mDate = date; |
304 | 304 | ||
305 | QString text; | 305 | QString text; |
306 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 306 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
307 | if ( KOGlobals::self()->calendarSystem()->day( date ) == 1 || (date.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 307 | if ( KOGlobals::self()->calendarSystem()->day( date ) == 1 || (date.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
308 | text = KOGlobals::self()->calendarSystem()->monthName( date, true ) + " "; | 308 | text = KOGlobals::self()->calendarSystem()->monthName( date, true ) + " "; |
309 | mLabel->resize( mLabelBigSize ); | 309 | mLabel->resize( mLabelBigSize ); |
310 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 310 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
311 | } else { | 311 | } else { |
312 | mLabel->resize( mLabelSize ); | 312 | mLabel->resize( mLabelSize ); |
313 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 313 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
314 | } | 314 | } |
315 | mLabel->setText( text ); | 315 | mLabel->setText( text ); |
316 | 316 | ||
317 | //resizeEvent( 0 ); | 317 | //resizeEvent( 0 ); |
318 | } | 318 | } |
319 | 319 | ||
320 | QDate MonthViewCell::date() const | 320 | QDate MonthViewCell::date() const |
321 | { | 321 | { |
322 | return mDate; | 322 | return mDate; |
323 | } | 323 | } |
324 | 324 | ||
325 | void MonthViewCell::setPrimary( bool primary ) | 325 | void MonthViewCell::setPrimary( bool primary ) |
326 | { | 326 | { |
327 | mPrimary = primary; | 327 | mPrimary = primary; |
328 | //setMyPalette(); | 328 | //setMyPalette(); |
329 | } | 329 | } |
330 | void MonthViewCell::setMyPalette() | 330 | void MonthViewCell::setMyPalette() |
331 | { | 331 | { |
332 | 332 | ||
333 | if ( mHoliday) { | 333 | if ( mHoliday) { |
334 | setPalette( mHolidayPalette ); | 334 | setPalette( mHolidayPalette ); |
335 | } else { | 335 | } else { |
336 | if ( mPrimary ) { | 336 | if ( mPrimary ) { |
337 | setPalette( mPrimaryPalette ); | 337 | setPalette( mPrimaryPalette ); |
338 | } else { | 338 | } else { |
339 | setPalette( mNonPrimaryPalette ); | 339 | setPalette( mNonPrimaryPalette ); |
340 | } | 340 | } |
341 | } | 341 | } |
342 | QPalette pal = palette(); | 342 | QPalette pal = palette(); |
343 | 343 | ||
344 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 344 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
345 | } | 345 | } |
346 | QPalette MonthViewCell::getPalette () | 346 | QPalette MonthViewCell::getPalette () |
347 | { | 347 | { |
348 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 348 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
349 | return mStandardPalette; | 349 | return mStandardPalette; |
350 | if ( mHoliday) { | 350 | if ( mHoliday) { |
351 | return mHolidayPalette ; | 351 | return mHolidayPalette ; |
352 | } else { | 352 | } else { |
353 | if ( mPrimary ) { | 353 | if ( mPrimary ) { |
354 | return mPrimaryPalette ; | 354 | return mPrimaryPalette ; |
355 | } | 355 | } |
356 | } | 356 | } |
357 | return mNonPrimaryPalette; | 357 | return mNonPrimaryPalette; |
358 | } | 358 | } |
359 | bool MonthViewCell::isPrimary() const | 359 | bool MonthViewCell::isPrimary() const |
360 | { | 360 | { |
361 | return mPrimary; | 361 | return mPrimary; |
362 | } | 362 | } |
363 | 363 | ||
364 | void MonthViewCell::setHoliday( bool holiday ) | 364 | void MonthViewCell::setHoliday( bool holiday ) |
365 | { | 365 | { |
366 | mHoliday = holiday; | 366 | mHoliday = holiday; |
367 | //setMyPalette(); | 367 | //setMyPalette(); |
368 | } | 368 | } |
369 | 369 | ||
370 | void MonthViewCell::setHoliday( const QString &holiday ) | 370 | void MonthViewCell::setHoliday( const QString &holiday ) |
371 | { | 371 | { |
372 | mHolidayString = holiday; | 372 | mHolidayString = holiday; |
373 | 373 | ||
374 | if ( !holiday.isEmpty() ) { | 374 | if ( !holiday.isEmpty() ) { |
375 | setHoliday( true ); | 375 | setHoliday( true ); |
376 | } | 376 | } |
377 | } | 377 | } |
378 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) | 378 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) |
379 | { | 379 | { |
380 | 380 | ||
381 | e->ignore(); | 381 | e->ignore(); |
382 | 382 | ||
383 | } | 383 | } |
384 | void MonthViewCell::updateCell() | 384 | void MonthViewCell::updateCell() |
385 | { | 385 | { |
386 | 386 | ||
387 | setPrimary( mDate.month()%2 ); | 387 | setPrimary( mDate.month()%2 ); |
388 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() ); | 388 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() ); |
389 | if ( mDate == QDate::currentDate() ) { | 389 | if ( mDate == QDate::currentDate() ) { |
390 | mItemList->setLineWidth( 3 ); | 390 | mItemList->setLineWidth( 3 ); |
391 | } else { | 391 | } else { |
392 | mItemList->setLineWidth( 1 ); | 392 | mItemList->setLineWidth( 1 ); |
393 | } | 393 | } |
394 | mItemList->clear(); | 394 | mItemList->clear(); |
395 | //qApp->processEvents(); | 395 | //qApp->processEvents(); |
396 | if ( !mHolidayString.isEmpty() ) { | 396 | if ( !mHolidayString.isEmpty() ) { |
397 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 397 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
398 | item->setPalette( mHolidayPalette ); | 398 | item->setPalette( mHolidayPalette ); |
399 | mItemList->insertItem( item ); | 399 | mItemList->insertItem( item ); |
400 | } | 400 | } |
401 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 401 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
402 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 402 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
403 | Event *event; | 403 | Event *event; |
404 | for( event = events.first(); event; event = events.next() ) { | 404 | for( event = events.first(); event; event = events.next() ) { |
405 | if ( event->categories().contains("Holiday") || | 405 | if ( event->categories().contains("Holiday") || |
406 | event->categories().contains(i18n("Holiday"))) { | 406 | event->categories().contains(i18n("Holiday"))) { |
407 | setHoliday( true ); | 407 | setHoliday( true ); |
408 | if ( mDate.dayOfWeek() == 7 ) | 408 | if ( mDate.dayOfWeek() == 7 ) |
409 | mItemList->setLineWidth( 3 ); | 409 | mItemList->setLineWidth( 3 ); |
410 | } | 410 | } |
411 | QString text; | 411 | QString text; |
412 | if (event->isMultiDay()) { | 412 | if (event->isMultiDay()) { |
413 | QString prefix = "<->"; | 413 | QString prefix = "<->"; |
414 | if ( event->doesRecur() ) { | 414 | if ( event->doesRecur() ) { |
415 | if ( event->recursOn( mDate) ) | 415 | if ( event->recursOn( mDate) ) |
416 | prefix ="->" ; | 416 | prefix ="->" ; |
417 | else { | 417 | else { |
418 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 418 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
419 | if ( event->recursOn( mDate.addDays( -days)) ) | 419 | if ( event->recursOn( mDate.addDays( -days)) ) |
420 | prefix ="<-" ; | 420 | prefix ="<-" ; |
421 | } | 421 | } |
422 | 422 | ||
423 | } else { | 423 | } else { |
424 | if (mDate == event->dtStart().date()) { | 424 | if (mDate == event->dtStart().date()) { |
425 | prefix ="->" ; | 425 | prefix ="->" ; |
426 | } else if (mDate == event->dtEnd().date()) { | 426 | } else if (mDate == event->dtEnd().date()) { |
427 | prefix ="<-" ; | 427 | prefix ="<-" ; |
428 | } | 428 | } |
429 | } | 429 | } |
430 | text = prefix + event->summary(); | 430 | text = prefix + event->summary(); |
431 | } else { | 431 | } else { |
432 | if (event->doesFloat()) | 432 | if (event->doesFloat()) |
433 | text = event->summary(); | 433 | text = event->summary(); |
434 | else { | 434 | else { |
435 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 435 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
436 | text += " " + event->summary(); | 436 | text += " " + event->summary(); |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 3bc6081..b1c7709 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,420 +1,420 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | #include <qlineedit.h> | 8 | #include <qlineedit.h> |
9 | #include <qfile.h> | 9 | #include <qfile.h> |
10 | #include <qdir.h> | 10 | #include <qdir.h> |
11 | #include <qapp.h> | 11 | #include <qapp.h> |
12 | #include <qfileinfo.h> | 12 | #include <qfileinfo.h> |
13 | #include <qlabel.h> | 13 | #include <qlabel.h> |
14 | #include <qmap.h> | 14 | #include <qmap.h> |
15 | #include <qwmatrix.h> | 15 | #include <qwmatrix.h> |
16 | #include <qtextbrowser.h> | 16 | #include <qtextbrowser.h> |
17 | #include <qtextstream.h> | 17 | #include <qtextstream.h> |
18 | #ifndef DESKTOP_VERSION | 18 | #ifndef DESKTOP_VERSION |
19 | #include <qpe/global.h> | 19 | #include <qpe/global.h> |
20 | #include <qpe/qpemenubar.h> | 20 | #include <qpe/qpemenubar.h> |
21 | #include <qpe/qpetoolbar.h> | 21 | #include <qpe/qpetoolbar.h> |
22 | #include <qpe/resource.h> | 22 | #include <qpe/resource.h> |
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <qtopia/alarmserver.h> | 24 | #include <qtopia/alarmserver.h> |
25 | #include <qtopia/qcopenvelope_qws.h> | 25 | #include <qtopia/qcopenvelope_qws.h> |
26 | #else | 26 | #else |
27 | #include <qmenubar.h> | 27 | #include <qmenubar.h> |
28 | #include <qtoolbar.h> | 28 | #include <qtoolbar.h> |
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | //#include <resource.h> | 30 | //#include <resource.h> |
31 | 31 | ||
32 | #endif | 32 | #endif |
33 | #include <libkcal/calendarlocal.h> | 33 | #include <libkcal/calendarlocal.h> |
34 | #include <libkcal/todo.h> | 34 | #include <libkcal/todo.h> |
35 | #include <libkdepim/ksyncprofile.h> | 35 | #include <libkdepim/ksyncprofile.h> |
36 | #include <libkdepim/kincidenceformatter.h> | 36 | #include <libkcal/kincidenceformatter.h> |
37 | 37 | ||
38 | #include "calendarview.h" | 38 | #include "calendarview.h" |
39 | #include "koviewmanager.h" | 39 | #include "koviewmanager.h" |
40 | #include "datenavigator.h" | 40 | #include "datenavigator.h" |
41 | #include "koagendaview.h" | 41 | #include "koagendaview.h" |
42 | #include "koagenda.h" | 42 | #include "koagenda.h" |
43 | #include "kodialogmanager.h" | 43 | #include "kodialogmanager.h" |
44 | #include "kdialogbase.h" | 44 | #include "kdialogbase.h" |
45 | #include "kapplication.h" | 45 | #include "kapplication.h" |
46 | #include "kofilterview.h" | 46 | #include "kofilterview.h" |
47 | #include "kstandarddirs.h" | 47 | #include "kstandarddirs.h" |
48 | #include "koprefs.h" | 48 | #include "koprefs.h" |
49 | #include "kfiledialog.h" | 49 | #include "kfiledialog.h" |
50 | #include "koglobals.h" | 50 | #include "koglobals.h" |
51 | #include "kglobal.h" | 51 | #include "kglobal.h" |
52 | #include "klocale.h" | 52 | #include "klocale.h" |
53 | #include "kconfig.h" | 53 | #include "kconfig.h" |
54 | #include "simplealarmclient.h" | 54 | #include "simplealarmclient.h" |
55 | #include "externalapphandler.h" | 55 | #include "externalapphandler.h" |
56 | 56 | ||
57 | using namespace KCal; | 57 | using namespace KCal; |
58 | #ifndef _WIN32_ | 58 | #ifndef _WIN32_ |
59 | #include <unistd.h> | 59 | #include <unistd.h> |
60 | #else | 60 | #else |
61 | #include "koimportoldialog.h" | 61 | #include "koimportoldialog.h" |
62 | #endif | 62 | #endif |
63 | #include "mainwindow.h" | 63 | #include "mainwindow.h" |
64 | 64 | ||
65 | int globalFlagBlockStartup; | 65 | int globalFlagBlockStartup; |
66 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 66 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
67 | QMainWindow( parent, name ) | 67 | QMainWindow( parent, name ) |
68 | { | 68 | { |
69 | 69 | ||
70 | #ifdef DESKTOP_VERSION | 70 | #ifdef DESKTOP_VERSION |
71 | setFont( QFont("Arial"), 14 ); | 71 | setFont( QFont("Arial"), 14 ); |
72 | #endif | 72 | #endif |
73 | 73 | ||
74 | mClosed = false; | 74 | mClosed = false; |
75 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 75 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
76 | QString confFile = locateLocal("config","korganizerrc"); | 76 | QString confFile = locateLocal("config","korganizerrc"); |
77 | QFileInfo finf ( confFile ); | 77 | QFileInfo finf ( confFile ); |
78 | bool showWarning = !finf.exists(); | 78 | bool showWarning = !finf.exists(); |
79 | setIcon(SmallIcon( "ko24" ) ); | 79 | setIcon(SmallIcon( "ko24" ) ); |
80 | mBlockAtStartup = true; | 80 | mBlockAtStartup = true; |
81 | mFlagKeyPressed = false; | 81 | mFlagKeyPressed = false; |
82 | setCaption("KOrganizer/Pi"); | 82 | setCaption("KOrganizer/Pi"); |
83 | KOPrefs *p = KOPrefs::instance(); | 83 | KOPrefs *p = KOPrefs::instance(); |
84 | // if ( QApplication::desktop()->height() > 480 ) { | 84 | // if ( QApplication::desktop()->height() > 480 ) { |
85 | // if ( p->mHourSize == 4 ) | 85 | // if ( p->mHourSize == 4 ) |
86 | // p->mHourSize = 6; | 86 | // p->mHourSize = 6; |
87 | // } | 87 | // } |
88 | if ( p->mHourSize > 18 ) | 88 | if ( p->mHourSize > 18 ) |
89 | p->mHourSize = 18; | 89 | p->mHourSize = 18; |
90 | QMainWindow::ToolBarDock tbd; | 90 | QMainWindow::ToolBarDock tbd; |
91 | if ( p->mToolBarHor ) { | 91 | if ( p->mToolBarHor ) { |
92 | if ( p->mToolBarUp ) | 92 | if ( p->mToolBarUp ) |
93 | tbd = Bottom; | 93 | tbd = Bottom; |
94 | else | 94 | else |
95 | tbd = Top; | 95 | tbd = Top; |
96 | } | 96 | } |
97 | else { | 97 | else { |
98 | if ( p->mToolBarUp ) | 98 | if ( p->mToolBarUp ) |
99 | tbd = Right; | 99 | tbd = Right; |
100 | else | 100 | else |
101 | tbd = Left; | 101 | tbd = Left; |
102 | } | 102 | } |
103 | if ( KOPrefs::instance()->mUseAppColors ) | 103 | if ( KOPrefs::instance()->mUseAppColors ) |
104 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 104 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
105 | globalFlagBlockStartup = 1; | 105 | globalFlagBlockStartup = 1; |
106 | iconToolBar = new QPEToolBar( this ); | 106 | iconToolBar = new QPEToolBar( this ); |
107 | addToolBar (iconToolBar , tbd ); | 107 | addToolBar (iconToolBar , tbd ); |
108 | mBlockSaveFlag = false; | 108 | mBlockSaveFlag = false; |
109 | mCalendarModifiedFlag = false; | 109 | mCalendarModifiedFlag = false; |
110 | 110 | ||
111 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 111 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
112 | splash->setAlignment ( AlignCenter ); | 112 | splash->setAlignment ( AlignCenter ); |
113 | setCentralWidget( splash ); | 113 | setCentralWidget( splash ); |
114 | #ifndef DESKTOP_VERSION | 114 | #ifndef DESKTOP_VERSION |
115 | showMaximized(); | 115 | showMaximized(); |
116 | #endif | 116 | #endif |
117 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 117 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
118 | setDefaultPreferences(); | 118 | setDefaultPreferences(); |
119 | mCalendar = new CalendarLocal(); | 119 | mCalendar = new CalendarLocal(); |
120 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 120 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
121 | mView->hide(); | 121 | mView->hide(); |
122 | //mView->resize(splash->size() ); | 122 | //mView->resize(splash->size() ); |
123 | initActions(); | 123 | initActions(); |
124 | #ifndef DESKTOP_VERSION | 124 | #ifndef DESKTOP_VERSION |
125 | iconToolBar->show(); | 125 | iconToolBar->show(); |
126 | qApp->processEvents(); | 126 | qApp->processEvents(); |
127 | #endif | 127 | #endif |
128 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 128 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
129 | int vh = height() ; | 129 | int vh = height() ; |
130 | int vw = width(); | 130 | int vw = width(); |
131 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 131 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
132 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 132 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
133 | vh -= iconToolBar->height(); | 133 | vh -= iconToolBar->height(); |
134 | } else { | 134 | } else { |
135 | vw -= iconToolBar->height(); | 135 | vw -= iconToolBar->height(); |
136 | } | 136 | } |
137 | //mView->setMaximumSize( splash->size() ); | 137 | //mView->setMaximumSize( splash->size() ); |
138 | //mView->resize( splash->size() ); | 138 | //mView->resize( splash->size() ); |
139 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 139 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
140 | mView->readSettings(); | 140 | mView->readSettings(); |
141 | bool oldOpened = false; | 141 | bool oldOpened = false; |
142 | bool newFile = false; | 142 | bool newFile = false; |
143 | if( !QFile::exists( defaultFileName() ) ) { | 143 | if( !QFile::exists( defaultFileName() ) ) { |
144 | QFileInfo finfo ( defaultFileName() ); | 144 | QFileInfo finfo ( defaultFileName() ); |
145 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 145 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
146 | qDebug("oldfile %s ", oldFile.latin1()); | 146 | qDebug("oldfile %s ", oldFile.latin1()); |
147 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 147 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
148 | finfo.setFile( oldFile ); | 148 | finfo.setFile( oldFile ); |
149 | if (finfo.exists() ) { | 149 | if (finfo.exists() ) { |
150 | KMessageBox::information( this, message); | 150 | KMessageBox::information( this, message); |
151 | mView->openCalendar( oldFile ); | 151 | mView->openCalendar( oldFile ); |
152 | qApp->processEvents(); | 152 | qApp->processEvents(); |
153 | } else { | 153 | } else { |
154 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 154 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
155 | finfo.setFile( oldFile ); | 155 | finfo.setFile( oldFile ); |
156 | if (finfo.exists() ) { | 156 | if (finfo.exists() ) { |
157 | KMessageBox::information( this, message); | 157 | KMessageBox::information( this, message); |
158 | mView->openCalendar( oldFile ); | 158 | mView->openCalendar( oldFile ); |
159 | qApp->processEvents(); | 159 | qApp->processEvents(); |
160 | } | 160 | } |
161 | } | 161 | } |
162 | mView->saveCalendar( defaultFileName() ); | 162 | mView->saveCalendar( defaultFileName() ); |
163 | newFile = true; | 163 | newFile = true; |
164 | } | 164 | } |
165 | 165 | ||
166 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 166 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
167 | if ( ! oldOpened ) | 167 | if ( ! oldOpened ) |
168 | mView->openCalendar( defaultFileName() ); | 168 | mView->openCalendar( defaultFileName() ); |
169 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 169 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
170 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 170 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
171 | 171 | ||
172 | if ( KOPrefs::instance()->mLanguageChanged ) { | 172 | if ( KOPrefs::instance()->mLanguageChanged ) { |
173 | KOPrefs::instance()->setCategoryDefaults(); | 173 | KOPrefs::instance()->setCategoryDefaults(); |
174 | int count = mView->addCategories(); | 174 | int count = mView->addCategories(); |
175 | KOPrefs::instance()->mLanguageChanged = false; | 175 | KOPrefs::instance()->mLanguageChanged = false; |
176 | } | 176 | } |
177 | processIncidenceSelection( 0 ); | 177 | processIncidenceSelection( 0 ); |
178 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 178 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
179 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 179 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
180 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 180 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
181 | SLOT( slotModifiedChanged( bool ) ) ); | 181 | SLOT( slotModifiedChanged( bool ) ) ); |
182 | 182 | ||
183 | 183 | ||
184 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 184 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
185 | mView->setModified( false ); | 185 | mView->setModified( false ); |
186 | mBlockAtStartup = false; | 186 | mBlockAtStartup = false; |
187 | mView->setModified( false ); | 187 | mView->setModified( false ); |
188 | setCentralWidget( mView ); | 188 | setCentralWidget( mView ); |
189 | globalFlagBlockStartup = 0; | 189 | globalFlagBlockStartup = 0; |
190 | mView->show(); | 190 | mView->show(); |
191 | delete splash; | 191 | delete splash; |
192 | if ( newFile ) | 192 | if ( newFile ) |
193 | mView->updateConfig(); | 193 | mView->updateConfig(); |
194 | // qApp->processEvents(); | 194 | // qApp->processEvents(); |
195 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 195 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
196 | fillSyncMenu(); | 196 | fillSyncMenu(); |
197 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 197 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
198 | if ( showWarning ) { | 198 | if ( showWarning ) { |
199 | KMessageBox::information( this, | 199 | KMessageBox::information( this, |
200 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 200 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
201 | qApp->processEvents(); | 201 | qApp->processEvents(); |
202 | mView->dialogManager()->showSyncOptions(); | 202 | mView->dialogManager()->showSyncOptions(); |
203 | } | 203 | } |
204 | 204 | ||
205 | //US listen for result adressed from Ka/Pi | 205 | //US listen for result adressed from Ka/Pi |
206 | #ifndef DESKTOP_VERSION | 206 | #ifndef DESKTOP_VERSION |
207 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 207 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
208 | #endif | 208 | #endif |
209 | } | 209 | } |
210 | MainWindow::~MainWindow() | 210 | MainWindow::~MainWindow() |
211 | { | 211 | { |
212 | //qDebug("MainWindow::~MainWindow() "); | 212 | //qDebug("MainWindow::~MainWindow() "); |
213 | //save toolbar location | 213 | //save toolbar location |
214 | 214 | ||
215 | delete mCalendar; | 215 | delete mCalendar; |
216 | delete KOPrefs::instance(); | 216 | delete KOPrefs::instance(); |
217 | delete KIncidenceFormatter::instance(); | 217 | delete KIncidenceFormatter::instance(); |
218 | 218 | ||
219 | 219 | ||
220 | } | 220 | } |
221 | void MainWindow::showMaximized () | 221 | void MainWindow::showMaximized () |
222 | { | 222 | { |
223 | #ifndef DESKTOP_VERSION | 223 | #ifndef DESKTOP_VERSION |
224 | if ( ! globalFlagBlockStartup ) | 224 | if ( ! globalFlagBlockStartup ) |
225 | if ( mClosed ) | 225 | if ( mClosed ) |
226 | mView->goToday(); | 226 | mView->goToday(); |
227 | #endif | 227 | #endif |
228 | QWidget::showMaximized () ; | 228 | QWidget::showMaximized () ; |
229 | mClosed = false; | 229 | mClosed = false; |
230 | } | 230 | } |
231 | void MainWindow::closeEvent( QCloseEvent* ce ) | 231 | void MainWindow::closeEvent( QCloseEvent* ce ) |
232 | { | 232 | { |
233 | 233 | ||
234 | 234 | ||
235 | 235 | ||
236 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 236 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
237 | saveOnClose(); | 237 | saveOnClose(); |
238 | mClosed = true; | 238 | mClosed = true; |
239 | ce->accept(); | 239 | ce->accept(); |
240 | return; | 240 | return; |
241 | 241 | ||
242 | } | 242 | } |
243 | 243 | ||
244 | switch( QMessageBox::information( this, "KO/Pi", | 244 | switch( QMessageBox::information( this, "KO/Pi", |
245 | i18n("Do you really want\nto close KO/Pi?"), | 245 | i18n("Do you really want\nto close KO/Pi?"), |
246 | i18n("Close"), i18n("No"), | 246 | i18n("Close"), i18n("No"), |
247 | 0, 0 ) ) { | 247 | 0, 0 ) ) { |
248 | case 0: | 248 | case 0: |
249 | saveOnClose(); | 249 | saveOnClose(); |
250 | mClosed = true; | 250 | mClosed = true; |
251 | ce->accept(); | 251 | ce->accept(); |
252 | break; | 252 | break; |
253 | case 1: | 253 | case 1: |
254 | ce->ignore(); | 254 | ce->ignore(); |
255 | break; | 255 | break; |
256 | case 2: | 256 | case 2: |
257 | 257 | ||
258 | default: | 258 | default: |
259 | break; | 259 | break; |
260 | } | 260 | } |
261 | 261 | ||
262 | 262 | ||
263 | } | 263 | } |
264 | 264 | ||
265 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 265 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
266 | { | 266 | { |
267 | QDataStream stream( data, IO_ReadOnly ); | 267 | QDataStream stream( data, IO_ReadOnly ); |
268 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 268 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
269 | //QString datamess; | 269 | //QString datamess; |
270 | //qDebug("message "); | 270 | //qDebug("message "); |
271 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 271 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
272 | 272 | ||
273 | if ( cmsg == "-writeFile" ) { | 273 | if ( cmsg == "-writeFile" ) { |
274 | // I made from the "-writeFile" an "-writeAlarm" | 274 | // I made from the "-writeFile" an "-writeAlarm" |
275 | mView->viewManager()->showWhatsNextView(); | 275 | mView->viewManager()->showWhatsNextView(); |
276 | mCalendar->checkAlarmForIncidence( 0, true); | 276 | mCalendar->checkAlarmForIncidence( 0, true); |
277 | showMaximized(); | 277 | showMaximized(); |
278 | raise(); | 278 | raise(); |
279 | return; | 279 | return; |
280 | } | 280 | } |
281 | 281 | ||
282 | if ( cmsg == "-writeFile" ) { | 282 | if ( cmsg == "-writeFile" ) { |
283 | // I made from the "-writeFile" an "-writeAlarm" | 283 | // I made from the "-writeFile" an "-writeAlarm" |
284 | mView->viewManager()->showWhatsNextView(); | 284 | mView->viewManager()->showWhatsNextView(); |
285 | mCalendar->checkAlarmForIncidence( 0, true); | 285 | mCalendar->checkAlarmForIncidence( 0, true); |
286 | showMaximized(); | 286 | showMaximized(); |
287 | raise(); | 287 | raise(); |
288 | return; | 288 | return; |
289 | 289 | ||
290 | } | 290 | } |
291 | if ( cmsg == "-writeFileSilent" ) { | 291 | if ( cmsg == "-writeFileSilent" ) { |
292 | // I made from the "-writeFile" an "-writeAlarm" | 292 | // I made from the "-writeFile" an "-writeAlarm" |
293 | // mView->viewManager()->showWhatsNextView(); | 293 | // mView->viewManager()->showWhatsNextView(); |
294 | mCalendar->checkAlarmForIncidence( 0, true); | 294 | mCalendar->checkAlarmForIncidence( 0, true); |
295 | //showMaximized(); | 295 | //showMaximized(); |
296 | //raise(); | 296 | //raise(); |
297 | hide(); | 297 | hide(); |
298 | return; | 298 | return; |
299 | } | 299 | } |
300 | if ( cmsg == "-newCountdown" ) { | 300 | if ( cmsg == "-newCountdown" ) { |
301 | qDebug("newCountdown "); | 301 | qDebug("newCountdown "); |
302 | 302 | ||
303 | } | 303 | } |
304 | QString msg ; | 304 | QString msg ; |
305 | QString allmsg = cmsg; | 305 | QString allmsg = cmsg; |
306 | while ( allmsg.length() > 0 ) { | 306 | while ( allmsg.length() > 0 ) { |
307 | int nextC = allmsg.find( "-", 1 ); | 307 | int nextC = allmsg.find( "-", 1 ); |
308 | if ( nextC == -1 ) { | 308 | if ( nextC == -1 ) { |
309 | msg = allmsg; | 309 | msg = allmsg; |
310 | allmsg = ""; | 310 | allmsg = ""; |
311 | } else{ | 311 | } else{ |
312 | msg = allmsg.left( nextC ); | 312 | msg = allmsg.left( nextC ); |
313 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 313 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
314 | } | 314 | } |
315 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 315 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
316 | if ( msg == "-newEvent" ) { | 316 | if ( msg == "-newEvent" ) { |
317 | mView->newEvent(); | 317 | mView->newEvent(); |
318 | } | 318 | } |
319 | if ( msg == "-newTodo" ) { | 319 | if ( msg == "-newTodo" ) { |
320 | mView->newTodo(); | 320 | mView->newTodo(); |
321 | 321 | ||
322 | } | 322 | } |
323 | if ( msg == "-showWN" ) { | 323 | if ( msg == "-showWN" ) { |
324 | mView->viewManager()->showWhatsNextView(); | 324 | mView->viewManager()->showWhatsNextView(); |
325 | } | 325 | } |
326 | if ( msg == "-showTodo" ) { | 326 | if ( msg == "-showTodo" ) { |
327 | mView->viewManager()->showTodoView(); | 327 | mView->viewManager()->showTodoView(); |
328 | } | 328 | } |
329 | if ( msg == "-showList" ) { | 329 | if ( msg == "-showList" ) { |
330 | mView->viewManager()->showListView(); | 330 | mView->viewManager()->showListView(); |
331 | } | 331 | } |
332 | else if ( msg == "-showDay" ) { | 332 | else if ( msg == "-showDay" ) { |
333 | mView->viewManager()->showDayView(); | 333 | mView->viewManager()->showDayView(); |
334 | } | 334 | } |
335 | else if ( msg == "-showWWeek" ) { | 335 | else if ( msg == "-showWWeek" ) { |
336 | mView->viewManager()->showWorkWeekView(); | 336 | mView->viewManager()->showWorkWeekView(); |
337 | } | 337 | } |
338 | else if ( msg == "-ringSync" ) { | 338 | else if ( msg == "-ringSync" ) { |
339 | multiSync( false ); | 339 | multiSync( false ); |
340 | } | 340 | } |
341 | else if ( msg == "-showWeek" ) { | 341 | else if ( msg == "-showWeek" ) { |
342 | mView->viewManager()->showWeekView(); | 342 | mView->viewManager()->showWeekView(); |
343 | } | 343 | } |
344 | else if ( msg == "-showTodo" ) { | 344 | else if ( msg == "-showTodo" ) { |
345 | mView->viewManager()->showTodoView(); | 345 | mView->viewManager()->showTodoView(); |
346 | } | 346 | } |
347 | else if ( msg == "-showJournal" ) { | 347 | else if ( msg == "-showJournal" ) { |
348 | mView->dateNavigator()->selectDates( 1 ); | 348 | mView->dateNavigator()->selectDates( 1 ); |
349 | mView->dateNavigator()->selectToday(); | 349 | mView->dateNavigator()->selectToday(); |
350 | mView->viewManager()->showJournalView(); | 350 | mView->viewManager()->showJournalView(); |
351 | } | 351 | } |
352 | else if ( msg == "-showKO" ) { | 352 | else if ( msg == "-showKO" ) { |
353 | mView->viewManager()->showNextXView(); | 353 | mView->viewManager()->showNextXView(); |
354 | } | 354 | } |
355 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 355 | else if ( msg == "-showWNext" || msg == "nextView()" ) { |
356 | mView->viewManager()->showWhatsNextView(); | 356 | mView->viewManager()->showWhatsNextView(); |
357 | } | 357 | } |
358 | else if ( msg == "-showNextXView" ) { | 358 | else if ( msg == "-showNextXView" ) { |
359 | mView->viewManager()->showNextXView(); | 359 | mView->viewManager()->showNextXView(); |
360 | } | 360 | } |
361 | 361 | ||
362 | 362 | ||
363 | } | 363 | } |
364 | 364 | ||
365 | showMaximized(); | 365 | showMaximized(); |
366 | raise(); | 366 | raise(); |
367 | } | 367 | } |
368 | 368 | ||
369 | QPixmap MainWindow::loadPixmap( QString name ) | 369 | QPixmap MainWindow::loadPixmap( QString name ) |
370 | { | 370 | { |
371 | return SmallIcon( name ); | 371 | return SmallIcon( name ); |
372 | 372 | ||
373 | } | 373 | } |
374 | void MainWindow::initActions() | 374 | void MainWindow::initActions() |
375 | { | 375 | { |
376 | //KOPrefs::instance()->mShowFullMenu | 376 | //KOPrefs::instance()->mShowFullMenu |
377 | iconToolBar->clear(); | 377 | iconToolBar->clear(); |
378 | KOPrefs *p = KOPrefs::instance(); | 378 | KOPrefs *p = KOPrefs::instance(); |
379 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 379 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
380 | 380 | ||
381 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 381 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
382 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 382 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
383 | QPopupMenu *importMenu = new QPopupMenu( this ); | 383 | QPopupMenu *importMenu = new QPopupMenu( this ); |
384 | selectFilterMenu = new QPopupMenu( this ); | 384 | selectFilterMenu = new QPopupMenu( this ); |
385 | selectFilterMenu->setCheckable( true ); | 385 | selectFilterMenu->setCheckable( true ); |
386 | syncMenu = new QPopupMenu( this ); | 386 | syncMenu = new QPopupMenu( this ); |
387 | configureAgendaMenu = new QPopupMenu( this ); | 387 | configureAgendaMenu = new QPopupMenu( this ); |
388 | configureToolBarMenu = new QPopupMenu( this ); | 388 | configureToolBarMenu = new QPopupMenu( this ); |
389 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 389 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
390 | if ( KOPrefs::instance()->mShowFullMenu ) { | 390 | if ( KOPrefs::instance()->mShowFullMenu ) { |
391 | QMenuBar *menuBar1; | 391 | QMenuBar *menuBar1; |
392 | menuBar1 = menuBar(); | 392 | menuBar1 = menuBar(); |
393 | menuBar1->insertItem( i18n("File"), importMenu ); | 393 | menuBar1->insertItem( i18n("File"), importMenu ); |
394 | menuBar1->insertItem( i18n("View"), viewMenu ); | 394 | menuBar1->insertItem( i18n("View"), viewMenu ); |
395 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 395 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
396 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 396 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
397 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 397 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
398 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 398 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
399 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 399 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
400 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 400 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
401 | } else { | 401 | } else { |
402 | QPEMenuBar *menuBar1; | 402 | QPEMenuBar *menuBar1; |
403 | menuBar1 = new QPEMenuBar( iconToolBar ); | 403 | menuBar1 = new QPEMenuBar( iconToolBar ); |
404 | QPopupMenu *menuBar = new QPopupMenu( this ); | 404 | QPopupMenu *menuBar = new QPopupMenu( this ); |
405 | menuBar1->insertItem( i18n("ME"), menuBar); | 405 | menuBar1->insertItem( i18n("ME"), menuBar); |
406 | menuBar->insertItem( i18n("File"), importMenu ); | 406 | menuBar->insertItem( i18n("File"), importMenu ); |
407 | menuBar->insertItem( i18n("View"), viewMenu ); | 407 | menuBar->insertItem( i18n("View"), viewMenu ); |
408 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 408 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
409 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 409 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
410 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 410 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
411 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 411 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
412 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 412 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
413 | menuBar->insertItem( i18n("Help"), helpMenu ); | 413 | menuBar->insertItem( i18n("Help"), helpMenu ); |
414 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 414 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
415 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 415 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
416 | } | 416 | } |
417 | connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); | 417 | connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); |
418 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 418 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
419 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); | 419 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); |
420 | 420 | ||