-rw-r--r-- | korganizer/koagendaitem.cpp | 5 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 31 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 5 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 6 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 8 | ||||
-rw-r--r-- | korganizer/koprefs.h | 8 | ||||
-rw-r--r-- | korganizer/koprefsdialog.cpp | 32 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 5 |
8 files changed, 86 insertions, 14 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 6a312b3..cead612 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -1,759 +1,762 @@ | |||
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 <libkcal/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 | class KOAgendaItemWhatsThis :public QWhatsThis | 59 | class KOAgendaItemWhatsThis :public QWhatsThis |
60 | { | 60 | { |
61 | public: | 61 | public: |
62 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; | 62 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; |
63 | 63 | ||
64 | protected: | 64 | protected: |
65 | virtual QString text( const QPoint& ) | 65 | virtual QString text( const QPoint& ) |
66 | { | 66 | { |
67 | return _view->getWhatsThisText() ; | 67 | return _view->getWhatsThisText() ; |
68 | } | 68 | } |
69 | private: | 69 | private: |
70 | KOAgendaItem * _view; | 70 | KOAgendaItem * _view; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, | 73 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, |
74 | const char *name,WFlags) : | 74 | const char *name,WFlags) : |
75 | QWidget(parent, name), mIncidence(incidence), mDate(qd) | 75 | QWidget(parent, name), mIncidence(incidence), mDate(qd) |
76 | { | 76 | { |
77 | #ifndef DESKTOP_VERSION | 77 | #ifndef DESKTOP_VERSION |
78 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 78 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
79 | #endif | 79 | #endif |
80 | new KOAgendaItemWhatsThis(this); | 80 | new KOAgendaItemWhatsThis(this); |
81 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase | 81 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase |
82 | setWFlags ( wflags); | 82 | setWFlags ( wflags); |
83 | mAllDay = allday; | 83 | mAllDay = allday; |
84 | init ( incidence, qd ); | 84 | init ( incidence, qd ); |
85 | setMouseTracking(true); | 85 | setMouseTracking(true); |
86 | //setAcceptDrops(true); | 86 | //setAcceptDrops(true); |
87 | xPaintCoord = -1; | 87 | xPaintCoord = -1; |
88 | yPaintCoord = -1; | 88 | yPaintCoord = -1; |
89 | } | 89 | } |
90 | QString KOAgendaItem::getWhatsThisText() | 90 | QString KOAgendaItem::getWhatsThisText() |
91 | { | 91 | { |
92 | if ( mIncidence ) | 92 | if ( mIncidence ) |
93 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence ); | 93 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence, |
94 | KOPrefs::instance()->mWTshowDetails, | ||
95 | KOPrefs::instance()->mWTshowCreated, | ||
96 | KOPrefs::instance()->mWTshowChanged); | ||
94 | return "KOAgendaItem::getWhatsThisText()::internal error"; | 97 | return "KOAgendaItem::getWhatsThisText()::internal error"; |
95 | } | 98 | } |
96 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | 99 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) |
97 | { | 100 | { |
98 | mIncidence = incidence; | 101 | mIncidence = incidence; |
99 | mDate = qd; | 102 | mDate = qd; |
100 | mFirstMultiItem = 0; | 103 | mFirstMultiItem = 0; |
101 | mNextMultiItem = 0; | 104 | mNextMultiItem = 0; |
102 | mLastMultiItem = 0; | 105 | mLastMultiItem = 0; |
103 | computeText(); | 106 | computeText(); |
104 | 107 | ||
105 | if ( (incidence->type() == "Todo") && | 108 | if ( (incidence->type() == "Todo") && |
106 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && | 109 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && |
107 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { | 110 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { |
108 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) | 111 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) |
109 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; | 112 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; |
110 | else | 113 | else |
111 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; | 114 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; |
112 | } | 115 | } |
113 | else { | 116 | else { |
114 | QStringList categories = mIncidence->categories(); | 117 | QStringList categories = mIncidence->categories(); |
115 | QString cat = categories.first(); | 118 | QString cat = categories.first(); |
116 | if (cat.isEmpty()) { | 119 | if (cat.isEmpty()) { |
117 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) | 120 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) |
118 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | 121 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; |
119 | else | 122 | else |
120 | mBackgroundColor =KOPrefs::instance()->mEventColor; | 123 | mBackgroundColor =KOPrefs::instance()->mEventColor; |
121 | } else { | 124 | } else { |
122 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); | 125 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); |
123 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { | 126 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { |
124 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) | 127 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) |
125 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | 128 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; |
126 | } | 129 | } |
127 | } | 130 | } |
128 | 131 | ||
129 | } | 132 | } |
130 | mColorGroup = QColorGroup( mBackgroundColor.light(), | 133 | mColorGroup = QColorGroup( mBackgroundColor.light(), |
131 | mBackgroundColor.dark(),mBackgroundColor.light(), | 134 | mBackgroundColor.dark(),mBackgroundColor.light(), |
132 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; | 135 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; |
133 | setBackgroundColor( mBackgroundColor ); | 136 | setBackgroundColor( mBackgroundColor ); |
134 | 137 | ||
135 | setCellXY(0,0,1); | 138 | setCellXY(0,0,1); |
136 | setCellXWidth(0); | 139 | setCellXWidth(0); |
137 | setSubCell(0); | 140 | setSubCell(0); |
138 | setSubCells(1); | 141 | setSubCells(1); |
139 | setMultiItem(0,0,0); | 142 | setMultiItem(0,0,0); |
140 | startMove(); | 143 | startMove(); |
141 | mSelected = true; | 144 | mSelected = true; |
142 | select(false); | 145 | select(false); |
143 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); | 146 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); |
144 | mFontPixelSize = fontinf.height();; | 147 | mFontPixelSize = fontinf.height();; |
145 | hide(); | 148 | hide(); |
146 | xPaintCoord = -1; | 149 | xPaintCoord = -1; |
147 | yPaintCoord = -1; | 150 | yPaintCoord = -1; |
148 | } | 151 | } |
149 | 152 | ||
150 | 153 | ||
151 | KOAgendaItem::~KOAgendaItem() | 154 | KOAgendaItem::~KOAgendaItem() |
152 | { | 155 | { |
153 | // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); | 156 | // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); |
154 | 157 | ||
155 | } | 158 | } |
156 | 159 | ||
157 | void KOAgendaItem::recreateIncidence() | 160 | void KOAgendaItem::recreateIncidence() |
158 | { | 161 | { |
159 | #if 0 | 162 | #if 0 |
160 | Incidence* newInc = mIncidence->clone(); | 163 | Incidence* newInc = mIncidence->clone(); |
161 | newInc->recreate(); | 164 | newInc->recreate(); |
162 | if ( mIncidence->doesRecur() ) { | 165 | if ( mIncidence->doesRecur() ) { |
163 | mIncidence->addExDate( mDate ); | 166 | mIncidence->addExDate( mDate ); |
164 | newInc->recurrence()->unsetRecurs(); | 167 | newInc->recurrence()->unsetRecurs(); |
165 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); | 168 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); |
166 | QTime tim = mIncidence->dtStart().time(); | 169 | QTime tim = mIncidence->dtStart().time(); |
167 | newInc->setDtStart( QDateTime(mDate, tim) ); | 170 | newInc->setDtStart( QDateTime(mDate, tim) ); |
168 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 171 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
169 | } | 172 | } |
170 | #endif | 173 | #endif |
171 | mIncidence = mIncidence->recreateCloneException( mDate ); | 174 | mIncidence = mIncidence->recreateCloneException( mDate ); |
172 | } | 175 | } |
173 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) | 176 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) |
174 | { | 177 | { |
175 | int size = AGENDA_ICON_SIZE; | 178 | int size = AGENDA_ICON_SIZE; |
176 | 179 | ||
177 | int yOff = 0; | 180 | int yOff = 0; |
178 | int xOff = 0; | 181 | int xOff = 0; |
179 | int x = pos().x() +3; | 182 | int x = pos().x() +3; |
180 | int y; | 183 | int y; |
181 | if ( mAllDay ) | 184 | if ( mAllDay ) |
182 | y = pos().y()+3; | 185 | y = pos().y()+3; |
183 | else | 186 | else |
184 | y = mCellYTop * ( height() / cellHeight() ) +3; | 187 | y = mCellYTop * ( height() / cellHeight() ) +3; |
185 | if (mIncidence->cancelled()) { | 188 | if (mIncidence->cancelled()) { |
186 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; | 189 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; |
187 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; | 190 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; |
188 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); | 191 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); |
189 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); | 192 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); |
190 | if ( horLayout ) | 193 | if ( horLayout ) |
191 | ++xOff; | 194 | ++xOff; |
192 | else | 195 | else |
193 | ++yOff; | 196 | ++yOff; |
194 | } | 197 | } |
195 | if (mIncidence->isAlarmEnabled()) { | 198 | if (mIncidence->isAlarmEnabled()) { |
196 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); | 199 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); |
197 | if ( horLayout ) | 200 | if ( horLayout ) |
198 | ++xOff; | 201 | ++xOff; |
199 | else | 202 | else |
200 | ++yOff; | 203 | ++yOff; |
201 | } | 204 | } |
202 | if (mIncidence->recurrence()->doesRecur()) { | 205 | if (mIncidence->recurrence()->doesRecur()) { |
203 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); | 206 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); |
204 | if ( horLayout ) | 207 | if ( horLayout ) |
205 | ++xOff; | 208 | ++xOff; |
206 | else | 209 | else |
207 | ++yOff; | 210 | ++yOff; |
208 | } | 211 | } |
209 | if (mIncidence->description().length() > 0) { | 212 | if (mIncidence->description().length() > 0) { |
210 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); | 213 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); |
211 | if ( horLayout ) | 214 | if ( horLayout ) |
212 | ++xOff; | 215 | ++xOff; |
213 | else | 216 | else |
214 | ++yOff; | 217 | ++yOff; |
215 | } | 218 | } |
216 | if (mIncidence->isReadOnly()) { | 219 | if (mIncidence->isReadOnly()) { |
217 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); | 220 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); |
218 | if ( horLayout ) | 221 | if ( horLayout ) |
219 | ++xOff; | 222 | ++xOff; |
220 | else | 223 | else |
221 | ++yOff; | 224 | ++yOff; |
222 | } | 225 | } |
223 | 226 | ||
224 | if (mIncidence->attendeeCount()>0) { | 227 | if (mIncidence->attendeeCount()>0) { |
225 | 228 | ||
226 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { | 229 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { |
227 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); | 230 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); |
228 | if ( horLayout ) | 231 | if ( horLayout ) |
229 | ++xOff; | 232 | ++xOff; |
230 | else | 233 | else |
231 | ++yOff; | 234 | ++yOff; |
232 | } else { | 235 | } else { |
233 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 236 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
234 | if (me!=0) { | 237 | if (me!=0) { |
235 | 238 | ||
236 | 239 | ||
237 | } else { | 240 | } else { |
238 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); | 241 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); |
239 | if ( horLayout ) | 242 | if ( horLayout ) |
240 | ++xOff; | 243 | ++xOff; |
241 | else | 244 | else |
242 | ++yOff; | 245 | ++yOff; |
243 | 246 | ||
244 | } | 247 | } |
245 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); | 248 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); |
246 | if ( horLayout ) | 249 | if ( horLayout ) |
247 | ++xOff; | 250 | ++xOff; |
248 | else | 251 | else |
249 | ++yOff; | 252 | ++yOff; |
250 | 253 | ||
251 | } | 254 | } |
252 | 255 | ||
253 | } | 256 | } |
254 | return ( yOff || xOff ); | 257 | return ( yOff || xOff ); |
255 | } | 258 | } |
256 | 259 | ||
257 | 260 | ||
258 | void KOAgendaItem::select(bool selected) | 261 | void KOAgendaItem::select(bool selected) |
259 | { | 262 | { |
260 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); | 263 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); |
261 | if (mSelected == selected) return; | 264 | if (mSelected == selected) return; |
262 | mSelected = selected; | 265 | mSelected = selected; |
263 | if ( ! isVisible() ) | 266 | if ( ! isVisible() ) |
264 | return; | 267 | return; |
265 | if ( firstMultiItem() ) | 268 | if ( firstMultiItem() ) |
266 | firstMultiItem()->select( selected ); | 269 | firstMultiItem()->select( selected ); |
267 | if ( !firstMultiItem() && nextMultiItem() ) { | 270 | if ( !firstMultiItem() && nextMultiItem() ) { |
268 | KOAgendaItem * placeItem = nextMultiItem(); | 271 | KOAgendaItem * placeItem = nextMultiItem(); |
269 | while ( placeItem ) { | 272 | while ( placeItem ) { |
270 | placeItem->select( selected ); | 273 | placeItem->select( selected ); |
271 | placeItem = placeItem->nextMultiItem(); | 274 | placeItem = placeItem->nextMultiItem(); |
272 | } | 275 | } |
273 | } | 276 | } |
274 | globalFlagBlockAgendaItemUpdate = 0; | 277 | globalFlagBlockAgendaItemUpdate = 0; |
275 | paintMe( selected ); | 278 | paintMe( selected ); |
276 | globalFlagBlockAgendaItemUpdate = 1; | 279 | globalFlagBlockAgendaItemUpdate = 1; |
277 | repaint( false ); | 280 | repaint( false ); |
278 | } | 281 | } |
279 | 282 | ||
280 | 283 | ||
281 | /* | 284 | /* |
282 | The eventFilter has to filter the mouse events of the agenda item childs. The | 285 | The eventFilter has to filter the mouse events of the agenda item childs. The |
283 | events are fed into the event handling method of KOAgendaItem. This allows the | 286 | events are fed into the event handling method of KOAgendaItem. This allows the |
284 | KOAgenda to handle the KOAgendaItems by using an eventFilter. | 287 | KOAgenda to handle the KOAgendaItems by using an eventFilter. |
285 | */ | 288 | */ |
286 | bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) | 289 | bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) |
287 | { | 290 | { |
288 | if (e->type() == QEvent::MouseButtonPress || | 291 | if (e->type() == QEvent::MouseButtonPress || |
289 | e->type() == QEvent::MouseButtonDblClick || | 292 | e->type() == QEvent::MouseButtonDblClick || |
290 | e->type() == QEvent::MouseButtonRelease || | 293 | e->type() == QEvent::MouseButtonRelease || |
291 | e->type() == QEvent::MouseMove) { | 294 | e->type() == QEvent::MouseMove) { |
292 | QMouseEvent *me = (QMouseEvent *)e; | 295 | QMouseEvent *me = (QMouseEvent *)e; |
293 | QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> | 296 | QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> |
294 | mapToGlobal(me->pos())); | 297 | mapToGlobal(me->pos())); |
295 | QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); | 298 | QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); |
296 | return event(&returnEvent); | 299 | return event(&returnEvent); |
297 | } else { | 300 | } else { |
298 | return false; | 301 | return false; |
299 | } | 302 | } |
300 | } | 303 | } |
301 | void KOAgendaItem::repaintMe( ) | 304 | void KOAgendaItem::repaintMe( ) |
302 | { | 305 | { |
303 | paintMe ( mSelected ); | 306 | paintMe ( mSelected ); |
304 | } | 307 | } |
305 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) | 308 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) |
306 | { | 309 | { |
307 | if ( globalFlagBlockAgendaItemUpdate && ! selected) | 310 | if ( globalFlagBlockAgendaItemUpdate && ! selected) |
308 | return; | 311 | return; |
309 | QPainter pa; | 312 | QPainter pa; |
310 | 313 | ||
311 | if ( mSelected ) { | 314 | if ( mSelected ) { |
312 | pa.begin( paintPixSel() ); | 315 | pa.begin( paintPixSel() ); |
313 | } else { | 316 | } else { |
314 | if ( mAllDay ) | 317 | if ( mAllDay ) |
315 | pa.begin( paintPixAllday() ); | 318 | pa.begin( paintPixAllday() ); |
316 | else | 319 | else |
317 | pa.begin( paintPix() ); | 320 | pa.begin( paintPix() ); |
318 | } | 321 | } |
319 | int x, yy, w, h; | 322 | int x, yy, w, h; |
320 | float nfh = 7.0; | 323 | float nfh = 7.0; |
321 | x = pos().x(); w = width(); h = height (); | 324 | x = pos().x(); w = width(); h = height (); |
322 | if ( mAllDay ) | 325 | if ( mAllDay ) |
323 | yy = y(); | 326 | yy = y(); |
324 | else | 327 | else |
325 | yy = mCellYTop * ( height() / cellHeight() ); | 328 | yy = mCellYTop * ( height() / cellHeight() ); |
326 | xPaintCoord= x; | 329 | xPaintCoord= x; |
327 | yPaintCoord = yy; | 330 | yPaintCoord = yy; |
328 | wPaintCoord = width(); | 331 | wPaintCoord = width(); |
329 | hPaintCoord = height(); | 332 | hPaintCoord = height(); |
330 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); | 333 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); |
331 | if ( paint == 0 ) | 334 | if ( paint == 0 ) |
332 | paint = &pa; | 335 | paint = &pa; |
333 | bool horLayout = ( w < h ); | 336 | bool horLayout = ( w < h ); |
334 | int maxhei = mFontPixelSize+4; | 337 | int maxhei = mFontPixelSize+4; |
335 | if ( horLayout ) | 338 | if ( horLayout ) |
336 | maxhei += AGENDA_ICON_SIZE -4; | 339 | maxhei += AGENDA_ICON_SIZE -4; |
337 | bool small = ( h < maxhei ); | 340 | bool small = ( h < maxhei ); |
338 | if ( ! small ) | 341 | if ( ! small ) |
339 | paint->setFont(KOPrefs::instance()->mAgendaViewFont); | 342 | paint->setFont(KOPrefs::instance()->mAgendaViewFont); |
340 | else { | 343 | else { |
341 | QFont f = KOPrefs::instance()->mAgendaViewFont; | 344 | QFont f = KOPrefs::instance()->mAgendaViewFont; |
342 | f.setBold( false ); | 345 | f.setBold( false ); |
343 | int fh = f.pointSize(); | 346 | int fh = f.pointSize(); |
344 | nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; | 347 | nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; |
345 | if ( nfh < 6 ) | 348 | if ( nfh < 6 ) |
346 | nfh = 6; | 349 | nfh = 6; |
347 | f.setPointSize( nfh ); | 350 | f.setPointSize( nfh ); |
348 | paint->setFont(f); | 351 | paint->setFont(f); |
349 | } | 352 | } |
350 | paint->fillRect ( x, yy, w, h, mBackgroundColor ); | 353 | paint->fillRect ( x, yy, w, h, mBackgroundColor ); |
351 | static const QPixmap completedPxmp = SmallIcon("greenhook16"); | 354 | static const QPixmap completedPxmp = SmallIcon("greenhook16"); |
352 | static const QPixmap overduePxmp = SmallIcon("redcross16"); | 355 | static const QPixmap overduePxmp = SmallIcon("redcross16"); |
353 | if ( mIncidence->type() == "Todo" ) { | 356 | if ( mIncidence->type() == "Todo" ) { |
354 | Todo* tempTodo = static_cast<Todo*>(mIncidence); | 357 | Todo* tempTodo = static_cast<Todo*>(mIncidence); |
355 | int xx = pos().x()+(width()-completedPxmp.width()-3 ); | 358 | int xx = pos().x()+(width()-completedPxmp.width()-3 ); |
356 | int yyy = yy+3; | 359 | int yyy = yy+3; |
357 | if ( tempTodo->isCompleted() ) | 360 | if ( tempTodo->isCompleted() ) |
358 | paint->drawPixmap ( xx, yyy, completedPxmp ); | 361 | paint->drawPixmap ( xx, yyy, completedPxmp ); |
359 | else { | 362 | else { |
360 | paint->drawPixmap ( xx, yyy, overduePxmp ); | 363 | paint->drawPixmap ( xx, yyy, overduePxmp ); |
361 | 364 | ||
362 | } | 365 | } |
363 | } | 366 | } |
364 | bool addIcon = false; | 367 | bool addIcon = false; |
365 | if ( ! small || w > 3 * h || h > 3* w ) | 368 | if ( ! small || w > 3 * h || h > 3* w ) |
366 | addIcon = updateIcons( paint, horLayout ); | 369 | addIcon = updateIcons( paint, horLayout ); |
367 | 370 | ||
368 | qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); | 371 | qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); |
369 | //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); | 372 | //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); |
370 | if ( ! small ) { | 373 | if ( ! small ) { |
371 | x += 3; yy += 3;w -= 6; h-= 5; | 374 | x += 3; yy += 3;w -= 6; h-= 5; |
372 | } else { | 375 | } else { |
373 | x += 2; yy += 1;w -= 4; h-= 4; | 376 | x += 2; yy += 1;w -= 4; h-= 4; |
374 | if ( nfh < 6.01 ) { | 377 | if ( nfh < 6.01 ) { |
375 | yy -= 2; | 378 | yy -= 2; |
376 | h += 4; | 379 | h += 4; |
377 | } | 380 | } |
378 | else | 381 | else |
379 | if ( nfh < h -2 ) | 382 | if ( nfh < h -2 ) |
380 | ++yy; | 383 | ++yy; |
381 | } | 384 | } |
382 | int align; | 385 | int align; |
383 | #ifndef DESKTOP_VERSION | 386 | #ifndef DESKTOP_VERSION |
384 | align = ( AlignLeft|WordBreak|AlignTop); | 387 | align = ( AlignLeft|WordBreak|AlignTop); |
385 | #else | 388 | #else |
386 | align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 389 | align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
387 | #endif | 390 | #endif |
388 | if ( addIcon ) { | 391 | if ( addIcon ) { |
389 | if ( ! horLayout ) { | 392 | if ( ! horLayout ) { |
390 | x += AGENDA_ICON_SIZE+3; | 393 | x += AGENDA_ICON_SIZE+3; |
391 | w -= (AGENDA_ICON_SIZE+3); | 394 | w -= (AGENDA_ICON_SIZE+3); |
392 | } | 395 | } |
393 | else { | 396 | else { |
394 | yy+= AGENDA_ICON_SIZE+2; | 397 | yy+= AGENDA_ICON_SIZE+2; |
395 | h -=(AGENDA_ICON_SIZE+3); | 398 | h -=(AGENDA_ICON_SIZE+3); |
396 | } | 399 | } |
397 | } | 400 | } |
398 | int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue(); | 401 | int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue(); |
399 | if ( colsum < 250 ) | 402 | if ( colsum < 250 ) |
400 | paint->setPen ( white); | 403 | paint->setPen ( white); |
401 | if ( x < 0 ) { | 404 | if ( x < 0 ) { |
402 | w = w+x-3; | 405 | w = w+x-3; |
403 | x = 3; | 406 | x = 3; |
404 | if ( w > parentWidget()->width() ){ | 407 | if ( w > parentWidget()->width() ){ |
405 | w = parentWidget()->width() - 6; | 408 | w = parentWidget()->width() - 6; |
406 | #ifndef DESKTOP_VERSION | 409 | #ifndef DESKTOP_VERSION |
407 | align = ( AlignCenter|WordBreak); | 410 | align = ( AlignCenter|WordBreak); |
408 | #else | 411 | #else |
409 | align = ( AlignCenter|BreakAnywhere|WordBreak); | 412 | align = ( AlignCenter|BreakAnywhere|WordBreak); |
410 | #endif | 413 | #endif |
411 | 414 | ||
412 | } | 415 | } |
413 | } | 416 | } |
414 | QRect dr; | 417 | QRect dr; |
415 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); | 418 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); |
416 | if ( mIncidence->cancelled() ){ | 419 | if ( mIncidence->cancelled() ){ |
417 | if ( ! small ) { | 420 | if ( ! small ) { |
418 | QFontMetrics fm ( paint->font() ); | 421 | QFontMetrics fm ( paint->font() ); |
419 | paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); | 422 | paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); |
420 | } | 423 | } |
421 | 424 | ||
422 | } | 425 | } |
423 | pa.end(); | 426 | pa.end(); |
424 | 427 | ||
425 | } | 428 | } |
426 | void KOAgendaItem::resizePixmap( int w , int h ) | 429 | void KOAgendaItem::resizePixmap( int w , int h ) |
427 | { | 430 | { |
428 | paintPix()->resize( w, h ); | 431 | paintPix()->resize( w, h ); |
429 | paintPixSel()->resize( w, h ); | 432 | paintPixSel()->resize( w, h ); |
430 | 433 | ||
431 | } | 434 | } |
432 | QPixmap * KOAgendaItem::paintPix() | 435 | QPixmap * KOAgendaItem::paintPix() |
433 | { | 436 | { |
434 | static QPixmap* mPaintPix = 0; | 437 | static QPixmap* mPaintPix = 0; |
435 | if ( ! mPaintPix ) | 438 | if ( ! mPaintPix ) |
436 | mPaintPix = new QPixmap(1,1); | 439 | mPaintPix = new QPixmap(1,1); |
437 | return mPaintPix ; | 440 | return mPaintPix ; |
438 | } | 441 | } |
439 | QPixmap * KOAgendaItem::paintPixAllday() | 442 | QPixmap * KOAgendaItem::paintPixAllday() |
440 | { | 443 | { |
441 | static QPixmap* mPaintPixA = 0; | 444 | static QPixmap* mPaintPixA = 0; |
442 | if ( ! mPaintPixA ) | 445 | if ( ! mPaintPixA ) |
443 | mPaintPixA = new QPixmap(1,1); | 446 | mPaintPixA = new QPixmap(1,1); |
444 | return mPaintPixA ; | 447 | return mPaintPixA ; |
445 | } | 448 | } |
446 | QPixmap * KOAgendaItem::paintPixSel() | 449 | QPixmap * KOAgendaItem::paintPixSel() |
447 | { | 450 | { |
448 | static QPixmap* mPaintPixSel = 0; | 451 | static QPixmap* mPaintPixSel = 0; |
449 | if ( ! mPaintPixSel ) | 452 | if ( ! mPaintPixSel ) |
450 | mPaintPixSel = new QPixmap(1,1); | 453 | mPaintPixSel = new QPixmap(1,1); |
451 | return mPaintPixSel ; | 454 | return mPaintPixSel ; |
452 | } | 455 | } |
453 | void KOAgendaItem::paintEvent ( QPaintEvent *e ) | 456 | void KOAgendaItem::paintEvent ( QPaintEvent *e ) |
454 | { | 457 | { |
455 | 458 | ||
456 | if ( globalFlagBlockAgendaItemPaint ) | 459 | if ( globalFlagBlockAgendaItemPaint ) |
457 | return; | 460 | return; |
458 | if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) | 461 | if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) |
459 | return; | 462 | return; |
460 | int yy; | 463 | int yy; |
461 | if ( mAllDay ) | 464 | if ( mAllDay ) |
462 | yy = y(); | 465 | yy = y(); |
463 | else | 466 | else |
464 | yy = mCellYTop * ( height() / cellHeight() ); | 467 | yy = mCellYTop * ( height() / cellHeight() ); |
465 | int xx = x(); | 468 | int xx = x(); |
466 | if ( xPaintCoord != xx || yPaintCoord != yy || | 469 | if ( xPaintCoord != xx || yPaintCoord != yy || |
467 | wPaintCoord != width() || hPaintCoord != height()) { | 470 | wPaintCoord != width() || hPaintCoord != height()) { |
468 | xPaintCoord= xx; | 471 | xPaintCoord= xx; |
469 | yPaintCoord = yy; | 472 | yPaintCoord = yy; |
470 | wPaintCoord = width(); | 473 | wPaintCoord = width(); |
471 | hPaintCoord = height(); | 474 | hPaintCoord = height(); |
472 | globalFlagBlockAgendaItemUpdate = 0; | 475 | globalFlagBlockAgendaItemUpdate = 0; |
473 | paintMe( mSelected ); | 476 | paintMe( mSelected ); |
474 | //qDebug("calling paintMe "); | 477 | //qDebug("calling paintMe "); |
475 | globalFlagBlockAgendaItemUpdate = 1; | 478 | globalFlagBlockAgendaItemUpdate = 1; |
476 | } | 479 | } |
477 | int rx, ry, rw, rh; | 480 | int rx, ry, rw, rh; |
478 | rx = e->rect().x(); | 481 | rx = e->rect().x(); |
479 | ry = e->rect().y(); | 482 | ry = e->rect().y(); |
480 | rw = e->rect().width(); | 483 | rw = e->rect().width(); |
481 | rh = e->rect().height(); | 484 | rh = e->rect().height(); |
482 | //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); | 485 | //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); |
483 | 486 | ||
484 | QPixmap* paintFrom ; | 487 | QPixmap* paintFrom ; |
485 | if ( mSelected ) { | 488 | if ( mSelected ) { |
486 | paintFrom = paintPixSel(); | 489 | paintFrom = paintPixSel(); |
487 | } else { | 490 | } else { |
488 | if ( mAllDay ) | 491 | if ( mAllDay ) |
489 | paintFrom = paintPixAllday(); | 492 | paintFrom = paintPixAllday(); |
490 | else | 493 | else |
491 | paintFrom = paintPix(); | 494 | paintFrom = paintPix(); |
492 | } | 495 | } |
493 | bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP); | 496 | bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP); |
494 | } | 497 | } |
495 | void KOAgendaItem::computeText() | 498 | void KOAgendaItem::computeText() |
496 | { | 499 | { |
497 | 500 | ||
498 | mDisplayedText = mIncidence->summary(); | 501 | mDisplayedText = mIncidence->summary(); |
499 | if ( (mIncidence->type() == "Todo") ) { | 502 | if ( (mIncidence->type() == "Todo") ) { |
500 | if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { | 503 | if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { |
501 | if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) | 504 | if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) |
502 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; | 505 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; |
503 | else if ( !(mIncidence->doesFloat())) | 506 | else if ( !(mIncidence->doesFloat())) |
504 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; | 507 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; |
505 | } | 508 | } |
506 | } else { | 509 | } else { |
507 | if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) | 510 | if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) |
508 | mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; | 511 | mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; |
509 | 512 | ||
510 | if ( mAllDay ) { | 513 | if ( mAllDay ) { |
511 | if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { | 514 | if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { |
512 | mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; | 515 | mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; |
513 | } | 516 | } |
514 | } | 517 | } |
515 | 518 | ||
516 | } | 519 | } |
517 | 520 | ||
518 | if ( !mIncidence->location().isEmpty() ) { | 521 | if ( !mIncidence->location().isEmpty() ) { |
519 | if ( mAllDay ) | 522 | if ( mAllDay ) |
520 | mDisplayedText += " ("; | 523 | mDisplayedText += " ("; |
521 | else | 524 | else |
522 | mDisplayedText += "\n("; | 525 | mDisplayedText += "\n("; |
523 | mDisplayedText += mIncidence->location() +")"; | 526 | mDisplayedText += mIncidence->location() +")"; |
524 | } | 527 | } |
525 | 528 | ||
526 | QString tipText = mIncidence->summary(); | 529 | QString tipText = mIncidence->summary(); |
527 | if ( !mIncidence->doesFloat() ) { | 530 | if ( !mIncidence->doesFloat() ) { |
528 | if ( mIncidence->type() == "Event" ) { | 531 | if ( mIncidence->type() == "Event" ) { |
529 | if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { | 532 | if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { |
530 | tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); | 533 | tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); |
531 | tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); | 534 | tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); |
532 | } | 535 | } |
533 | else { | 536 | else { |
534 | tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); | 537 | tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); |
535 | tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); | 538 | tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); |
536 | } | 539 | } |
537 | } | 540 | } |
538 | else if ( mIncidence->type() == "Todo" ) { | 541 | else if ( mIncidence->type() == "Todo" ) { |
539 | if (mIncidence->hasStartDate()) | 542 | if (mIncidence->hasStartDate()) |
540 | tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); | 543 | tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); |
541 | if (((Todo*)mIncidence)->hasDueDate()) | 544 | if (((Todo*)mIncidence)->hasDueDate()) |
542 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); | 545 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); |
543 | } | 546 | } |
544 | } else if ( mIncidence->type() == "Todo" ) { | 547 | } else if ( mIncidence->type() == "Todo" ) { |
545 | if (mIncidence->hasStartDate()) | 548 | if (mIncidence->hasStartDate()) |
546 | tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); | 549 | tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); |
547 | if (((Todo*)mIncidence)->hasDueDate()) | 550 | if (((Todo*)mIncidence)->hasDueDate()) |
548 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); | 551 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); |
549 | } | 552 | } |
550 | 553 | ||
551 | if (!mIncidence->location().isEmpty()) { | 554 | if (!mIncidence->location().isEmpty()) { |
552 | tipText += "\n"+i18n("Location: ")+mIncidence->location(); | 555 | tipText += "\n"+i18n("Location: ")+mIncidence->location(); |
553 | } | 556 | } |
554 | QToolTip::add(this,tipText,toolTipGroup(),""); | 557 | QToolTip::add(this,tipText,toolTipGroup(),""); |
555 | 558 | ||
556 | } | 559 | } |
557 | void KOAgendaItem::updateItem() | 560 | void KOAgendaItem::updateItem() |
558 | { | 561 | { |
559 | computeText(); | 562 | computeText(); |
560 | 563 | ||
561 | //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); | 564 | //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); |
562 | paintMe( mSelected ); | 565 | paintMe( mSelected ); |
563 | repaint( false); | 566 | repaint( false); |
564 | } | 567 | } |
565 | 568 | ||
566 | void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) | 569 | void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) |
567 | { | 570 | { |
568 | //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1()); | 571 | //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1()); |
569 | paintMe( mSelected ); | 572 | paintMe( mSelected ); |
570 | repaint( false ); | 573 | repaint( false ); |
571 | } | 574 | } |
572 | 575 | ||
573 | /* | 576 | /* |
574 | Return height of item in units of agenda cells | 577 | Return height of item in units of agenda cells |
575 | */ | 578 | */ |
576 | int KOAgendaItem::cellHeight() | 579 | int KOAgendaItem::cellHeight() |
577 | { | 580 | { |
578 | int ret = mCellYBottom - mCellYTop + 1; | 581 | int ret = mCellYBottom - mCellYTop + 1; |
579 | if ( ret <= 0 ) { | 582 | if ( ret <= 0 ) { |
580 | ret = 1; | 583 | ret = 1; |
581 | mCellYBottom = 0; | 584 | mCellYBottom = 0; |
582 | mCellYTop = 0; | 585 | mCellYTop = 0; |
583 | } | 586 | } |
584 | return ret; | 587 | return ret; |
585 | } | 588 | } |
586 | 589 | ||
587 | /* | 590 | /* |
588 | Return height of item in units of agenda cells | 591 | Return height of item in units of agenda cells |
589 | */ | 592 | */ |
590 | int KOAgendaItem::cellWidth() | 593 | int KOAgendaItem::cellWidth() |
591 | { | 594 | { |
592 | return mCellXWidth - mCellX + 1; | 595 | return mCellXWidth - mCellX + 1; |
593 | } | 596 | } |
594 | 597 | ||
595 | void KOAgendaItem::setItemDate(QDate qd) | 598 | void KOAgendaItem::setItemDate(QDate qd) |
596 | { | 599 | { |
597 | mDate = qd; | 600 | mDate = qd; |
598 | } | 601 | } |
599 | 602 | ||
600 | void KOAgendaItem::setCellXY(int X, int YTop, int YBottom) | 603 | void KOAgendaItem::setCellXY(int X, int YTop, int YBottom) |
601 | { | 604 | { |
602 | mCellX = X; | 605 | mCellX = X; |
603 | mCellYTop = YTop; | 606 | mCellYTop = YTop; |
604 | mCellYBottom = YBottom; | 607 | mCellYBottom = YBottom; |
605 | } | 608 | } |
606 | 609 | ||
607 | void KOAgendaItem::setCellXWidth(int xwidth) | 610 | void KOAgendaItem::setCellXWidth(int xwidth) |
608 | { | 611 | { |
609 | mCellXWidth = xwidth; | 612 | mCellXWidth = xwidth; |
610 | } | 613 | } |
611 | 614 | ||
612 | void KOAgendaItem::setCellX(int XLeft, int XRight) | 615 | void KOAgendaItem::setCellX(int XLeft, int XRight) |
613 | { | 616 | { |
614 | mCellX = XLeft; | 617 | mCellX = XLeft; |
615 | mCellXWidth = XRight; | 618 | mCellXWidth = XRight; |
616 | } | 619 | } |
617 | 620 | ||
618 | void KOAgendaItem::setCellY(int YTop, int YBottom) | 621 | void KOAgendaItem::setCellY(int YTop, int YBottom) |
619 | { | 622 | { |
620 | mCellYTop = YTop; | 623 | mCellYTop = YTop; |
621 | mCellYBottom = YBottom; | 624 | mCellYBottom = YBottom; |
622 | } | 625 | } |
623 | 626 | ||
624 | void KOAgendaItem::setSubCell(int subCell) | 627 | void KOAgendaItem::setSubCell(int subCell) |
625 | { | 628 | { |
626 | mSubCell = subCell; | 629 | mSubCell = subCell; |
627 | } | 630 | } |
628 | 631 | ||
629 | void KOAgendaItem::setSubCells(int subCells) | 632 | void KOAgendaItem::setSubCells(int subCells) |
630 | { | 633 | { |
631 | mSubCells = subCells; | 634 | mSubCells = subCells; |
632 | } | 635 | } |
633 | 636 | ||
634 | void KOAgendaItem::setMultiItem(KOAgendaItem *first,KOAgendaItem *next, | 637 | void KOAgendaItem::setMultiItem(KOAgendaItem *first,KOAgendaItem *next, |
635 | KOAgendaItem *last) | 638 | KOAgendaItem *last) |
636 | { | 639 | { |
637 | mFirstMultiItem = first; | 640 | mFirstMultiItem = first; |
638 | mNextMultiItem = next; | 641 | mNextMultiItem = next; |
639 | mLastMultiItem = last; | 642 | mLastMultiItem = last; |
640 | } | 643 | } |
641 | 644 | ||
642 | void KOAgendaItem::startMove() | 645 | void KOAgendaItem::startMove() |
643 | { | 646 | { |
644 | mStartCellX = mCellX; | 647 | mStartCellX = mCellX; |
645 | mStartCellXWidth = mCellXWidth; | 648 | mStartCellXWidth = mCellXWidth; |
646 | mStartCellYTop = mCellYTop; | 649 | mStartCellYTop = mCellYTop; |
647 | mStartCellYBottom = mCellYBottom; | 650 | mStartCellYBottom = mCellYBottom; |
648 | } | 651 | } |
649 | 652 | ||
650 | void KOAgendaItem::resetMove() | 653 | void KOAgendaItem::resetMove() |
651 | { | 654 | { |
652 | mCellX = mStartCellX; | 655 | mCellX = mStartCellX; |
653 | mCellXWidth = mStartCellXWidth; | 656 | mCellXWidth = mStartCellXWidth; |
654 | mCellYTop = mStartCellYTop; | 657 | mCellYTop = mStartCellYTop; |
655 | mCellYBottom = mStartCellYBottom; | 658 | mCellYBottom = mStartCellYBottom; |
656 | } | 659 | } |
657 | 660 | ||
658 | void KOAgendaItem::moveRelative(int dx, int dy) | 661 | void KOAgendaItem::moveRelative(int dx, int dy) |
659 | { | 662 | { |
660 | int newX = cellX() + dx; | 663 | int newX = cellX() + dx; |
661 | int newXWidth = cellXWidth() + dx; | 664 | int newXWidth = cellXWidth() + dx; |
662 | int newYTop = cellYTop() + dy; | 665 | int newYTop = cellYTop() + dy; |
663 | int newYBottom = cellYBottom() + dy; | 666 | int newYBottom = cellYBottom() + dy; |
664 | setCellXY(newX,newYTop,newYBottom); | 667 | setCellXY(newX,newYTop,newYBottom); |
665 | setCellXWidth(newXWidth); | 668 | setCellXWidth(newXWidth); |
666 | } | 669 | } |
667 | 670 | ||
668 | void KOAgendaItem::expandTop(int dy) | 671 | void KOAgendaItem::expandTop(int dy) |
669 | { | 672 | { |
670 | int newYTop = cellYTop() + dy; | 673 | int newYTop = cellYTop() + dy; |
671 | int newYBottom = cellYBottom(); | 674 | int newYBottom = cellYBottom(); |
672 | if (newYTop > newYBottom) newYTop = newYBottom; | 675 | if (newYTop > newYBottom) newYTop = newYBottom; |
673 | setCellY(newYTop, newYBottom); | 676 | setCellY(newYTop, newYBottom); |
674 | } | 677 | } |
675 | 678 | ||
676 | void KOAgendaItem::expandBottom(int dy) | 679 | void KOAgendaItem::expandBottom(int dy) |
677 | { | 680 | { |
678 | int newYTop = cellYTop(); | 681 | int newYTop = cellYTop(); |
679 | int newYBottom = cellYBottom() + dy; | 682 | int newYBottom = cellYBottom() + dy; |
680 | if (newYBottom < newYTop) newYBottom = newYTop; | 683 | if (newYBottom < newYTop) newYBottom = newYTop; |
681 | setCellY(newYTop, newYBottom); | 684 | setCellY(newYTop, newYBottom); |
682 | } | 685 | } |
683 | 686 | ||
684 | void KOAgendaItem::expandLeft(int dx) | 687 | void KOAgendaItem::expandLeft(int dx) |
685 | { | 688 | { |
686 | int newX = cellX() + dx; | 689 | int newX = cellX() + dx; |
687 | int newXWidth = cellXWidth(); | 690 | int newXWidth = cellXWidth(); |
688 | if (newX > newXWidth) newX = newXWidth; | 691 | if (newX > newXWidth) newX = newXWidth; |
689 | setCellX(newX,newXWidth); | 692 | setCellX(newX,newXWidth); |
690 | } | 693 | } |
691 | 694 | ||
692 | void KOAgendaItem::expandRight(int dx) | 695 | void KOAgendaItem::expandRight(int dx) |
693 | { | 696 | { |
694 | int newX = cellX(); | 697 | int newX = cellX(); |
695 | int newXWidth = cellXWidth() + dx; | 698 | int newXWidth = cellXWidth() + dx; |
696 | if (newXWidth < newX) newXWidth = newX; | 699 | if (newXWidth < newX) newXWidth = newX; |
697 | setCellX(newX,newXWidth); | 700 | setCellX(newX,newXWidth); |
698 | } | 701 | } |
699 | 702 | ||
700 | QToolTipGroup *KOAgendaItem::toolTipGroup() | 703 | QToolTipGroup *KOAgendaItem::toolTipGroup() |
701 | { | 704 | { |
702 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 705 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
703 | return mToolTipGroup; | 706 | return mToolTipGroup; |
704 | } | 707 | } |
705 | 708 | ||
706 | void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e ) | 709 | void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e ) |
707 | { | 710 | { |
708 | #ifndef KORG_NODND | 711 | #ifndef KORG_NODND |
709 | if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) || | 712 | if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) || |
710 | !QTextDrag::canDecode( e ) ) { | 713 | !QTextDrag::canDecode( e ) ) { |
711 | e->ignore(); | 714 | e->ignore(); |
712 | return; | 715 | return; |
713 | } | 716 | } |
714 | e->accept(); | 717 | e->accept(); |
715 | #endif | 718 | #endif |
716 | } | 719 | } |
717 | 720 | ||
718 | void KOAgendaItem::dropEvent( QDropEvent *e ) | 721 | void KOAgendaItem::dropEvent( QDropEvent *e ) |
719 | { | 722 | { |
720 | #ifndef KORG_NODND | 723 | #ifndef KORG_NODND |
721 | QString text; | 724 | QString text; |
722 | if(QTextDrag::decode(e,text)) | 725 | if(QTextDrag::decode(e,text)) |
723 | { | 726 | { |
724 | kdDebug() << "Dropped : " << text << endl; | 727 | kdDebug() << "Dropped : " << text << endl; |
725 | QStringList emails = QStringList::split(",",text); | 728 | QStringList emails = QStringList::split(",",text); |
726 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 729 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
727 | kdDebug() << " Email: " << (*it) << endl; | 730 | kdDebug() << " Email: " << (*it) << endl; |
728 | int pos = (*it).find("<"); | 731 | int pos = (*it).find("<"); |
729 | QString name = (*it).left(pos); | 732 | QString name = (*it).left(pos); |
730 | QString email = (*it).mid(pos); | 733 | QString email = (*it).mid(pos); |
731 | if (!email.isEmpty()) { | 734 | if (!email.isEmpty()) { |
732 | mIncidence->addAttendee(new Attendee(name,email)); | 735 | mIncidence->addAttendee(new Attendee(name,email)); |
733 | } | 736 | } |
734 | } | 737 | } |
735 | } | 738 | } |
736 | #endif | 739 | #endif |
737 | } | 740 | } |
738 | 741 | ||
739 | 742 | ||
740 | QPtrList<KOAgendaItem> KOAgendaItem::conflictItems() | 743 | QPtrList<KOAgendaItem> KOAgendaItem::conflictItems() |
741 | { | 744 | { |
742 | return mConflictItems; | 745 | return mConflictItems; |
743 | } | 746 | } |
744 | 747 | ||
745 | void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci) | 748 | void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci) |
746 | { | 749 | { |
747 | mConflictItems = ci; | 750 | mConflictItems = ci; |
748 | KOAgendaItem *item; | 751 | KOAgendaItem *item; |
749 | for ( item=mConflictItems.first(); item != 0; | 752 | for ( item=mConflictItems.first(); item != 0; |
750 | item=mConflictItems.next() ) { | 753 | item=mConflictItems.next() ) { |
751 | item->addConflictItem(this); | 754 | item->addConflictItem(this); |
752 | } | 755 | } |
753 | } | 756 | } |
754 | 757 | ||
755 | void KOAgendaItem::addConflictItem(KOAgendaItem *ci) | 758 | void KOAgendaItem::addConflictItem(KOAgendaItem *ci) |
756 | { | 759 | { |
757 | if (mConflictItems.find(ci)<0) | 760 | if (mConflictItems.find(ci)<0) |
758 | mConflictItems.append(ci); | 761 | mConflictItems.append(ci); |
759 | } | 762 | } |
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index f6c9624..d87938a 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -1,670 +1,685 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 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 <qcstring.h> | 20 | #include <qcstring.h> |
21 | #include <qwhatsthis.h> | 21 | #include <qwhatsthis.h> |
22 | #include <qdialog.h> | 22 | #include <qdialog.h> |
23 | #include <qapplication.h> | 23 | #include <qapplication.h> |
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | 26 | ||
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | #include <kapplication.h> | 28 | #include <kapplication.h> |
29 | #include <libkcal/event.h> | 29 | #include <libkcal/event.h> |
30 | #include <libkcal/todo.h> | 30 | #include <libkcal/todo.h> |
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <kiconloader.h> | 32 | #include <kiconloader.h> |
33 | #include <krun.h> | 33 | #include <krun.h> |
34 | #include <kglobal.h> | 34 | #include <kglobal.h> |
35 | #include <kprocess.h> | 35 | #include <kprocess.h> |
36 | #include "koprefs.h" | 36 | #include "koprefs.h" |
37 | 37 | ||
38 | #include <kabc/stdaddressbook.h> | 38 | #include <kabc/stdaddressbook.h> |
39 | 39 | ||
40 | #ifndef KORG_NODCOP | 40 | #ifndef KORG_NODCOP |
41 | #include <dcopclient.h> | 41 | #include <dcopclient.h> |
42 | #include "korganizer.h" | 42 | #include "korganizer.h" |
43 | #include "koprefs.h" | 43 | #include "koprefs.h" |
44 | #include "actionmanager.h" | 44 | #include "actionmanager.h" |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #include "koeventviewer.h" | 47 | #include "koeventviewer.h" |
48 | //#ifndef KORG_NOKABC | 48 | //#ifndef KORG_NOKABC |
49 | //#include <kabc/stdaddressbook.h> | 49 | //#include <kabc/stdaddressbook.h> |
50 | //#define size count | 50 | //#define size count |
51 | //#endif | 51 | //#endif |
52 | 52 | ||
53 | #ifdef DESKTOP_VERSION | 53 | #ifdef DESKTOP_VERSION |
54 | #include <kabc/addresseedialog.h> | 54 | #include <kabc/addresseedialog.h> |
55 | #include <kabc/addresseeview.h> | 55 | #include <kabc/addresseeview.h> |
56 | #else //DESKTOP_VERSION | 56 | #else //DESKTOP_VERSION |
57 | #include <externalapphandler.h> | 57 | #include <externalapphandler.h> |
58 | #include <qtopia/qcopenvelope_qws.h> | 58 | #include <qtopia/qcopenvelope_qws.h> |
59 | #endif //DESKTOP_VERSION | 59 | #endif //DESKTOP_VERSION |
60 | 60 | ||
61 | KOEventViewer::KOEventViewer(QWidget *parent,const char *name) | 61 | KOEventViewer::KOEventViewer(QWidget *parent,const char *name) |
62 | : QTextBrowser(parent,name) | 62 | : QTextBrowser(parent,name) |
63 | { | 63 | { |
64 | mSyncMode = false; | 64 | mSyncMode = false; |
65 | mColorMode = 0; | 65 | mColorMode = 0; |
66 | } | 66 | } |
67 | 67 | ||
68 | KOEventViewer::~KOEventViewer() | 68 | KOEventViewer::~KOEventViewer() |
69 | { | 69 | { |
70 | } | 70 | } |
71 | 71 | ||
72 | void KOEventViewer::setSource(const QString& n) | 72 | void KOEventViewer::setSource(const QString& n) |
73 | { | 73 | { |
74 | 74 | ||
75 | if ( n.left(3) == "uid" ) | 75 | if ( n.left(3) == "uid" ) |
76 | #ifdef DESKTOP_VERSION | 76 | #ifdef DESKTOP_VERSION |
77 | { | 77 | { |
78 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 78 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
79 | KABC::AddressBook::Iterator it; | 79 | KABC::AddressBook::Iterator it; |
80 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 80 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
81 | // LR I do not understand, why the uid string is different on zaurus and desktop | 81 | // LR I do not understand, why the uid string is different on zaurus and desktop |
82 | QString uid = "uid://"+(*it).uid(); | 82 | QString uid = "uid://"+(*it).uid(); |
83 | 83 | ||
84 | //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); | 84 | //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); |
85 | if (n == uid ) { | 85 | if (n == uid ) { |
86 | //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); | 86 | //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); |
87 | QDialog dia( this,"dia123", true ); | 87 | QDialog dia( this,"dia123", true ); |
88 | dia.setCaption( i18n("Details of attendee") ); | 88 | dia.setCaption( i18n("Details of attendee") ); |
89 | QVBoxLayout lay ( &dia ); | 89 | QVBoxLayout lay ( &dia ); |
90 | KABC::AddresseeView av ( &dia ); | 90 | KABC::AddresseeView av ( &dia ); |
91 | av.setAddressee( (*it) ); | 91 | av.setAddressee( (*it) ); |
92 | lay.addWidget( &av ); | 92 | lay.addWidget( &av ); |
93 | if ( QApplication::desktop()->width() < 480 ) | 93 | if ( QApplication::desktop()->width() < 480 ) |
94 | dia.resize( 220, 240); | 94 | dia.resize( 220, 240); |
95 | else { | 95 | else { |
96 | dia.resize( 400,400); | 96 | dia.resize( 400,400); |
97 | } | 97 | } |
98 | dia.exec(); | 98 | dia.exec(); |
99 | break; | 99 | break; |
100 | } | 100 | } |
101 | } | 101 | } |
102 | return; | 102 | return; |
103 | } | 103 | } |
104 | #else | 104 | #else |
105 | { | 105 | { |
106 | if ( "uid:organizer" == n ) { | 106 | if ( "uid:organizer" == n ) { |
107 | ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),""); | 107 | ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),""); |
108 | return; | 108 | return; |
109 | } | 109 | } |
110 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); | 110 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); |
111 | if (attendees.count()) { | 111 | if (attendees.count()) { |
112 | Attendee *a; | 112 | Attendee *a; |
113 | for(a=attendees.first();a;a=attendees.next()) { | 113 | for(a=attendees.first();a;a=attendees.next()) { |
114 | if ( "uid:"+a->uid() == n ) { | 114 | if ( "uid:"+a->uid() == n ) { |
115 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); | 115 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); |
116 | return; | 116 | return; |
117 | } | 117 | } |
118 | } | 118 | } |
119 | } | 119 | } |
120 | return; | 120 | return; |
121 | } | 121 | } |
122 | //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 122 | //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
123 | // the result should now arrive through method insertAttendees | 123 | // the result should now arrive through method insertAttendees |
124 | //QString uid = "uid:"+(*it).uid(); | 124 | //QString uid = "uid:"+(*it).uid(); |
125 | #endif | 125 | #endif |
126 | if ( n.left(6) == "mailto" ) { | 126 | if ( n.left(6) == "mailto" ) { |
127 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); | 127 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); |
128 | #ifndef DESKTOP_VERSION | 128 | #ifndef DESKTOP_VERSION |
129 | if ( n.mid(7,3) == "ALL" ) { | 129 | if ( n.mid(7,3) == "ALL" ) { |
130 | qDebug("all "); | 130 | qDebug("all "); |
131 | mailToAttendees( true ); | 131 | mailToAttendees( true ); |
132 | } else if ( n.mid(7,4) == "RSVP" ) { | 132 | } else if ( n.mid(7,4) == "RSVP" ) { |
133 | mailToAttendees( false ); | 133 | mailToAttendees( false ); |
134 | qDebug("rsvp "); | 134 | qDebug("rsvp "); |
135 | } else { | 135 | } else { |
136 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); | 136 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); |
137 | e << n.mid(7); | 137 | e << n.mid(7); |
138 | } | 138 | } |
139 | #endif | 139 | #endif |
140 | 140 | ||
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
144 | #ifndef KORG_NODCOP | 144 | #ifndef KORG_NODCOP |
145 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; | 145 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; |
146 | QString tmpStr; | 146 | QString tmpStr; |
147 | if (n.startsWith("mailto:")) { | 147 | if (n.startsWith("mailto:")) { |
148 | KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); | 148 | KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); |
149 | //emit showIncidence(n); | 149 | //emit showIncidence(n); |
150 | return; | 150 | return; |
151 | } else if (n.startsWith("uid:")) { | 151 | } else if (n.startsWith("uid:")) { |
152 | DCOPClient *client = KApplication::kApplication()->dcopClient(); | 152 | DCOPClient *client = KApplication::kApplication()->dcopClient(); |
153 | const QByteArray noParamData; | 153 | const QByteArray noParamData; |
154 | const QByteArray paramData; | 154 | const QByteArray paramData; |
155 | QByteArray replyData; | 155 | QByteArray replyData; |
156 | QCString replyTypeStr; | 156 | QCString replyTypeStr; |
157 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) | 157 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) |
158 | bool foundAbbrowser = PING_ABBROWSER; | 158 | bool foundAbbrowser = PING_ABBROWSER; |
159 | 159 | ||
160 | if (foundAbbrowser) { | 160 | if (foundAbbrowser) { |
161 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor | 161 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor |
162 | //client->send("kaddressbook","KAddressBookIface", | 162 | //client->send("kaddressbook","KAddressBookIface", |
163 | QDataStream arg(paramData, IO_WriteOnly); | 163 | QDataStream arg(paramData, IO_WriteOnly); |
164 | arg << n.mid(6); | 164 | arg << n.mid(6); |
165 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); | 165 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); |
166 | return; | 166 | return; |
167 | } else { | 167 | } else { |
168 | /* | 168 | /* |
169 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. | 169 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. |
170 | We start it without its main interface | 170 | We start it without its main interface |
171 | */ | 171 | */ |
172 | KIconLoader* iconLoader = new KIconLoader(); | 172 | KIconLoader* iconLoader = new KIconLoader(); |
173 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); | 173 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); |
174 | ActionManager::setStartedKAddressBook(true); | 174 | ActionManager::setStartedKAddressBook(true); |
175 | tmpStr = "kaddressbook --editor-only --uid "; | 175 | tmpStr = "kaddressbook --editor-only --uid "; |
176 | tmpStr += KProcess::quote(n.mid(6)); | 176 | tmpStr += KProcess::quote(n.mid(6)); |
177 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); | 177 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); |
178 | return; | 178 | return; |
179 | } | 179 | } |
180 | } else { | 180 | } else { |
181 | //QTextBrowser::setSource(n); | 181 | //QTextBrowser::setSource(n); |
182 | } | 182 | } |
183 | #endif | 183 | #endif |
184 | } | 184 | } |
185 | void KOEventViewer::mailToAttendees( bool all ) | 185 | void KOEventViewer::mailToAttendees( bool all ) |
186 | { | 186 | { |
187 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); | 187 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); |
188 | if (attendees.count() == 0) return; | 188 | if (attendees.count() == 0) return; |
189 | QStringList nameList; | 189 | QStringList nameList; |
190 | QStringList emailList; | 190 | QStringList emailList; |
191 | QStringList uidList; | 191 | QStringList uidList; |
192 | Attendee* a; | 192 | Attendee* a; |
193 | for(a=attendees.first();a;a=attendees.next()) { | 193 | for(a=attendees.first();a;a=attendees.next()) { |
194 | if ( !all && !a->RSVP() ) continue; | 194 | if ( !all && !a->RSVP() ) continue; |
195 | if (!a->email().isEmpty()) { | 195 | if (!a->email().isEmpty()) { |
196 | nameList.append (a->name() ); | 196 | nameList.append (a->name() ); |
197 | emailList.append (a->email() ); | 197 | emailList.append (a->email() ); |
198 | uidList.append (a->uid() ); | 198 | uidList.append (a->uid() ); |
199 | } | 199 | } |
200 | } | 200 | } |
201 | QString uid = "ComposeMailUIpick2"+mMailSubject; | 201 | QString uid = "ComposeMailUIpick2"+mMailSubject; |
202 | #ifndef DESKTOP_VERSION | 202 | #ifndef DESKTOP_VERSION |
203 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 203 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
204 | #endif | 204 | #endif |
205 | 205 | ||
206 | } | 206 | } |
207 | void KOEventViewer::addTag(const QString & tag,const QString & text) | 207 | void KOEventViewer::addTag(const QString & tag,const QString & text) |
208 | { | 208 | { |
209 | int number=text.contains("\n"); | 209 | int number=text.contains("\n"); |
210 | QString str = "<" + tag + ">"; | 210 | QString str = "<" + tag + ">"; |
211 | QString tmpText=text; | 211 | QString tmpText=text; |
212 | QString tmpStr=str; | 212 | QString tmpStr=str; |
213 | if(number !=-1) | 213 | if(number !=-1) |
214 | { | 214 | { |
215 | if (number > 0) { | 215 | if (number > 0) { |
216 | int pos=0; | 216 | int pos=0; |
217 | QString tmp; | 217 | QString tmp; |
218 | for(int i=0;i<=number;i++) { | 218 | for(int i=0;i<=number;i++) { |
219 | pos=tmpText.find("\n"); | 219 | pos=tmpText.find("\n"); |
220 | tmp=tmpText.left(pos); | 220 | tmp=tmpText.left(pos); |
221 | tmpText=tmpText.right(tmpText.length()-pos-1); | 221 | tmpText=tmpText.right(tmpText.length()-pos-1); |
222 | tmpStr+=tmp+"<br>"; | 222 | tmpStr+=tmp+"<br>"; |
223 | } | 223 | } |
224 | } | 224 | } |
225 | else tmpStr += tmpText; | 225 | else tmpStr += tmpText; |
226 | tmpStr+="</" + tag + ">"; | 226 | tmpStr+="</" + tag + ">"; |
227 | mText.append(tmpStr); | 227 | mText.append(tmpStr); |
228 | } | 228 | } |
229 | else | 229 | else |
230 | { | 230 | { |
231 | str += text + "</" + tag + ">"; | 231 | str += text + "</" + tag + ">"; |
232 | mText.append(str); | 232 | mText.append(str); |
233 | } | 233 | } |
234 | } | 234 | } |
235 | 235 | ||
236 | void KOEventViewer::setColorMode( int m ) | 236 | void KOEventViewer::setColorMode( int m ) |
237 | { | 237 | { |
238 | mColorMode = m; | 238 | mColorMode = m; |
239 | } | 239 | } |
240 | void KOEventViewer::appendEvent(Event *event, int mode ) | 240 | void KOEventViewer::appendEvent(Event *event, int mode ) |
241 | { | 241 | { |
242 | mMailSubject = ""; | 242 | mMailSubject = ""; |
243 | mCurrentIncidence = event; | 243 | mCurrentIncidence = event; |
244 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 244 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
245 | topLevelWidget()->setCaption(i18n("Event Viewer")); | 245 | topLevelWidget()->setCaption(i18n("Event Viewer")); |
246 | if ( mode == 0 ) { | 246 | if ( mode == 0 ) { |
247 | addTag("h2",event->summary()); | 247 | addTag("h2",event->summary()); |
248 | } | 248 | } |
249 | else { | 249 | else { |
250 | if ( mColorMode == 1 ) { | 250 | if ( mColorMode == 1 ) { |
251 | mText +="<font color=\"#00A000\">"; | 251 | mText +="<font color=\"#00A000\">"; |
252 | } | 252 | } |
253 | if ( mColorMode == 2 ) { | 253 | if ( mColorMode == 2 ) { |
254 | mText +="<font color=\"#C00000\">"; | 254 | mText +="<font color=\"#C00000\">"; |
255 | } | 255 | } |
256 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 256 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
257 | if ( mode == 1 ) { | 257 | if ( mode == 1 ) { |
258 | addTag("h2",i18n( "Local: " ) +event->summary()); | 258 | addTag("h2",i18n( "Local: " ) +event->summary()); |
259 | } else { | 259 | } else { |
260 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 260 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
261 | } | 261 | } |
262 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 262 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
263 | if ( mColorMode ) | 263 | if ( mColorMode ) |
264 | mText += "</font>"; | 264 | mText += "</font>"; |
265 | } | 265 | } |
266 | mMailSubject += i18n( "Meeting " )+ event->summary(); | 266 | mMailSubject += i18n( "Meeting " )+ event->summary(); |
267 | if (event->cancelled ()) { | 267 | if (event->cancelled ()) { |
268 | mText +="<font color=\"#B00000\">"; | 268 | mText +="<font color=\"#B00000\">"; |
269 | addTag("i",i18n("This event has been cancelled!")); | 269 | addTag("i",i18n("This event has been cancelled!")); |
270 | mText.append("<br>"); | 270 | mText.append("<br>"); |
271 | mText += "</font>"; | 271 | mText += "</font>"; |
272 | mMailSubject += i18n("(cancelled)"); | 272 | mMailSubject += i18n("(cancelled)"); |
273 | } | 273 | } |
274 | if (!event->location().isEmpty()) { | 274 | if (!event->location().isEmpty()) { |
275 | addTag("b",i18n("Location: ")); | 275 | addTag("b",i18n("Location: ")); |
276 | mText.append(event->location()+"<br>"); | 276 | mText.append(event->location()+"<br>"); |
277 | mMailSubject += i18n(" at ") + event->location(); | 277 | mMailSubject += i18n(" at ") + event->location(); |
278 | } | 278 | } |
279 | if (event->doesFloat()) { | 279 | if (event->doesFloat()) { |
280 | if (event->isMultiDay()) { | 280 | if (event->isMultiDay()) { |
281 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 281 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
282 | .arg(event->dtStartDateStr(shortDate)) | 282 | .arg(event->dtStartDateStr(shortDate)) |
283 | .arg(event->dtEndDateStr(shortDate))); | 283 | .arg(event->dtEndDateStr(shortDate))); |
284 | } else { | 284 | } else { |
285 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 285 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
286 | } | 286 | } |
287 | } else { | 287 | } else { |
288 | if (event->isMultiDay()) { | 288 | if (event->isMultiDay()) { |
289 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 289 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
290 | .arg(event->dtStartStr( shortDate))); | 290 | .arg(event->dtStartStr( shortDate))); |
291 | mText.append(i18n("<p><b>To:</b> %1</p>") | 291 | mText.append(i18n("<p><b>To:</b> %1</p>") |
292 | .arg(event->dtEndStr(shortDate))); | 292 | .arg(event->dtEndStr(shortDate))); |
293 | } else { | 293 | } else { |
294 | mText.append(i18n("<p><b>On:</b> %1</p> ") | 294 | mText.append(i18n("<p><b>On:</b> %1</p> ") |
295 | .arg(event->dtStartDateStr( shortDate ))); | 295 | .arg(event->dtStartDateStr( shortDate ))); |
296 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") | 296 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") |
297 | .arg(event->dtStartTimeStr()) | 297 | .arg(event->dtStartTimeStr()) |
298 | .arg(event->dtEndTimeStr())); | 298 | .arg(event->dtEndTimeStr())); |
299 | } | 299 | } |
300 | } | 300 | } |
301 | 301 | ||
302 | if (event->recurrence()->doesRecur()) { | 302 | if (event->recurrence()->doesRecur()) { |
303 | 303 | ||
304 | QString recurText = event->recurrence()->recurrenceText(); | 304 | QString recurText = event->recurrence()->recurrenceText(); |
305 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 305 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
306 | bool ok; | 306 | bool ok; |
307 | QDate start = QDate::currentDate(); | 307 | QDate start = QDate::currentDate(); |
308 | QDateTime next; | 308 | QDateTime next; |
309 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); | 309 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); |
310 | if ( ok ) { | 310 | if ( ok ) { |
311 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | 311 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); |
312 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); | 312 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); |
313 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); | 313 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); |
314 | 314 | ||
315 | } else { | 315 | } else { |
316 | bool last; | 316 | bool last; |
317 | QDate nextd; | 317 | QDate nextd; |
318 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); | 318 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); |
319 | if ( last ) { | 319 | if ( last ) { |
320 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 320 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); |
321 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); | 321 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); |
322 | } | 322 | } |
323 | } | 323 | } |
324 | } else { | 324 | } else { |
325 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); | 325 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); |
326 | 326 | ||
327 | } | 327 | } |
328 | 328 | ||
329 | 329 | ||
330 | if (event->isAlarmEnabled()) { | 330 | if (event->isAlarmEnabled()) { |
331 | Alarm *alarm =event->alarms().first() ; | 331 | Alarm *alarm =event->alarms().first() ; |
332 | QDateTime t = alarm->time(); | 332 | QDateTime t = alarm->time(); |
333 | int min = t.secsTo( event->dtStart() )/60; | 333 | int min = t.secsTo( event->dtStart() )/60; |
334 | QString s =i18n("( %1 min before )").arg( min ); | 334 | QString s =i18n("( %1 min before )").arg( min ); |
335 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 335 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); |
336 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 336 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
337 | //addTag("p",s); | 337 | //addTag("p",s); |
338 | } | 338 | } |
339 | 339 | ||
340 | addTag("b",i18n("Access: ")); | 340 | addTag("b",i18n("Access: ")); |
341 | mText.append(event->secrecyStr()+"<br>"); | 341 | mText.append(event->secrecyStr()+"<br>"); |
342 | if (!event->description().isEmpty()) { | 342 | |
343 | addTag("p",i18n("<b>Details: </b>")); | ||
344 | addTag("p",event->description()); | ||
345 | } | ||
346 | 343 | ||
344 | if ( KOPrefs::instance()->mEVshowDetails ) { | ||
345 | if (!event->description().isEmpty()) { | ||
346 | addTag("p",i18n("<b>Details: </b>")); | ||
347 | addTag("p",event->description()); | ||
348 | } | ||
349 | } | ||
347 | formatCategories(event); | 350 | formatCategories(event); |
348 | 351 | ||
349 | formatReadOnly(event); | 352 | formatReadOnly(event); |
350 | formatAttendees(event); | 353 | formatAttendees(event); |
351 | 354 | ||
355 | if ( KOPrefs::instance()->mEVshowCreated ) { | ||
356 | addTag("p",i18n("<b>Created: ") +" </b>"); | ||
357 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | ||
358 | |||
359 | } | ||
360 | if ( KOPrefs::instance()->mEVshowChanged ) { | ||
361 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | ||
362 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | ||
363 | |||
364 | } | ||
352 | setText(mText); | 365 | setText(mText); |
353 | //QWhatsThis::add(this,mText); | 366 | //QWhatsThis::add(this,mText); |
354 | 367 | ||
355 | } | 368 | } |
356 | 369 | ||
357 | void KOEventViewer::appendTodo(Todo *event, int mode ) | 370 | void KOEventViewer::appendTodo(Todo *event, int mode ) |
358 | { | 371 | { |
359 | mMailSubject = ""; | 372 | mMailSubject = ""; |
360 | mCurrentIncidence = event; | 373 | mCurrentIncidence = event; |
361 | topLevelWidget()->setCaption(i18n("Todo Viewer")); | 374 | topLevelWidget()->setCaption(i18n("Todo Viewer")); |
362 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 375 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
363 | if (mode == 0 ) | 376 | if (mode == 0 ) |
364 | addTag("h2",event->summary()); | 377 | addTag("h2",event->summary()); |
365 | else { | 378 | else { |
366 | if ( mColorMode == 1 ) { | 379 | if ( mColorMode == 1 ) { |
367 | mText +="<font color=\"#00A000\">"; | 380 | mText +="<font color=\"#00A000\">"; |
368 | } | 381 | } |
369 | if ( mColorMode == 2 ) { | 382 | if ( mColorMode == 2 ) { |
370 | mText +="<font color=\"#B00000\">"; | 383 | mText +="<font color=\"#B00000\">"; |
371 | } | 384 | } |
372 | if ( mode == 1 ) { | 385 | if ( mode == 1 ) { |
373 | addTag("h2",i18n( "Local: " ) +event->summary()); | 386 | addTag("h2",i18n( "Local: " ) +event->summary()); |
374 | } else { | 387 | } else { |
375 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 388 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
376 | } | 389 | } |
377 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 390 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
378 | if ( mColorMode ) | 391 | if ( mColorMode ) |
379 | mText += "</font>"; | 392 | mText += "</font>"; |
380 | } | 393 | } |
381 | mMailSubject += i18n( "Todo " )+ event->summary(); | 394 | mMailSubject += i18n( "Todo " )+ event->summary(); |
382 | 395 | ||
383 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | 396 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { |
384 | mText +="<font color=\"#B00000\">"; | 397 | mText +="<font color=\"#B00000\">"; |
385 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); | 398 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); |
386 | mText += "</font>"; | 399 | mText += "</font>"; |
387 | } else { | 400 | } else { |
388 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 401 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
389 | .arg(event->percentComplete())); | 402 | .arg(event->percentComplete())); |
390 | } | 403 | } |
391 | 404 | ||
392 | if (event->cancelled ()) { | 405 | if (event->cancelled ()) { |
393 | mText +="<font color=\"#B00000\">"; | 406 | mText +="<font color=\"#B00000\">"; |
394 | addTag("i",i18n("This todo has been cancelled!")); | 407 | addTag("i",i18n("This todo has been cancelled!")); |
395 | mText.append("<br>"); | 408 | mText.append("<br>"); |
396 | mText += "</font>"; | 409 | mText += "</font>"; |
397 | mMailSubject += i18n("(cancelled)"); | 410 | mMailSubject += i18n("(cancelled)"); |
398 | } | 411 | } |
399 | 412 | ||
400 | if (!event->location().isEmpty()) { | 413 | if (!event->location().isEmpty()) { |
401 | addTag("b",i18n("Location: ")); | 414 | addTag("b",i18n("Location: ")); |
402 | mText.append(event->location()+"<br>"); | 415 | mText.append(event->location()+"<br>"); |
403 | mMailSubject += i18n(" at ") + event->location(); | 416 | mMailSubject += i18n(" at ") + event->location(); |
404 | } | 417 | } |
405 | 418 | ||
406 | if (event->recurrence()->doesRecur()) { | 419 | if (event->recurrence()->doesRecur()) { |
407 | 420 | ||
408 | QString recurText = event->recurrence()->recurrenceText(); | 421 | QString recurText = event->recurrence()->recurrenceText(); |
409 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | 422 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); |
410 | 423 | ||
411 | } | 424 | } |
412 | if (event->hasStartDate()) { | 425 | if (event->hasStartDate()) { |
413 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); | 426 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); |
414 | } | 427 | } |
415 | if (event->hasDueDate()) { | 428 | if (event->hasDueDate()) { |
416 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); | 429 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); |
417 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); | 430 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); |
418 | } | 431 | } |
419 | addTag("b",i18n("Access: ")); | 432 | addTag("b",i18n("Access: ")); |
420 | mText.append(event->secrecyStr()+"<br>"); | 433 | mText.append(event->secrecyStr()+"<br>"); |
421 | if (!event->description().isEmpty()) { | 434 | if ( KOPrefs::instance()->mEVshowDetails ) { |
422 | addTag("p",i18n("<b>Details: </b>")); | 435 | if (!event->description().isEmpty()) { |
423 | addTag("p",event->description()); | 436 | addTag("p",i18n("<b>Details: </b>")); |
437 | addTag("p",event->description()); | ||
438 | } | ||
424 | } | 439 | } |
425 | 440 | ||
426 | formatCategories(event); | 441 | formatCategories(event); |
427 | 442 | ||
428 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 443 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
429 | .arg(QString::number(event->priority()))); | 444 | .arg(QString::number(event->priority()))); |
430 | 445 | ||
431 | formatReadOnly(event); | 446 | formatReadOnly(event); |
432 | formatAttendees(event); | 447 | formatAttendees(event); |
433 | if ( event->relatedTo() ) { | 448 | if ( event->relatedTo() ) { |
434 | addTag("b",i18n("Parent todo:<br>")); | 449 | addTag("b",i18n("Parent todo:<br>")); |
435 | mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); | 450 | mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); |
436 | } | 451 | } |
437 | QPtrList<Incidence> Relations = event->relations(); | 452 | QPtrList<Incidence> Relations = event->relations(); |
438 | Incidence *to; | 453 | Incidence *to; |
439 | if ( Relations.first() ) | 454 | if ( Relations.first() ) |
440 | addTag("b",i18n("Sub todos:<br>")); | 455 | addTag("b",i18n("Sub todos:<br>")); |
441 | for (to=Relations.first();to;to=Relations.next()) { | 456 | for (to=Relations.first();to;to=Relations.next()) { |
442 | mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); | 457 | mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); |
443 | 458 | ||
444 | } | 459 | } |
445 | setText(mText); | 460 | setText(mText); |
446 | } | 461 | } |
447 | 462 | ||
448 | void KOEventViewer::formatCategories(Incidence *event) | 463 | void KOEventViewer::formatCategories(Incidence *event) |
449 | { | 464 | { |
450 | if (!event->categoriesStr().isEmpty()) { | 465 | if (!event->categoriesStr().isEmpty()) { |
451 | if (event->categories().count() == 1) { | 466 | if (event->categories().count() == 1) { |
452 | addTag("h3",i18n("Category")); | 467 | addTag("h3",i18n("Category")); |
453 | } else { | 468 | } else { |
454 | addTag("h3",i18n("Categories")); | 469 | addTag("h3",i18n("Categories")); |
455 | } | 470 | } |
456 | addTag("p",event->categoriesStr()); | 471 | addTag("p",event->categoriesStr()); |
457 | } | 472 | } |
458 | } | 473 | } |
459 | void KOEventViewer::formatAttendees(Incidence *event) | 474 | void KOEventViewer::formatAttendees(Incidence *event) |
460 | { | 475 | { |
461 | QPtrList<Attendee> attendees = event->attendees(); | 476 | QPtrList<Attendee> attendees = event->attendees(); |
462 | if (attendees.count()) { | 477 | if (attendees.count()) { |
463 | 478 | ||
464 | 479 | ||
465 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 480 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
466 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); | 481 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); |
467 | addTag("h3",i18n("Organizer")); | 482 | addTag("h3",i18n("Organizer")); |
468 | mText.append("<ul><li>"); | 483 | mText.append("<ul><li>"); |
469 | #ifndef KORG_NOKABC | 484 | #ifndef KORG_NOKABC |
470 | 485 | ||
471 | #ifdef DESKTOP_VERSION | 486 | #ifdef DESKTOP_VERSION |
472 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 487 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
473 | KABC::Addressee::List addressList; | 488 | KABC::Addressee::List addressList; |
474 | addressList = add_book->findByEmail(event->organizer()); | 489 | addressList = add_book->findByEmail(event->organizer()); |
475 | KABC::Addressee o = addressList.first(); | 490 | KABC::Addressee o = addressList.first(); |
476 | if (!o.isEmpty() && addressList.size()<2) { | 491 | if (!o.isEmpty() && addressList.size()<2) { |
477 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 492 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
478 | mText += o.formattedName(); | 493 | mText += o.formattedName(); |
479 | mText += "</a>\n"; | 494 | mText += "</a>\n"; |
480 | } else { | 495 | } else { |
481 | mText.append(event->organizer()); | 496 | mText.append(event->organizer()); |
482 | } | 497 | } |
483 | #else //DESKTOP_VERSION | 498 | #else //DESKTOP_VERSION |
484 | mText += "<a href=\"uid:organizer\">"; | 499 | mText += "<a href=\"uid:organizer\">"; |
485 | mText += event->organizer(); | 500 | mText += event->organizer(); |
486 | mText += "</a>\n"; | 501 | mText += "</a>\n"; |
487 | #endif //DESKTOP_VERSION | 502 | #endif //DESKTOP_VERSION |
488 | 503 | ||
489 | 504 | ||
490 | #else | 505 | #else |
491 | mText.append(event->organizer()); | 506 | mText.append(event->organizer()); |
492 | #endif | 507 | #endif |
493 | 508 | ||
494 | if (iconPath) { | 509 | if (iconPath) { |
495 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 510 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
496 | mText += "<IMG src=\"" + iconPath + "\">"; | 511 | mText += "<IMG src=\"" + iconPath + "\">"; |
497 | mText += "</a>\n"; | 512 | mText += "</a>\n"; |
498 | } | 513 | } |
499 | mText.append("</li></ul>"); | 514 | mText.append("</li></ul>"); |
500 | 515 | ||
501 | addTag("h3",i18n("Attendees")); | 516 | addTag("h3",i18n("Attendees")); |
502 | Attendee *a; | 517 | Attendee *a; |
503 | mText.append("<ul>"); | 518 | mText.append("<ul>"); |
504 | int a_count = 0; | 519 | int a_count = 0; |
505 | int a_count_nr = 0; | 520 | int a_count_nr = 0; |
506 | 521 | ||
507 | for(a=attendees.first();a;a=attendees.next()) { | 522 | for(a=attendees.first();a;a=attendees.next()) { |
508 | #ifndef KORG_NOKABC | 523 | #ifndef KORG_NOKABC |
509 | #ifdef DESKTOP_VERSION | 524 | #ifdef DESKTOP_VERSION |
510 | if (a->name().isEmpty()) { | 525 | if (a->name().isEmpty()) { |
511 | addressList = add_book->findByEmail(a->email()); | 526 | addressList = add_book->findByEmail(a->email()); |
512 | KABC::Addressee o = addressList.first(); | 527 | KABC::Addressee o = addressList.first(); |
513 | if (!o.isEmpty() && addressList.size()<2) { | 528 | if (!o.isEmpty() && addressList.size()<2) { |
514 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 529 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
515 | mText += o.formattedName(); | 530 | mText += o.formattedName(); |
516 | mText += "</a>\n"; | 531 | mText += "</a>\n"; |
517 | } else { | 532 | } else { |
518 | mText += "<li>"; | 533 | mText += "<li>"; |
519 | mText.append(a->email()); | 534 | mText.append(a->email()); |
520 | mText += "\n"; | 535 | mText += "\n"; |
521 | } | 536 | } |
522 | } else { | 537 | } else { |
523 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 538 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
524 | if (!a->name().isEmpty()) mText += a->name(); | 539 | if (!a->name().isEmpty()) mText += a->name(); |
525 | else mText += a->email(); | 540 | else mText += a->email(); |
526 | mText += "</a>\n"; | 541 | mText += "</a>\n"; |
527 | } | 542 | } |
528 | #else //DESKTOP_VERSION | 543 | #else //DESKTOP_VERSION |
529 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 544 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
530 | if (!a->name().isEmpty()) mText += a->name(); | 545 | if (!a->name().isEmpty()) mText += a->name(); |
531 | else mText += a->email(); | 546 | else mText += a->email(); |
532 | mText += "</a>\n"; | 547 | mText += "</a>\n"; |
533 | #endif //DESKTOP_VERSION | 548 | #endif //DESKTOP_VERSION |
534 | #else | 549 | #else |
535 | //qDebug("nokabc "); | 550 | //qDebug("nokabc "); |
536 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 551 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
537 | if (!a->name().isEmpty()) mText += a->name(); | 552 | if (!a->name().isEmpty()) mText += a->name(); |
538 | else mText += a->email(); | 553 | else mText += a->email(); |
539 | mText += "</a>\n"; | 554 | mText += "</a>\n"; |
540 | #endif | 555 | #endif |
541 | 556 | ||
542 | 557 | ||
543 | if (!a->email().isEmpty()) { | 558 | if (!a->email().isEmpty()) { |
544 | if (iconPath) { | 559 | if (iconPath) { |
545 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; | 560 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; |
546 | if ( a->RSVP() ) { | 561 | if ( a->RSVP() ) { |
547 | ++a_count_nr; | 562 | ++a_count_nr; |
548 | mText += "<IMG src=\"" + iconPath + "\">"; | 563 | mText += "<IMG src=\"" + iconPath + "\">"; |
549 | } | 564 | } |
550 | else { | 565 | else { |
551 | ++a_count; | 566 | ++a_count; |
552 | mText += "<IMG src=\"" + NOiconPath + "\">"; | 567 | mText += "<IMG src=\"" + NOiconPath + "\">"; |
553 | } | 568 | } |
554 | mText += "</a>\n"; | 569 | mText += "</a>\n"; |
555 | } | 570 | } |
556 | } | 571 | } |
557 | if (a->status() != Attendee::NeedsAction ) | 572 | if (a->status() != Attendee::NeedsAction ) |
558 | mText +="[" + a->statusStr() + "] "; | 573 | mText +="[" + a->statusStr() + "] "; |
559 | if (a->role() == Attendee::Chair ) | 574 | if (a->role() == Attendee::Chair ) |
560 | mText +="(" + a->roleStr().left(1) + ".)"; | 575 | mText +="(" + a->roleStr().left(1) + ".)"; |
561 | } | 576 | } |
562 | mText.append("</li></ul>"); | 577 | mText.append("</li></ul>"); |
563 | if ( (a_count+a_count_nr) > 1 ) { | 578 | if ( (a_count+a_count_nr) > 1 ) { |
564 | mText += "<a href=\"mailto:ALL\">"; | 579 | mText += "<a href=\"mailto:ALL\">"; |
565 | mText += i18n( "Mail to all" ); | 580 | mText += i18n( "Mail to all" ); |
566 | mText += "</a> ( "; | 581 | mText += "</a> ( "; |
567 | mText += "<IMG src=\"" + iconPath + "\">"; | 582 | mText += "<IMG src=\"" + iconPath + "\">"; |
568 | mText += i18n( " and " ); | 583 | mText += i18n( " and " ); |
569 | mText += "<IMG src=\"" + NOiconPath + "\"> )"; | 584 | mText += "<IMG src=\"" + NOiconPath + "\"> )"; |
570 | mText += "<br>\n"; | 585 | mText += "<br>\n"; |
571 | 586 | ||
572 | 587 | ||
573 | } | 588 | } |
574 | if ( a_count_nr > 1 ) { | 589 | if ( a_count_nr > 1 ) { |
575 | mText += "<a href=\"mailto:RSVP\">"; | 590 | mText += "<a href=\"mailto:RSVP\">"; |
576 | mText += i18n( "Mail to selected" ); | 591 | mText += i18n( "Mail to selected" ); |
577 | mText += "</a> ( "; | 592 | mText += "</a> ( "; |
578 | mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); | 593 | mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); |
579 | mText += "<br>\n"; | 594 | mText += "<br>\n"; |
580 | } | 595 | } |
581 | } | 596 | } |
582 | 597 | ||
583 | } | 598 | } |
584 | void KOEventViewer::appendJournal(Journal *jour, int mode ) | 599 | void KOEventViewer::appendJournal(Journal *jour, int mode ) |
585 | { | 600 | { |
586 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 601 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
587 | if (mode == 0 ) { | 602 | if (mode == 0 ) { |
588 | addTag("h2",i18n("Journal from: ")); | 603 | addTag("h2",i18n("Journal from: ")); |
589 | } | 604 | } |
590 | else { | 605 | else { |
591 | if ( mode == 1 ) { | 606 | if ( mode == 1 ) { |
592 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); | 607 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); |
593 | } else { | 608 | } else { |
594 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); | 609 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); |
595 | } | 610 | } |
596 | } | 611 | } |
597 | topLevelWidget()->setCaption("Journal Viewer"); | 612 | topLevelWidget()->setCaption("Journal Viewer"); |
598 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); | 613 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); |
599 | addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); | 614 | addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); |
600 | if (!jour->description().isEmpty()) { | 615 | if (!jour->description().isEmpty()) { |
601 | addTag("p",jour->description()); | 616 | addTag("p",jour->description()); |
602 | } | 617 | } |
603 | setText(mText); | 618 | setText(mText); |
604 | } | 619 | } |
605 | 620 | ||
606 | void KOEventViewer::formatReadOnly(Incidence *event) | 621 | void KOEventViewer::formatReadOnly(Incidence *event) |
607 | { | 622 | { |
608 | if (event->isReadOnly()) { | 623 | if (event->isReadOnly()) { |
609 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); | 624 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); |
610 | } | 625 | } |
611 | } | 626 | } |
612 | void KOEventViewer::setSyncMode( bool b ) | 627 | void KOEventViewer::setSyncMode( bool b ) |
613 | { | 628 | { |
614 | mSyncMode = b; | 629 | mSyncMode = b; |
615 | } | 630 | } |
616 | 631 | ||
617 | 632 | ||
618 | void KOEventViewer::setTodo(Todo *event, bool clearV ) | 633 | void KOEventViewer::setTodo(Todo *event, bool clearV ) |
619 | { | 634 | { |
620 | if ( clearV ) | 635 | if ( clearV ) |
621 | clearEvents(); | 636 | clearEvents(); |
622 | if ( mSyncMode ) { | 637 | if ( mSyncMode ) { |
623 | if ( clearV ) | 638 | if ( clearV ) |
624 | appendTodo(event,1 ); | 639 | appendTodo(event,1 ); |
625 | else | 640 | else |
626 | appendTodo(event,2); | 641 | appendTodo(event,2); |
627 | } else | 642 | } else |
628 | appendTodo(event); | 643 | appendTodo(event); |
629 | } | 644 | } |
630 | void KOEventViewer::setJournal(Journal *event, bool clearV ) | 645 | void KOEventViewer::setJournal(Journal *event, bool clearV ) |
631 | { | 646 | { |
632 | if ( clearV ) | 647 | if ( clearV ) |
633 | clearEvents(); | 648 | clearEvents(); |
634 | if ( mSyncMode ) { | 649 | if ( mSyncMode ) { |
635 | if ( clearV ) | 650 | if ( clearV ) |
636 | appendJournal(event, 1); | 651 | appendJournal(event, 1); |
637 | else | 652 | else |
638 | appendJournal(event, 2); | 653 | appendJournal(event, 2); |
639 | } else | 654 | } else |
640 | appendJournal(event); | 655 | appendJournal(event); |
641 | } | 656 | } |
642 | 657 | ||
643 | void KOEventViewer::setEvent(Event *event) | 658 | void KOEventViewer::setEvent(Event *event) |
644 | { | 659 | { |
645 | clearEvents(); | 660 | clearEvents(); |
646 | if ( mSyncMode ) | 661 | if ( mSyncMode ) |
647 | appendEvent(event, 1); | 662 | appendEvent(event, 1); |
648 | else | 663 | else |
649 | appendEvent(event); | 664 | appendEvent(event); |
650 | } | 665 | } |
651 | 666 | ||
652 | void KOEventViewer::addEvent(Event *event) | 667 | void KOEventViewer::addEvent(Event *event) |
653 | { | 668 | { |
654 | if ( mSyncMode ) | 669 | if ( mSyncMode ) |
655 | appendEvent(event, 2); | 670 | appendEvent(event, 2); |
656 | else | 671 | else |
657 | appendEvent(event); | 672 | appendEvent(event); |
658 | } | 673 | } |
659 | 674 | ||
660 | void KOEventViewer::clearEvents(bool now) | 675 | void KOEventViewer::clearEvents(bool now) |
661 | { | 676 | { |
662 | mText = ""; | 677 | mText = ""; |
663 | if (now) setText(mText); | 678 | if (now) setText(mText); |
664 | } | 679 | } |
665 | 680 | ||
666 | void KOEventViewer::addText(QString text) | 681 | void KOEventViewer::addText(QString text) |
667 | { | 682 | { |
668 | mText.append(text); | 683 | mText.append(text); |
669 | setText(mText); | 684 | setText(mText); |
670 | } | 685 | } |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index d8e940b..1f5afc0 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -1,1183 +1,1186 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 1999 Preston Brown | 3 | Copyright (c) 1999 Preston Brown |
4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qlistview.h> | 25 | #include <qlistview.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
29 | #include <qprogressbar.h> | 29 | #include <qprogressbar.h> |
30 | #include <qfileinfo.h> | 30 | #include <qfileinfo.h> |
31 | #include <qmessagebox.h> | 31 | #include <qmessagebox.h> |
32 | #include <qdialog.h> | 32 | #include <qdialog.h> |
33 | #include <qtextstream.h> | 33 | #include <qtextstream.h> |
34 | #include <qdir.h> | 34 | #include <qdir.h> |
35 | #include <qwhatsthis.h> | 35 | #include <qwhatsthis.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | 37 | ||
38 | #include <klocale.h> | 38 | #include <klocale.h> |
39 | #include <kdebug.h> | 39 | #include <kdebug.h> |
40 | #include <kiconloader.h> | 40 | #include <kiconloader.h> |
41 | #include <kglobal.h> | 41 | #include <kglobal.h> |
42 | 42 | ||
43 | #include <libkdepim/kpimglobalprefs.h> | 43 | #include <libkdepim/kpimglobalprefs.h> |
44 | #include <libkcal/calendar.h> | 44 | #include <libkcal/calendar.h> |
45 | #include <libkcal/calendarlocal.h> | 45 | #include <libkcal/calendarlocal.h> |
46 | #include <libkcal/icalformat.h> | 46 | #include <libkcal/icalformat.h> |
47 | #include <libkcal/vcalformat.h> | 47 | #include <libkcal/vcalformat.h> |
48 | #include <libkcal/recurrence.h> | 48 | #include <libkcal/recurrence.h> |
49 | #include <libkcal/filestorage.h> | 49 | #include <libkcal/filestorage.h> |
50 | #include <libkdepim/categoryselectdialog.h> | 50 | #include <libkdepim/categoryselectdialog.h> |
51 | #include <libkcal/kincidenceformatter.h> | 51 | #include <libkcal/kincidenceformatter.h> |
52 | #ifndef DESKTOP_VERSION | 52 | #ifndef DESKTOP_VERSION |
53 | #include <qpe/qpeapplication.h> | 53 | #include <qpe/qpeapplication.h> |
54 | #else | 54 | #else |
55 | #include <qapplication.h> | 55 | #include <qapplication.h> |
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | #ifndef KORG_NOPRINTER | 58 | #ifndef KORG_NOPRINTER |
59 | #include "calprinter.h" | 59 | #include "calprinter.h" |
60 | #endif | 60 | #endif |
61 | #include "koglobals.h" | 61 | #include "koglobals.h" |
62 | #include "koprefs.h" | 62 | #include "koprefs.h" |
63 | #include "kfiledialog.h" | 63 | #include "kfiledialog.h" |
64 | 64 | ||
65 | #include "kolistview.h" | 65 | #include "kolistview.h" |
66 | 66 | ||
67 | 67 | ||
68 | 68 | ||
69 | 69 | ||
70 | class KOListViewWhatsThis :public QWhatsThis | 70 | class KOListViewWhatsThis :public QWhatsThis |
71 | { | 71 | { |
72 | public: | 72 | public: |
73 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; | 73 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; |
74 | 74 | ||
75 | protected: | 75 | protected: |
76 | virtual QString text( const QPoint& p) | 76 | virtual QString text( const QPoint& p) |
77 | { | 77 | { |
78 | return _view->getWhatsThisText(p) ; | 78 | return _view->getWhatsThisText(p) ; |
79 | } | 79 | } |
80 | private: | 80 | private: |
81 | QWidget* _wid; | 81 | QWidget* _wid; |
82 | KOListView * _view; | 82 | KOListView * _view; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | 85 | ||
86 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) | 86 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) |
87 | { | 87 | { |
88 | mItem = item; | 88 | mItem = item; |
89 | mDate = date; | 89 | mDate = date; |
90 | } | 90 | } |
91 | 91 | ||
92 | ListItemVisitor::~ListItemVisitor() | 92 | ListItemVisitor::~ListItemVisitor() |
93 | { | 93 | { |
94 | } | 94 | } |
95 | 95 | ||
96 | bool ListItemVisitor::visit(Event *e) | 96 | bool ListItemVisitor::visit(Event *e) |
97 | { | 97 | { |
98 | 98 | ||
99 | bool ok = false; | 99 | bool ok = false; |
100 | QString start, end; | 100 | QString start, end; |
101 | QDate ds, de; | 101 | QDate ds, de; |
102 | if ( e->doesRecur() ) { | 102 | if ( e->doesRecur() ) { |
103 | ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); | 103 | ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); |
104 | if ( ok ) { | 104 | if ( ok ) { |
105 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); | 105 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); |
106 | start = KGlobal::locale()->formatDate(ds,true); | 106 | start = KGlobal::locale()->formatDate(ds,true); |
107 | de = ds.addDays( days); | 107 | de = ds.addDays( days); |
108 | end = KGlobal::locale()->formatDate(de,true); | 108 | end = KGlobal::locale()->formatDate(de,true); |
109 | } | 109 | } |
110 | 110 | ||
111 | } | 111 | } |
112 | if ( ! ok ) { | 112 | if ( ! ok ) { |
113 | start =e->dtStartDateStr(); | 113 | start =e->dtStartDateStr(); |
114 | end = e->dtEndDateStr(); | 114 | end = e->dtEndDateStr(); |
115 | ds = e->dtStart().date(); | 115 | ds = e->dtStart().date(); |
116 | de = e->dtEnd().date(); | 116 | de = e->dtEnd().date(); |
117 | } | 117 | } |
118 | mItem->setText(0,e->summary()); | 118 | mItem->setText(0,e->summary()); |
119 | mItem->setText(1,start); | 119 | mItem->setText(1,start); |
120 | mItem->setText(2,e->dtStartTimeStr()); | 120 | mItem->setText(2,e->dtStartTimeStr()); |
121 | mItem->setText(3,end); | 121 | mItem->setText(3,end); |
122 | mItem->setText(4,e->dtEndTimeStr()); | 122 | mItem->setText(4,e->dtEndTimeStr()); |
123 | mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); | 123 | mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); |
124 | mItem->setText(6, e->recurrence()->recurrenceText()); | 124 | mItem->setText(6, e->recurrence()->recurrenceText()); |
125 | mItem->setText(7,"---"); | 125 | mItem->setText(7,"---"); |
126 | mItem->setText(8,"---"); | 126 | mItem->setText(8,"---"); |
127 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); | 127 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); |
128 | mItem->setText(10,e->categoriesStr()); | 128 | mItem->setText(10,e->categoriesStr()); |
129 | 129 | ||
130 | QString key; | 130 | QString key; |
131 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); | 131 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); |
132 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); | 132 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); |
133 | mItem->setSortKey(1,key); | 133 | mItem->setSortKey(1,key); |
134 | 134 | ||
135 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); | 135 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); |
136 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); | 136 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); |
137 | mItem->setSortKey(3,key); | 137 | mItem->setSortKey(3,key); |
138 | 138 | ||
139 | return true; | 139 | return true; |
140 | } | 140 | } |
141 | 141 | ||
142 | bool ListItemVisitor::visit(Todo *t) | 142 | bool ListItemVisitor::visit(Todo *t) |
143 | { | 143 | { |
144 | mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); | 144 | mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); |
145 | if (t->hasStartDate()) { | 145 | if (t->hasStartDate()) { |
146 | mItem->setText(1,t->dtStartDateStr()); | 146 | mItem->setText(1,t->dtStartDateStr()); |
147 | if (t->doesFloat()) { | 147 | if (t->doesFloat()) { |
148 | mItem->setText(2,"---"); | 148 | mItem->setText(2,"---"); |
149 | } else { | 149 | } else { |
150 | mItem->setText(2,t->dtStartTimeStr()); | 150 | mItem->setText(2,t->dtStartTimeStr()); |
151 | } | 151 | } |
152 | } else { | 152 | } else { |
153 | mItem->setText(1,"---"); | 153 | mItem->setText(1,"---"); |
154 | mItem->setText(2,"---"); | 154 | mItem->setText(2,"---"); |
155 | } | 155 | } |
156 | mItem->setText(3,"---"); | 156 | mItem->setText(3,"---"); |
157 | mItem->setText(4,"---"); | 157 | mItem->setText(4,"---"); |
158 | mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No")); | 158 | mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No")); |
159 | mItem->setText(6, t->recurrence()->recurrenceText()); | 159 | mItem->setText(6, t->recurrence()->recurrenceText()); |
160 | if (t->hasDueDate()) { | 160 | if (t->hasDueDate()) { |
161 | mItem->setText(7,t->dtDueDateStr()); | 161 | mItem->setText(7,t->dtDueDateStr()); |
162 | if (t->doesFloat()) { | 162 | if (t->doesFloat()) { |
163 | mItem->setText(8,"---"); | 163 | mItem->setText(8,"---"); |
164 | } else { | 164 | } else { |
165 | mItem->setText(8,t->dtDueTimeStr()); | 165 | mItem->setText(8,t->dtDueTimeStr()); |
166 | } | 166 | } |
167 | } else { | 167 | } else { |
168 | mItem->setText(7,"---"); | 168 | mItem->setText(7,"---"); |
169 | mItem->setText(8,"---"); | 169 | mItem->setText(8,"---"); |
170 | } | 170 | } |
171 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); | 171 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); |
172 | mItem->setText(10,t->categoriesStr()); | 172 | mItem->setText(10,t->categoriesStr()); |
173 | 173 | ||
174 | QString key; | 174 | QString key; |
175 | QDate d; | 175 | QDate d; |
176 | if (t->hasDueDate()) { | 176 | if (t->hasDueDate()) { |
177 | d = t->dtDue().date(); | 177 | d = t->dtDue().date(); |
178 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); | 178 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); |
179 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 179 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
180 | mItem->setSortKey(7,key); | 180 | mItem->setSortKey(7,key); |
181 | } | 181 | } |
182 | if ( t->hasStartDate() ) { | 182 | if ( t->hasStartDate() ) { |
183 | d = t->dtStart().date(); | 183 | d = t->dtStart().date(); |
184 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); | 184 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); |
185 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 185 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
186 | mItem->setSortKey(1,key); | 186 | mItem->setSortKey(1,key); |
187 | } | 187 | } |
188 | return true; | 188 | return true; |
189 | } | 189 | } |
190 | 190 | ||
191 | bool ListItemVisitor::visit(Journal * j) | 191 | bool ListItemVisitor::visit(Journal * j) |
192 | { | 192 | { |
193 | QString des = j->description().left(50); | 193 | QString des = j->description().left(50); |
194 | des = des.simplifyWhiteSpace (); | 194 | des = des.simplifyWhiteSpace (); |
195 | des.replace (QRegExp ("\\n"),"" ); | 195 | des.replace (QRegExp ("\\n"),"" ); |
196 | des.replace (QRegExp ("\\r"),"" ); | 196 | des.replace (QRegExp ("\\r"),"" ); |
197 | mItem->setText(0,i18n("Journal")+": "+des.left(25)); | 197 | mItem->setText(0,i18n("Journal")+": "+des.left(25)); |
198 | mItem->setText(1,j->dtStartDateStr()); | 198 | mItem->setText(1,j->dtStartDateStr()); |
199 | mItem->setText(2,"---"); | 199 | mItem->setText(2,"---"); |
200 | mItem->setText(3,"---"); | 200 | mItem->setText(3,"---"); |
201 | mItem->setText(4,"---"); | 201 | mItem->setText(4,"---"); |
202 | mItem->setText(5,"---"); | 202 | mItem->setText(5,"---"); |
203 | mItem->setText(6,"---"); | 203 | mItem->setText(6,"---"); |
204 | mItem->setText(7,j->dtStartDateStr()); | 204 | mItem->setText(7,j->dtStartDateStr()); |
205 | mItem->setText(8,"---"); | 205 | mItem->setText(8,"---"); |
206 | mItem->setText(9,"---"); | 206 | mItem->setText(9,"---"); |
207 | mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); | 207 | mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); |
208 | 208 | ||
209 | QString key; | 209 | QString key; |
210 | QDate d = j->dtStart().date(); | 210 | QDate d = j->dtStart().date(); |
211 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 211 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
212 | mItem->setSortKey(1,key); | 212 | mItem->setSortKey(1,key); |
213 | mItem->setSortKey(7,key); | 213 | mItem->setSortKey(7,key); |
214 | 214 | ||
215 | return true; | 215 | return true; |
216 | } | 216 | } |
217 | 217 | ||
218 | KOListView::KOListView(Calendar *calendar, QWidget *parent, | 218 | KOListView::KOListView(Calendar *calendar, QWidget *parent, |
219 | const char *name) | 219 | const char *name) |
220 | : KOEventView(calendar, parent, name) | 220 | : KOEventView(calendar, parent, name) |
221 | { | 221 | { |
222 | mActiveItem = 0; | 222 | mActiveItem = 0; |
223 | mListView = new KOListViewListView(this); | 223 | mListView = new KOListViewListView(this); |
224 | mListView->addColumn(i18n("Summary")); | 224 | mListView->addColumn(i18n("Summary")); |
225 | mListView->addColumn(i18n("Start Date")); | 225 | mListView->addColumn(i18n("Start Date")); |
226 | mListView->addColumn(i18n("Start Time")); | 226 | mListView->addColumn(i18n("Start Time")); |
227 | mListView->addColumn(i18n("End Date")); | 227 | mListView->addColumn(i18n("End Date")); |
228 | mListView->addColumn(i18n("End Time")); | 228 | mListView->addColumn(i18n("End Time")); |
229 | mListView->addColumn(i18n("Alarm")); // alarm set? | 229 | mListView->addColumn(i18n("Alarm")); // alarm set? |
230 | mListView->addColumn(i18n("Recurs")); // recurs? | 230 | mListView->addColumn(i18n("Recurs")); // recurs? |
231 | mListView->addColumn(i18n("Due Date")); | 231 | mListView->addColumn(i18n("Due Date")); |
232 | mListView->addColumn(i18n("Due Time")); | 232 | mListView->addColumn(i18n("Due Time")); |
233 | mListView->addColumn(i18n("Cancelled")); | 233 | mListView->addColumn(i18n("Cancelled")); |
234 | mListView->addColumn(i18n("Categories")); | 234 | mListView->addColumn(i18n("Categories")); |
235 | 235 | ||
236 | mListView->setColumnAlignment(0,AlignLeft); | 236 | mListView->setColumnAlignment(0,AlignLeft); |
237 | mListView->setColumnAlignment(1,AlignLeft); | 237 | mListView->setColumnAlignment(1,AlignLeft); |
238 | mListView->setColumnAlignment(2,AlignHCenter); | 238 | mListView->setColumnAlignment(2,AlignHCenter); |
239 | mListView->setColumnAlignment(3,AlignLeft); | 239 | mListView->setColumnAlignment(3,AlignLeft); |
240 | mListView->setColumnAlignment(4,AlignHCenter); | 240 | mListView->setColumnAlignment(4,AlignHCenter); |
241 | mListView->setColumnAlignment(5,AlignLeft); | 241 | mListView->setColumnAlignment(5,AlignLeft); |
242 | mListView->setColumnAlignment(6,AlignLeft); | 242 | mListView->setColumnAlignment(6,AlignLeft); |
243 | mListView->setColumnAlignment(7,AlignLeft); | 243 | mListView->setColumnAlignment(7,AlignLeft); |
244 | mListView->setColumnAlignment(8,AlignLeft); | 244 | mListView->setColumnAlignment(8,AlignLeft); |
245 | mListView->setColumnAlignment(9,AlignLeft); | 245 | mListView->setColumnAlignment(9,AlignLeft); |
246 | mListView->setColumnAlignment(10,AlignLeft); | 246 | mListView->setColumnAlignment(10,AlignLeft); |
247 | mListView->setColumnWidthMode(10, QListView::Manual); | 247 | mListView->setColumnWidthMode(10, QListView::Manual); |
248 | new KOListViewWhatsThis(mListView->viewport(),this); | 248 | new KOListViewWhatsThis(mListView->viewport(),this); |
249 | 249 | ||
250 | int iii = 0; | 250 | int iii = 0; |
251 | for ( iii = 0; iii< 10 ; ++iii ) | 251 | for ( iii = 0; iii< 10 ; ++iii ) |
252 | mListView->setColumnWidthMode( iii, QListView::Manual ); | 252 | mListView->setColumnWidthMode( iii, QListView::Manual ); |
253 | 253 | ||
254 | QBoxLayout *layoutTop = new QVBoxLayout(this); | 254 | QBoxLayout *layoutTop = new QVBoxLayout(this); |
255 | layoutTop->addWidget(mListView); | 255 | layoutTop->addWidget(mListView); |
256 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 256 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
257 | mPopupMenu = eventPopup(); | 257 | mPopupMenu = eventPopup(); |
258 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 258 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
259 | i18n("Select all"),this, | 259 | i18n("Select all"),this, |
260 | SLOT(allSelection()),true); | 260 | SLOT(allSelection()),true); |
261 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 261 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
262 | i18n("Deselect all"),this, | 262 | i18n("Deselect all"),this, |
263 | SLOT(clearSelection()),true); | 263 | SLOT(clearSelection()),true); |
264 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 264 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
265 | i18n("Delete all selected"),this, | 265 | i18n("Delete all selected"),this, |
266 | SLOT(deleteAll()),true); | 266 | SLOT(deleteAll()),true); |
267 | mPopupMenu->insertSeparator(); | 267 | mPopupMenu->insertSeparator(); |
268 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 268 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
269 | i18n("Save selected to file..."),this, | 269 | i18n("Save selected to file..."),this, |
270 | SLOT(saveToFile()),true); | 270 | SLOT(saveToFile()),true); |
271 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 271 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
272 | i18n("Save Journal/Description..."),this, | 272 | i18n("Save Journal/Description..."),this, |
273 | SLOT(saveDescriptionToFile()),true); | 273 | SLOT(saveDescriptionToFile()),true); |
274 | // mPopupMenu->insertSeparator(); | 274 | // mPopupMenu->insertSeparator(); |
275 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 275 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
276 | i18n("Add Categ. to selected..."),this, | 276 | i18n("Add Categ. to selected..."),this, |
277 | SLOT(addCat()),true); | 277 | SLOT(addCat()),true); |
278 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 278 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
279 | i18n("Set Categ. for selected..."),this, | 279 | i18n("Set Categ. for selected..."),this, |
280 | SLOT(setCat()),true); | 280 | SLOT(setCat()),true); |
281 | //mPopupMenu->insertSeparator(); | 281 | //mPopupMenu->insertSeparator(); |
282 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 282 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
283 | i18n("Set alarm for selected..."),this, | 283 | i18n("Set alarm for selected..."),this, |
284 | SLOT(setAlarm()),true); | 284 | SLOT(setAlarm()),true); |
285 | 285 | ||
286 | 286 | ||
287 | #ifndef DESKTOP_VERSION | 287 | #ifndef DESKTOP_VERSION |
288 | mPopupMenu->insertSeparator(); | 288 | mPopupMenu->insertSeparator(); |
289 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 289 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
290 | i18n("Beam selected via IR"),this, | 290 | i18n("Beam selected via IR"),this, |
291 | SLOT(beamSelected()),true); | 291 | SLOT(beamSelected()),true); |
292 | #endif | 292 | #endif |
293 | /* | 293 | /* |
294 | mPopupMenu = new QPopupMenu; | 294 | mPopupMenu = new QPopupMenu; |
295 | mPopupMenu->insertItem(i18n("Edit Event"), this, | 295 | mPopupMenu->insertItem(i18n("Edit Event"), this, |
296 | SLOT (editEvent())); | 296 | SLOT (editEvent())); |
297 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, | 297 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, |
298 | SLOT (deleteEvent())); | 298 | SLOT (deleteEvent())); |
299 | mPopupMenu->insertSeparator(); | 299 | mPopupMenu->insertSeparator(); |
300 | mPopupMenu->insertItem(i18n("Show Dates"), this, | 300 | mPopupMenu->insertItem(i18n("Show Dates"), this, |
301 | SLOT(showDates())); | 301 | SLOT(showDates())); |
302 | mPopupMenu->insertItem(i18n("Hide Dates"), this, | 302 | mPopupMenu->insertItem(i18n("Hide Dates"), this, |
303 | SLOT(hideDates())); | 303 | SLOT(hideDates())); |
304 | */ | 304 | */ |
305 | QObject::connect(mListView,SIGNAL( newEvent()), | 305 | QObject::connect(mListView,SIGNAL( newEvent()), |
306 | this,SIGNAL(signalNewEvent())); | 306 | this,SIGNAL(signalNewEvent())); |
307 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), | 307 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), |
308 | this,SLOT(defaultItemAction(QListViewItem *))); | 308 | this,SLOT(defaultItemAction(QListViewItem *))); |
309 | QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *, | 309 | QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *, |
310 | const QPoint &, int )), | 310 | const QPoint &, int )), |
311 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); | 311 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); |
312 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), | 312 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), |
313 | SLOT(processSelectionChange(QListViewItem *))); | 313 | SLOT(processSelectionChange(QListViewItem *))); |
314 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), | 314 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), |
315 | SIGNAL(showIncidenceSignal(Incidence *)) ); | 315 | SIGNAL(showIncidenceSignal(Incidence *)) ); |
316 | 316 | ||
317 | readSettings(KOGlobals::config(),"KOListView Layout"); | 317 | readSettings(KOGlobals::config(),"KOListView Layout"); |
318 | } | 318 | } |
319 | 319 | ||
320 | KOListView::~KOListView() | 320 | KOListView::~KOListView() |
321 | { | 321 | { |
322 | delete mPopupMenu; | 322 | delete mPopupMenu; |
323 | } | 323 | } |
324 | QString KOListView::getWhatsThisText(QPoint p) | 324 | QString KOListView::getWhatsThisText(QPoint p) |
325 | { | 325 | { |
326 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); | 326 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); |
327 | if ( item ) | 327 | if ( item ) |
328 | return KIncidenceFormatter::instance()->getFormattedText( item->data() ); | 328 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), |
329 | KOPrefs::instance()->mWTshowDetails, | ||
330 | KOPrefs::instance()->mWTshowCreated, | ||
331 | KOPrefs::instance()->mWTshowChanged); | ||
329 | return i18n("That is the list view" ); | 332 | return i18n("That is the list view" ); |
330 | 333 | ||
331 | } | 334 | } |
332 | 335 | ||
333 | void KOListView::updateList() | 336 | void KOListView::updateList() |
334 | { | 337 | { |
335 | // qDebug(" KOListView::updateList() "); | 338 | // qDebug(" KOListView::updateList() "); |
336 | 339 | ||
337 | } | 340 | } |
338 | 341 | ||
339 | void KOListView::addCat( ) | 342 | void KOListView::addCat( ) |
340 | { | 343 | { |
341 | setCategories( false ); | 344 | setCategories( false ); |
342 | } | 345 | } |
343 | void KOListView::setCat() | 346 | void KOListView::setCat() |
344 | { | 347 | { |
345 | setCategories( true ); | 348 | setCategories( true ); |
346 | } | 349 | } |
347 | void KOListView::setAlarm() | 350 | void KOListView::setAlarm() |
348 | { | 351 | { |
349 | KOAlarmPrefs kap( this); | 352 | KOAlarmPrefs kap( this); |
350 | if ( !kap.exec() ) | 353 | if ( !kap.exec() ) |
351 | return; | 354 | return; |
352 | 355 | ||
353 | 356 | ||
354 | QStringList itemList; | 357 | QStringList itemList; |
355 | QPtrList<KOListViewItem> sel ; | 358 | QPtrList<KOListViewItem> sel ; |
356 | QListViewItem *qitem = mListView->firstChild (); | 359 | QListViewItem *qitem = mListView->firstChild (); |
357 | while ( qitem ) { | 360 | while ( qitem ) { |
358 | if ( qitem->isSelected() ) { | 361 | if ( qitem->isSelected() ) { |
359 | Incidence* inc = ((KOListViewItem *) qitem)->data(); | 362 | Incidence* inc = ((KOListViewItem *) qitem)->data(); |
360 | if ( inc->type() != "Journal" ) { | 363 | if ( inc->type() != "Journal" ) { |
361 | if ( inc->type() == "Todo" ) { | 364 | if ( inc->type() == "Todo" ) { |
362 | if ( ((Todo*)inc)->hasDueDate() ) | 365 | if ( ((Todo*)inc)->hasDueDate() ) |
363 | sel.append(((KOListViewItem *)qitem)); | 366 | sel.append(((KOListViewItem *)qitem)); |
364 | } else | 367 | } else |
365 | sel.append(((KOListViewItem *)qitem)); | 368 | sel.append(((KOListViewItem *)qitem)); |
366 | } | 369 | } |
367 | } | 370 | } |
368 | qitem = qitem->nextSibling(); | 371 | qitem = qitem->nextSibling(); |
369 | } | 372 | } |
370 | int count = 0; | 373 | int count = 0; |
371 | KOListViewItem * item, *temp; | 374 | KOListViewItem * item, *temp; |
372 | item = sel.first(); | 375 | item = sel.first(); |
373 | Incidence* inc; | 376 | Incidence* inc; |
374 | while ( item ) { | 377 | while ( item ) { |
375 | inc = item->data(); | 378 | inc = item->data(); |
376 | ++count; | 379 | ++count; |
377 | if (kap.mAlarmButton->isChecked()) { | 380 | if (kap.mAlarmButton->isChecked()) { |
378 | if (inc->alarms().count() == 0) | 381 | if (inc->alarms().count() == 0) |
379 | inc->newAlarm(); | 382 | inc->newAlarm(); |
380 | QPtrList<Alarm> alarms = inc->alarms(); | 383 | QPtrList<Alarm> alarms = inc->alarms(); |
381 | Alarm *alarm; | 384 | Alarm *alarm; |
382 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 385 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
383 | alarm->setEnabled(true); | 386 | alarm->setEnabled(true); |
384 | int j = kap.mAlarmTimeEdit->value()* -60; | 387 | int j = kap.mAlarmTimeEdit->value()* -60; |
385 | if (kap.mAlarmIncrCombo->currentItem() == 1) | 388 | if (kap.mAlarmIncrCombo->currentItem() == 1) |
386 | j = j * 60; | 389 | j = j * 60; |
387 | else if (kap.mAlarmIncrCombo->currentItem() == 2) | 390 | else if (kap.mAlarmIncrCombo->currentItem() == 2) |
388 | j = j * (60 * 24); | 391 | j = j * (60 * 24); |
389 | alarm->setStartOffset( j ); | 392 | alarm->setStartOffset( j ); |
390 | 393 | ||
391 | if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { | 394 | if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { |
392 | alarm->setProcedureAlarm(kap.mAlarmProgram); | 395 | alarm->setProcedureAlarm(kap.mAlarmProgram); |
393 | } | 396 | } |
394 | else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) | 397 | else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) |
395 | alarm->setAudioAlarm(kap.mAlarmSound); | 398 | alarm->setAudioAlarm(kap.mAlarmSound); |
396 | else | 399 | else |
397 | alarm->setType(Alarm::Invalid); | 400 | alarm->setType(Alarm::Invalid); |
398 | //alarm->setAudioAlarm("default"); | 401 | //alarm->setAudioAlarm("default"); |
399 | // TODO: Deal with multiple alarms | 402 | // TODO: Deal with multiple alarms |
400 | break; // For now, stop after the first alarm | 403 | break; // For now, stop after the first alarm |
401 | } | 404 | } |
402 | } else { | 405 | } else { |
403 | Alarm* alarm = inc->alarms().first(); | 406 | Alarm* alarm = inc->alarms().first(); |
404 | if ( alarm ) { | 407 | if ( alarm ) { |
405 | alarm->setEnabled(false); | 408 | alarm->setEnabled(false); |
406 | alarm->setType(Alarm::Invalid); | 409 | alarm->setType(Alarm::Invalid); |
407 | } | 410 | } |
408 | } | 411 | } |
409 | temp = item; | 412 | temp = item; |
410 | item = sel.next(); | 413 | item = sel.next(); |
411 | mUidDict.remove( inc->uid() ); | 414 | mUidDict.remove( inc->uid() ); |
412 | delete temp;; | 415 | delete temp;; |
413 | addIncidence( inc ); | 416 | addIncidence( inc ); |
414 | } | 417 | } |
415 | topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) ); | 418 | topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) ); |
416 | qDebug("KO: Set alarm for %d items", count); | 419 | qDebug("KO: Set alarm for %d items", count); |
417 | calendar()->reInitAlarmSettings(); | 420 | calendar()->reInitAlarmSettings(); |
418 | } | 421 | } |
419 | void KOListView::setCategories( bool removeOld ) | 422 | void KOListView::setCategories( bool removeOld ) |
420 | { | 423 | { |
421 | 424 | ||
422 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 425 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
423 | if (! csd->exec()) { | 426 | if (! csd->exec()) { |
424 | delete csd; | 427 | delete csd; |
425 | return; | 428 | return; |
426 | } | 429 | } |
427 | QStringList catList = csd->selectedCategories(); | 430 | QStringList catList = csd->selectedCategories(); |
428 | delete csd; | 431 | delete csd; |
429 | // if ( catList.count() == 0 ) | 432 | // if ( catList.count() == 0 ) |
430 | // return; | 433 | // return; |
431 | catList.sort(); | 434 | catList.sort(); |
432 | QString categoriesStr = catList.join(","); | 435 | QString categoriesStr = catList.join(","); |
433 | int i; | 436 | int i; |
434 | QStringList itemList; | 437 | QStringList itemList; |
435 | QPtrList<KOListViewItem> sel ; | 438 | QPtrList<KOListViewItem> sel ; |
436 | QListViewItem *qitem = mListView->firstChild (); | 439 | QListViewItem *qitem = mListView->firstChild (); |
437 | while ( qitem ) { | 440 | while ( qitem ) { |
438 | if ( qitem->isSelected() ) { | 441 | if ( qitem->isSelected() ) { |
439 | sel.append(((KOListViewItem *)qitem)); | 442 | sel.append(((KOListViewItem *)qitem)); |
440 | } | 443 | } |
441 | qitem = qitem->nextSibling(); | 444 | qitem = qitem->nextSibling(); |
442 | } | 445 | } |
443 | KOListViewItem * item, *temp; | 446 | KOListViewItem * item, *temp; |
444 | item = sel.first(); | 447 | item = sel.first(); |
445 | Incidence* inc; | 448 | Incidence* inc; |
446 | while ( item ) { | 449 | while ( item ) { |
447 | inc = item->data(); | 450 | inc = item->data(); |
448 | if ( removeOld ) { | 451 | if ( removeOld ) { |
449 | inc->setCategories( categoriesStr ); | 452 | inc->setCategories( categoriesStr ); |
450 | } else { | 453 | } else { |
451 | itemList = QStringList::split (",", inc->categoriesStr() ); | 454 | itemList = QStringList::split (",", inc->categoriesStr() ); |
452 | for( i = 0; i< catList.count(); ++i ) { | 455 | for( i = 0; i< catList.count(); ++i ) { |
453 | if ( !itemList.contains (catList[i])) | 456 | if ( !itemList.contains (catList[i])) |
454 | itemList.append( catList[i] ); | 457 | itemList.append( catList[i] ); |
455 | } | 458 | } |
456 | itemList.sort(); | 459 | itemList.sort(); |
457 | inc->setCategories( itemList.join(",") ); | 460 | inc->setCategories( itemList.join(",") ); |
458 | } | 461 | } |
459 | temp = item; | 462 | temp = item; |
460 | item = sel.next(); | 463 | item = sel.next(); |
461 | mUidDict.remove( inc->uid() ); | 464 | mUidDict.remove( inc->uid() ); |
462 | delete temp;; | 465 | delete temp;; |
463 | addIncidence( inc ); | 466 | addIncidence( inc ); |
464 | } | 467 | } |
465 | } | 468 | } |
466 | 469 | ||
467 | void KOListView::beamSelected() | 470 | void KOListView::beamSelected() |
468 | { | 471 | { |
469 | int icount = 0; | 472 | int icount = 0; |
470 | QPtrList<Incidence> delSel ; | 473 | QPtrList<Incidence> delSel ; |
471 | QListViewItem *item = mListView->firstChild (); | 474 | QListViewItem *item = mListView->firstChild (); |
472 | while ( item ) { | 475 | while ( item ) { |
473 | if ( item->isSelected() ) { | 476 | if ( item->isSelected() ) { |
474 | delSel.append(((KOListViewItem *)item)->data()); | 477 | delSel.append(((KOListViewItem *)item)->data()); |
475 | ++icount; | 478 | ++icount; |
476 | } | 479 | } |
477 | 480 | ||
478 | item = item->nextSibling(); | 481 | item = item->nextSibling(); |
479 | } | 482 | } |
480 | if ( icount ) { | 483 | if ( icount ) { |
481 | emit beamIncidenceList( delSel ); | 484 | emit beamIncidenceList( delSel ); |
482 | return; | 485 | return; |
483 | QString fn ; | 486 | QString fn ; |
484 | fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; | 487 | fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; |
485 | QString mes; | 488 | QString mes; |
486 | bool createbup = true; | 489 | bool createbup = true; |
487 | if ( createbup ) { | 490 | if ( createbup ) { |
488 | QString description = "\n"; | 491 | QString description = "\n"; |
489 | CalendarLocal* cal = new CalendarLocal(); | 492 | CalendarLocal* cal = new CalendarLocal(); |
490 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 493 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
491 | Incidence *incidence = delSel.first(); | 494 | Incidence *incidence = delSel.first(); |
492 | while ( incidence ) { | 495 | while ( incidence ) { |
493 | Incidence *in = incidence->clone(); | 496 | Incidence *in = incidence->clone(); |
494 | description += in->summary() + "\n"; | 497 | description += in->summary() + "\n"; |
495 | cal->addIncidence( in ); | 498 | cal->addIncidence( in ); |
496 | incidence = delSel.next(); | 499 | incidence = delSel.next(); |
497 | } | 500 | } |
498 | FileStorage storage( cal, fn, new VCalFormat ); | 501 | FileStorage storage( cal, fn, new VCalFormat ); |
499 | storage.save(); | 502 | storage.save(); |
500 | delete cal; | 503 | delete cal; |
501 | mes = i18n("KO/Pi: Ready for beaming"); | 504 | mes = i18n("KO/Pi: Ready for beaming"); |
502 | topLevelWidget()->setCaption(mes); | 505 | topLevelWidget()->setCaption(mes); |
503 | 506 | ||
504 | #ifndef DESKTOP_VERSION | 507 | #ifndef DESKTOP_VERSION |
505 | Ir *ir = new Ir( this ); | 508 | Ir *ir = new Ir( this ); |
506 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 509 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
507 | ir->send( fn, description, "text/x-vCalendar" ); | 510 | ir->send( fn, description, "text/x-vCalendar" ); |
508 | #endif | 511 | #endif |
509 | } | 512 | } |
510 | } | 513 | } |
511 | } | 514 | } |
512 | void KOListView::beamDone( Ir *ir ) | 515 | void KOListView::beamDone( Ir *ir ) |
513 | { | 516 | { |
514 | #ifndef DESKTOP_VERSION | 517 | #ifndef DESKTOP_VERSION |
515 | delete ir; | 518 | delete ir; |
516 | #endif | 519 | #endif |
517 | topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); | 520 | topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); |
518 | } | 521 | } |
519 | 522 | ||
520 | void KOListView::saveDescriptionToFile() | 523 | void KOListView::saveDescriptionToFile() |
521 | { | 524 | { |
522 | 525 | ||
523 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), | 526 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), |
524 | i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), | 527 | i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), |
525 | i18n("Continue"), i18n("Cancel"), 0, | 528 | i18n("Continue"), i18n("Cancel"), 0, |
526 | 0, 1 ); | 529 | 0, 1 ); |
527 | if ( result != 0 ) { | 530 | if ( result != 0 ) { |
528 | return; | 531 | return; |
529 | } | 532 | } |
530 | int icount = 0; | 533 | int icount = 0; |
531 | QPtrList<Incidence> delSel ; | 534 | QPtrList<Incidence> delSel ; |
532 | QListViewItem *item = mListView->firstChild (); | 535 | QListViewItem *item = mListView->firstChild (); |
533 | while ( item ) { | 536 | while ( item ) { |
534 | if ( item->isSelected() ) { | 537 | if ( item->isSelected() ) { |
535 | delSel.append(((KOListViewItem *)item)->data()); | 538 | delSel.append(((KOListViewItem *)item)->data()); |
536 | ++icount; | 539 | ++icount; |
537 | } | 540 | } |
538 | 541 | ||
539 | item = item->nextSibling(); | 542 | item = item->nextSibling(); |
540 | } | 543 | } |
541 | if ( icount ) { | 544 | if ( icount ) { |
542 | QString fn = KOPrefs::instance()->mLastSaveFile; | 545 | QString fn = KOPrefs::instance()->mLastSaveFile; |
543 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); | 546 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); |
544 | 547 | ||
545 | if ( fn == "" ) | 548 | if ( fn == "" ) |
546 | return; | 549 | return; |
547 | QFileInfo info; | 550 | QFileInfo info; |
548 | info.setFile( fn ); | 551 | info.setFile( fn ); |
549 | QString mes; | 552 | QString mes; |
550 | bool createbup = true; | 553 | bool createbup = true; |
551 | if ( info. exists() ) { | 554 | if ( info. exists() ) { |
552 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 555 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
553 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 556 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
554 | i18n("Overwrite!"), i18n("Cancel"), 0, | 557 | i18n("Overwrite!"), i18n("Cancel"), 0, |
555 | 0, 1 ); | 558 | 0, 1 ); |
556 | if ( result != 0 ) { | 559 | if ( result != 0 ) { |
557 | createbup = false; | 560 | createbup = false; |
558 | } | 561 | } |
559 | } | 562 | } |
560 | if ( createbup ) { | 563 | if ( createbup ) { |
561 | QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + | 564 | QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + |
562 | KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); | 565 | KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); |
563 | Incidence *incidence = delSel.first(); | 566 | Incidence *incidence = delSel.first(); |
564 | icount = 0; | 567 | icount = 0; |
565 | while ( incidence ) { | 568 | while ( incidence ) { |
566 | if ( incidence->type() == "Journal" ) { | 569 | if ( incidence->type() == "Journal" ) { |
567 | text += "\n************************************\n"; | 570 | text += "\n************************************\n"; |
568 | text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); | 571 | text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); |
569 | text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); | 572 | text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); |
570 | text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); | 573 | text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); |
571 | ++icount; | 574 | ++icount; |
572 | 575 | ||
573 | } else { | 576 | } else { |
574 | if ( !incidence->description().isEmpty() ) { | 577 | if ( !incidence->description().isEmpty() ) { |
575 | text += "\n************************************\n"; | 578 | text += "\n************************************\n"; |
576 | if ( incidence->type() == "Todo" ) | 579 | if ( incidence->type() == "Todo" ) |
577 | text += i18n("To-Do: "); | 580 | text += i18n("To-Do: "); |
578 | text += incidence->summary(); | 581 | text += incidence->summary(); |
579 | if ( incidence->hasStartDate() ) | 582 | if ( incidence->hasStartDate() ) |
580 | text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); | 583 | text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); |
581 | text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); | 584 | text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); |
582 | if ( !incidence->location().isEmpty() ) | 585 | if ( !incidence->location().isEmpty() ) |
583 | text += "\n" +i18n("Location: ") + incidence->location(); | 586 | text += "\n" +i18n("Location: ") + incidence->location(); |
584 | text += "\n" + i18n("Description: ") + "\n" + incidence->description(); | 587 | text += "\n" + i18n("Description: ") + "\n" + incidence->description(); |
585 | ++icount; | 588 | ++icount; |
586 | 589 | ||
587 | } | 590 | } |
588 | } | 591 | } |
589 | incidence = delSel.next(); | 592 | incidence = delSel.next(); |
590 | } | 593 | } |
591 | QFile file( fn ); | 594 | QFile file( fn ); |
592 | if (!file.open( IO_WriteOnly ) ) { | 595 | if (!file.open( IO_WriteOnly ) ) { |
593 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); | 596 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); |
594 | return; | 597 | return; |
595 | } | 598 | } |
596 | QTextStream ts( &file ); | 599 | QTextStream ts( &file ); |
597 | ts << text; | 600 | ts << text; |
598 | file.close(); | 601 | file.close(); |
599 | //qDebug("%s ", text.latin1()); | 602 | //qDebug("%s ", text.latin1()); |
600 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); | 603 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); |
601 | KOPrefs::instance()->mLastSaveFile = fn; | 604 | KOPrefs::instance()->mLastSaveFile = fn; |
602 | topLevelWidget()->setCaption(mes); | 605 | topLevelWidget()->setCaption(mes); |
603 | } | 606 | } |
604 | } | 607 | } |
605 | } | 608 | } |
606 | void KOListView::saveToFile() | 609 | void KOListView::saveToFile() |
607 | { | 610 | { |
608 | 611 | ||
609 | int icount = 0; | 612 | int icount = 0; |
610 | QPtrList<Incidence> delSel ; | 613 | QPtrList<Incidence> delSel ; |
611 | QListViewItem *item = mListView->firstChild (); | 614 | QListViewItem *item = mListView->firstChild (); |
612 | while ( item ) { | 615 | while ( item ) { |
613 | if ( item->isSelected() ) { | 616 | if ( item->isSelected() ) { |
614 | delSel.append(((KOListViewItem *)item)->data()); | 617 | delSel.append(((KOListViewItem *)item)->data()); |
615 | ++icount; | 618 | ++icount; |
616 | } | 619 | } |
617 | 620 | ||
618 | item = item->nextSibling(); | 621 | item = item->nextSibling(); |
619 | } | 622 | } |
620 | if ( icount ) { | 623 | if ( icount ) { |
621 | QString fn = KOPrefs::instance()->mLastSaveFile; | 624 | QString fn = KOPrefs::instance()->mLastSaveFile; |
622 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); | 625 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); |
623 | 626 | ||
624 | if ( fn == "" ) | 627 | if ( fn == "" ) |
625 | return; | 628 | return; |
626 | QFileInfo info; | 629 | QFileInfo info; |
627 | info.setFile( fn ); | 630 | info.setFile( fn ); |
628 | QString mes; | 631 | QString mes; |
629 | bool createbup = true; | 632 | bool createbup = true; |
630 | if ( info. exists() ) { | 633 | if ( info. exists() ) { |
631 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 634 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
632 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 635 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
633 | i18n("Overwrite!"), i18n("Cancel"), 0, | 636 | i18n("Overwrite!"), i18n("Cancel"), 0, |
634 | 0, 1 ); | 637 | 0, 1 ); |
635 | if ( result != 0 ) { | 638 | if ( result != 0 ) { |
636 | createbup = false; | 639 | createbup = false; |
637 | } | 640 | } |
638 | } | 641 | } |
639 | if ( createbup ) { | 642 | if ( createbup ) { |
640 | CalendarLocal cal; | 643 | CalendarLocal cal; |
641 | cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 644 | cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
642 | Incidence *incidence = delSel.first(); | 645 | Incidence *incidence = delSel.first(); |
643 | while ( incidence ) { | 646 | while ( incidence ) { |
644 | cal.addIncidence( incidence->clone() ); | 647 | cal.addIncidence( incidence->clone() ); |
645 | incidence = delSel.next(); | 648 | incidence = delSel.next(); |
646 | } | 649 | } |
647 | ICalFormat format; | 650 | ICalFormat format; |
648 | format.save( &cal, fn ); | 651 | format.save( &cal, fn ); |
649 | mes = i18n("KO/Pi:Saved %1").arg(fn ); | 652 | mes = i18n("KO/Pi:Saved %1").arg(fn ); |
650 | KOPrefs::instance()->mLastSaveFile = fn; | 653 | KOPrefs::instance()->mLastSaveFile = fn; |
651 | topLevelWidget()->setCaption(mes); | 654 | topLevelWidget()->setCaption(mes); |
652 | } | 655 | } |
653 | } | 656 | } |
654 | } | 657 | } |
655 | void KOListView::deleteAll() | 658 | void KOListView::deleteAll() |
656 | { | 659 | { |
657 | int icount = 0; | 660 | int icount = 0; |
658 | QPtrList<Incidence> delSel ; | 661 | QPtrList<Incidence> delSel ; |
659 | QListViewItem *item = mListView->firstChild (); | 662 | QListViewItem *item = mListView->firstChild (); |
660 | while ( item ) { | 663 | while ( item ) { |
661 | if ( item->isSelected() ) { | 664 | if ( item->isSelected() ) { |
662 | delSel.append(((KOListViewItem *)item)->data()); | 665 | delSel.append(((KOListViewItem *)item)->data()); |
663 | ++icount; | 666 | ++icount; |
664 | } | 667 | } |
665 | 668 | ||
666 | item = item->nextSibling(); | 669 | item = item->nextSibling(); |
667 | } | 670 | } |
668 | if ( icount ) { | 671 | if ( icount ) { |
669 | Incidence *incidence = delSel.first(); | 672 | Incidence *incidence = delSel.first(); |
670 | Incidence *toDelete; | 673 | Incidence *toDelete; |
671 | KOPrefs *p = KOPrefs::instance(); | 674 | KOPrefs *p = KOPrefs::instance(); |
672 | bool confirm = p->mConfirm; | 675 | bool confirm = p->mConfirm; |
673 | QString mess; | 676 | QString mess; |
674 | mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); | 677 | mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); |
675 | if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { | 678 | if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { |
676 | p->mConfirm = false; | 679 | p->mConfirm = false; |
677 | int delCounter = 0; | 680 | int delCounter = 0; |
678 | QDialog dia ( this, "p-dialog", true ); | 681 | QDialog dia ( this, "p-dialog", true ); |
679 | QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); | 682 | QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); |
680 | QVBoxLayout lay( &dia ); | 683 | QVBoxLayout lay( &dia ); |
681 | lay.setMargin(7); | 684 | lay.setMargin(7); |
682 | lay.setSpacing(7); | 685 | lay.setSpacing(7); |
683 | lay.addWidget( &lab); | 686 | lay.addWidget( &lab); |
684 | QProgressBar bar( icount, &dia ); | 687 | QProgressBar bar( icount, &dia ); |
685 | lay.addWidget( &bar); | 688 | lay.addWidget( &bar); |
686 | int w = 220; | 689 | int w = 220; |
687 | int h = 50; | 690 | int h = 50; |
688 | int dw = QApplication::desktop()->width(); | 691 | int dw = QApplication::desktop()->width(); |
689 | int dh = QApplication::desktop()->height(); | 692 | int dh = QApplication::desktop()->height(); |
690 | dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 693 | dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
691 | //dia.resize( 240,50 ); | 694 | //dia.resize( 240,50 ); |
692 | dia.show(); | 695 | dia.show(); |
693 | 696 | ||
694 | while ( incidence ) { | 697 | while ( incidence ) { |
695 | bar.setProgress( delCounter ); | 698 | bar.setProgress( delCounter ); |
696 | mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); | 699 | mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); |
697 | dia.setCaption( mess ); | 700 | dia.setCaption( mess ); |
698 | qApp->processEvents(); | 701 | qApp->processEvents(); |
699 | toDelete = (incidence); | 702 | toDelete = (incidence); |
700 | incidence = delSel.next(); | 703 | incidence = delSel.next(); |
701 | emit deleteIncidenceSignal(toDelete ); | 704 | emit deleteIncidenceSignal(toDelete ); |
702 | if ( dia.result() != 0 ) | 705 | if ( dia.result() != 0 ) |
703 | break; | 706 | break; |
704 | 707 | ||
705 | } | 708 | } |
706 | mess = mess.sprintf( i18n("%d items remaining in list."), count() ); | 709 | mess = mess.sprintf( i18n("%d items remaining in list."), count() ); |
707 | topLevelWidget ()->setCaption( mess ); | 710 | topLevelWidget ()->setCaption( mess ); |
708 | p->mConfirm = confirm; | 711 | p->mConfirm = confirm; |
709 | } | 712 | } |
710 | } | 713 | } |
711 | 714 | ||
712 | 715 | ||
713 | } | 716 | } |
714 | int KOListView::maxDatesHint() | 717 | int KOListView::maxDatesHint() |
715 | { | 718 | { |
716 | return 0; | 719 | return 0; |
717 | } | 720 | } |
718 | 721 | ||
719 | int KOListView::currentDateCount() | 722 | int KOListView::currentDateCount() |
720 | { | 723 | { |
721 | return 0; | 724 | return 0; |
722 | } | 725 | } |
723 | 726 | ||
724 | QPtrList<Incidence> KOListView::selectedIncidences() | 727 | QPtrList<Incidence> KOListView::selectedIncidences() |
725 | { | 728 | { |
726 | QPtrList<Incidence> eventList; | 729 | QPtrList<Incidence> eventList; |
727 | QListViewItem *item = mListView->firstChild (); | 730 | QListViewItem *item = mListView->firstChild (); |
728 | while ( item ) { | 731 | while ( item ) { |
729 | if ( item->isSelected() ) { | 732 | if ( item->isSelected() ) { |
730 | eventList.append(((KOListViewItem *)item)->data()); | 733 | eventList.append(((KOListViewItem *)item)->data()); |
731 | } | 734 | } |
732 | 735 | ||
733 | item = item->nextSibling(); | 736 | item = item->nextSibling(); |
734 | } | 737 | } |
735 | 738 | ||
736 | // // QListViewItem *item = mListView->selectedItem(); | 739 | // // QListViewItem *item = mListView->selectedItem(); |
737 | //if (item) eventList.append(((KOListViewItem *)item)->data()); | 740 | //if (item) eventList.append(((KOListViewItem *)item)->data()); |
738 | 741 | ||
739 | return eventList; | 742 | return eventList; |
740 | } | 743 | } |
741 | 744 | ||
742 | DateList KOListView::selectedDates() | 745 | DateList KOListView::selectedDates() |
743 | { | 746 | { |
744 | DateList eventList; | 747 | DateList eventList; |
745 | return eventList; | 748 | return eventList; |
746 | } | 749 | } |
747 | 750 | ||
748 | void KOListView::showDates(bool show) | 751 | void KOListView::showDates(bool show) |
749 | { | 752 | { |
750 | // Shouldn't we set it to a value greater 0? When showDates is called with | 753 | // Shouldn't we set it to a value greater 0? When showDates is called with |
751 | // show == true at first, then the columnwidths are set to zero. | 754 | // show == true at first, then the columnwidths are set to zero. |
752 | static int oldColWidth1 = 0; | 755 | static int oldColWidth1 = 0; |
753 | static int oldColWidth3 = 0; | 756 | static int oldColWidth3 = 0; |
754 | 757 | ||
755 | if (!show) { | 758 | if (!show) { |
756 | oldColWidth1 = mListView->columnWidth(1); | 759 | oldColWidth1 = mListView->columnWidth(1); |
757 | oldColWidth3 = mListView->columnWidth(3); | 760 | oldColWidth3 = mListView->columnWidth(3); |
758 | mListView->setColumnWidth(1, 0); | 761 | mListView->setColumnWidth(1, 0); |
759 | mListView->setColumnWidth(3, 0); | 762 | mListView->setColumnWidth(3, 0); |
760 | } else { | 763 | } else { |
761 | mListView->setColumnWidth(1, oldColWidth1); | 764 | mListView->setColumnWidth(1, oldColWidth1); |
762 | mListView->setColumnWidth(3, oldColWidth3); | 765 | mListView->setColumnWidth(3, oldColWidth3); |
763 | } | 766 | } |
764 | mListView->repaint(); | 767 | mListView->repaint(); |
765 | } | 768 | } |
766 | 769 | ||
767 | void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 770 | void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
768 | const QDate &td) | 771 | const QDate &td) |
769 | { | 772 | { |
770 | #ifndef KORG_NOPRINTER | 773 | #ifndef KORG_NOPRINTER |
771 | calPrinter->preview(CalPrinter::Day, fd, td); | 774 | calPrinter->preview(CalPrinter::Day, fd, td); |
772 | #endif | 775 | #endif |
773 | } | 776 | } |
774 | 777 | ||
775 | void KOListView::showDates() | 778 | void KOListView::showDates() |
776 | { | 779 | { |
777 | showDates(true); | 780 | showDates(true); |
778 | } | 781 | } |
779 | 782 | ||
780 | void KOListView::hideDates() | 783 | void KOListView::hideDates() |
781 | { | 784 | { |
782 | showDates(false); | 785 | showDates(false); |
783 | } | 786 | } |
784 | 787 | ||
785 | void KOListView::updateView() | 788 | void KOListView::updateView() |
786 | { | 789 | { |
787 | mListView->setFocus(); | 790 | mListView->setFocus(); |
788 | if ( mListView->firstChild () ) | 791 | if ( mListView->firstChild () ) |
789 | mListView->setCurrentItem( mListView->firstChild () ); | 792 | mListView->setCurrentItem( mListView->firstChild () ); |
790 | } | 793 | } |
791 | void KOListView::updateConfig() | 794 | void KOListView::updateConfig() |
792 | { | 795 | { |
793 | 796 | ||
794 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 797 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
795 | updateView(); | 798 | updateView(); |
796 | 799 | ||
797 | } | 800 | } |
798 | void KOListView::setStartDate(const QDate &start) | 801 | void KOListView::setStartDate(const QDate &start) |
799 | { | 802 | { |
800 | mStartDate = start; | 803 | mStartDate = start; |
801 | } | 804 | } |
802 | 805 | ||
803 | void KOListView::showDates(const QDate &start, const QDate &end) | 806 | void KOListView::showDates(const QDate &start, const QDate &end) |
804 | { | 807 | { |
805 | clear(); | 808 | clear(); |
806 | mStartDate = start; | 809 | mStartDate = start; |
807 | QDate date = start; | 810 | QDate date = start; |
808 | QPtrList<Journal> j_list; | 811 | QPtrList<Journal> j_list; |
809 | while( date <= end ) { | 812 | while( date <= end ) { |
810 | addEvents(calendar()->events(date)); | 813 | addEvents(calendar()->events(date)); |
811 | addTodos(calendar()->todos(date)); | 814 | addTodos(calendar()->todos(date)); |
812 | Journal* jo = calendar()->journal(date); | 815 | Journal* jo = calendar()->journal(date); |
813 | if ( jo ) | 816 | if ( jo ) |
814 | j_list.append( jo ); | 817 | j_list.append( jo ); |
815 | date = date.addDays( 1 ); | 818 | date = date.addDays( 1 ); |
816 | } | 819 | } |
817 | addJournals(j_list); | 820 | addJournals(j_list); |
818 | emit incidenceSelected( 0 ); | 821 | emit incidenceSelected( 0 ); |
819 | updateView(); | 822 | updateView(); |
820 | 823 | ||
821 | } | 824 | } |
822 | 825 | ||
823 | void KOListView::addEvents(QPtrList<Event> eventList) | 826 | void KOListView::addEvents(QPtrList<Event> eventList) |
824 | { | 827 | { |
825 | Event *ev; | 828 | Event *ev; |
826 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 829 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
827 | addIncidence(ev); | 830 | addIncidence(ev); |
828 | } | 831 | } |
829 | if ( !mListView->currentItem() ){ | 832 | if ( !mListView->currentItem() ){ |
830 | updateView(); | 833 | updateView(); |
831 | } | 834 | } |
832 | } | 835 | } |
833 | 836 | ||
834 | void KOListView::addTodos(QPtrList<Todo> eventList) | 837 | void KOListView::addTodos(QPtrList<Todo> eventList) |
835 | { | 838 | { |
836 | Todo *ev; | 839 | Todo *ev; |
837 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 840 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
838 | addIncidence(ev); | 841 | addIncidence(ev); |
839 | } | 842 | } |
840 | if ( !mListView->currentItem() ){ | 843 | if ( !mListView->currentItem() ){ |
841 | updateView(); | 844 | updateView(); |
842 | } | 845 | } |
843 | } | 846 | } |
844 | void KOListView::addJournals(QPtrList<Journal> eventList) | 847 | void KOListView::addJournals(QPtrList<Journal> eventList) |
845 | { | 848 | { |
846 | Journal *ev; | 849 | Journal *ev; |
847 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 850 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
848 | addIncidence(ev); | 851 | addIncidence(ev); |
849 | } | 852 | } |
850 | if ( !mListView->currentItem() ){ | 853 | if ( !mListView->currentItem() ){ |
851 | updateView(); | 854 | updateView(); |
852 | } | 855 | } |
853 | } | 856 | } |
854 | 857 | ||
855 | void KOListView::addIncidence(Incidence *incidence) | 858 | void KOListView::addIncidence(Incidence *incidence) |
856 | { | 859 | { |
857 | if ( mUidDict.find( incidence->uid() ) ) return; | 860 | if ( mUidDict.find( incidence->uid() ) ) return; |
858 | 861 | ||
859 | // mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 862 | // mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
860 | mUidDict.insert( incidence->uid(), incidence ); | 863 | mUidDict.insert( incidence->uid(), incidence ); |
861 | 864 | ||
862 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); | 865 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); |
863 | ListItemVisitor v(item, mStartDate ); | 866 | ListItemVisitor v(item, mStartDate ); |
864 | if (incidence->accept(v)) return; | 867 | if (incidence->accept(v)) return; |
865 | else delete item; | 868 | else delete item; |
866 | //qDebug("delete item "); | 869 | //qDebug("delete item "); |
867 | } | 870 | } |
868 | 871 | ||
869 | void KOListView::showEvents(QPtrList<Event> eventList) | 872 | void KOListView::showEvents(QPtrList<Event> eventList) |
870 | { | 873 | { |
871 | clear(); | 874 | clear(); |
872 | 875 | ||
873 | addEvents(eventList); | 876 | addEvents(eventList); |
874 | 877 | ||
875 | // After new creation of list view no events are selected. | 878 | // After new creation of list view no events are selected. |
876 | emit incidenceSelected( 0 ); | 879 | emit incidenceSelected( 0 ); |
877 | } | 880 | } |
878 | int KOListView::count() | 881 | int KOListView::count() |
879 | { | 882 | { |
880 | return mListView->childCount(); | 883 | return mListView->childCount(); |
881 | } | 884 | } |
882 | 885 | ||
883 | void KOListView::changeEventDisplay(Event *event, int action) | 886 | void KOListView::changeEventDisplay(Event *event, int action) |
884 | { | 887 | { |
885 | KOListViewItem *item; | 888 | KOListViewItem *item; |
886 | 889 | ||
887 | switch(action) { | 890 | switch(action) { |
888 | case KOGlobals::EVENTADDED: | 891 | case KOGlobals::EVENTADDED: |
889 | addIncidence( event ); | 892 | addIncidence( event ); |
890 | break; | 893 | break; |
891 | case KOGlobals::EVENTEDITED: | 894 | case KOGlobals::EVENTEDITED: |
892 | item = getItemForEvent(event); | 895 | item = getItemForEvent(event); |
893 | if (item) { | 896 | if (item) { |
894 | mUidDict.remove( event->uid() ); | 897 | mUidDict.remove( event->uid() ); |
895 | delete item; | 898 | delete item; |
896 | addIncidence( event ); | 899 | addIncidence( event ); |
897 | } | 900 | } |
898 | break; | 901 | break; |
899 | case KOGlobals::EVENTDELETED: | 902 | case KOGlobals::EVENTDELETED: |
900 | item = getItemForEvent(event); | 903 | item = getItemForEvent(event); |
901 | if (item) { | 904 | if (item) { |
902 | mUidDict.remove( event->uid() ); | 905 | mUidDict.remove( event->uid() ); |
903 | delete item; | 906 | delete item; |
904 | } | 907 | } |
905 | break; | 908 | break; |
906 | default: | 909 | default: |
907 | ; | 910 | ; |
908 | } | 911 | } |
909 | } | 912 | } |
910 | 913 | ||
911 | KOListViewItem *KOListView::getItemForEvent(Event *event) | 914 | KOListViewItem *KOListView::getItemForEvent(Event *event) |
912 | { | 915 | { |
913 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); | 916 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); |
914 | while (item) { | 917 | while (item) { |
915 | if (item->data() == event) return item; | 918 | if (item->data() == event) return item; |
916 | item = (KOListViewItem *)item->nextSibling(); | 919 | item = (KOListViewItem *)item->nextSibling(); |
917 | } | 920 | } |
918 | return 0; | 921 | return 0; |
919 | } | 922 | } |
920 | 923 | ||
921 | void KOListView::defaultItemAction(QListViewItem *i) | 924 | void KOListView::defaultItemAction(QListViewItem *i) |
922 | { | 925 | { |
923 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); | 926 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); |
924 | if ( item ) defaultAction( item->data() ); | 927 | if ( item ) defaultAction( item->data() ); |
925 | 928 | ||
926 | } | 929 | } |
927 | 930 | ||
928 | void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) | 931 | void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) |
929 | { | 932 | { |
930 | mActiveItem = (KOListViewItem *)item; | 933 | mActiveItem = (KOListViewItem *)item; |
931 | if (mActiveItem) { | 934 | if (mActiveItem) { |
932 | Incidence *incidence = mActiveItem->data(); | 935 | Incidence *incidence = mActiveItem->data(); |
933 | mPopupMenu->showIncidencePopup(incidence); | 936 | mPopupMenu->showIncidencePopup(incidence); |
934 | 937 | ||
935 | /* | 938 | /* |
936 | if ( incidence && incidence->type() == "Event" ) { | 939 | if ( incidence && incidence->type() == "Event" ) { |
937 | Event *event = static_cast<Event *>( incidence ); | 940 | Event *event = static_cast<Event *>( incidence ); |
938 | mPopupMenu->showEventPopup(event); | 941 | mPopupMenu->showEventPopup(event); |
939 | } | 942 | } |
940 | */ | 943 | */ |
941 | } | 944 | } |
942 | } | 945 | } |
943 | 946 | ||
944 | void KOListView::readSettings(KConfig *config, QString setting) | 947 | void KOListView::readSettings(KConfig *config, QString setting) |
945 | { | 948 | { |
946 | // qDebug("KOListView::readSettings "); | 949 | // qDebug("KOListView::readSettings "); |
947 | mListView->restoreLayout(config,setting); | 950 | mListView->restoreLayout(config,setting); |
948 | } | 951 | } |
949 | 952 | ||
950 | void KOListView::writeSettings(KConfig *config, QString setting) | 953 | void KOListView::writeSettings(KConfig *config, QString setting) |
951 | { | 954 | { |
952 | // qDebug("KOListView::writeSettings "); | 955 | // qDebug("KOListView::writeSettings "); |
953 | mListView->saveLayout(config, setting); | 956 | mListView->saveLayout(config, setting); |
954 | } | 957 | } |
955 | 958 | ||
956 | void KOListView::processSelectionChange(QListViewItem *) | 959 | void KOListView::processSelectionChange(QListViewItem *) |
957 | { | 960 | { |
958 | 961 | ||
959 | KOListViewItem *item = | 962 | KOListViewItem *item = |
960 | static_cast<KOListViewItem *>( mListView->currentItem() ); | 963 | static_cast<KOListViewItem *>( mListView->currentItem() ); |
961 | 964 | ||
962 | if ( !item ) { | 965 | if ( !item ) { |
963 | emit incidenceSelected( 0 ); | 966 | emit incidenceSelected( 0 ); |
964 | } else { | 967 | } else { |
965 | emit incidenceSelected( item->data() ); | 968 | emit incidenceSelected( item->data() ); |
966 | } | 969 | } |
967 | } | 970 | } |
968 | 971 | ||
969 | void KOListView::clearSelection() | 972 | void KOListView::clearSelection() |
970 | { | 973 | { |
971 | mListView->selectAll( false ); | 974 | mListView->selectAll( false ); |
972 | } | 975 | } |
973 | void KOListView::allSelection() | 976 | void KOListView::allSelection() |
974 | { | 977 | { |
975 | mListView->selectAll( true ); | 978 | mListView->selectAll( true ); |
976 | } | 979 | } |
977 | 980 | ||
978 | void KOListView::clear() | 981 | void KOListView::clear() |
979 | { | 982 | { |
980 | mListView->clear(); | 983 | mListView->clear(); |
981 | mUidDict.clear(); | 984 | mUidDict.clear(); |
982 | } | 985 | } |
983 | 986 | ||
984 | Incidence* KOListView::currentItem() | 987 | Incidence* KOListView::currentItem() |
985 | { | 988 | { |
986 | if ( mListView->currentItem() ) | 989 | if ( mListView->currentItem() ) |
987 | return ((KOListViewItem*) mListView->currentItem())->data(); | 990 | return ((KOListViewItem*) mListView->currentItem())->data(); |
988 | return 0; | 991 | return 0; |
989 | } | 992 | } |
990 | void KOListView::keyPressEvent ( QKeyEvent *e) | 993 | void KOListView::keyPressEvent ( QKeyEvent *e) |
991 | { | 994 | { |
992 | 995 | ||
993 | if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { | 996 | if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { |
994 | deleteAll(); | 997 | deleteAll(); |
995 | return; | 998 | return; |
996 | } | 999 | } |
997 | 1000 | ||
998 | e->ignore(); | 1001 | e->ignore(); |
999 | } | 1002 | } |
1000 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) | 1003 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) |
1001 | { | 1004 | { |
1002 | 1005 | ||
1003 | switch ( e->key() ) { | 1006 | switch ( e->key() ) { |
1004 | case Qt::Key_Down: | 1007 | case Qt::Key_Down: |
1005 | if ( e->state() == ShiftButton ) { | 1008 | if ( e->state() == ShiftButton ) { |
1006 | QListViewItem* cn = currentItem(); | 1009 | QListViewItem* cn = currentItem(); |
1007 | if ( !cn ) | 1010 | if ( !cn ) |
1008 | cn = firstChild(); | 1011 | cn = firstChild(); |
1009 | if ( !cn ) | 1012 | if ( !cn ) |
1010 | return; | 1013 | return; |
1011 | while ( cn->nextSibling() ) | 1014 | while ( cn->nextSibling() ) |
1012 | cn = cn->nextSibling(); | 1015 | cn = cn->nextSibling(); |
1013 | setCurrentItem ( cn ); | 1016 | setCurrentItem ( cn ); |
1014 | ensureItemVisible ( cn ); | 1017 | ensureItemVisible ( cn ); |
1015 | 1018 | ||
1016 | e->accept(); | 1019 | e->accept(); |
1017 | return; | 1020 | return; |
1018 | } | 1021 | } |
1019 | if ( e->state() == ControlButton ) { | 1022 | if ( e->state() == ControlButton ) { |
1020 | int count = childCount (); | 1023 | int count = childCount (); |
1021 | int jump = count / 5; | 1024 | int jump = count / 5; |
1022 | QListViewItem* cn; | 1025 | QListViewItem* cn; |
1023 | cn = currentItem(); | 1026 | cn = currentItem(); |
1024 | if ( ! cn ) | 1027 | if ( ! cn ) |
1025 | return; | 1028 | return; |
1026 | if ( jump == 0 ) | 1029 | if ( jump == 0 ) |
1027 | jump = 1; | 1030 | jump = 1; |
1028 | while ( jump && cn->nextSibling() ) { | 1031 | while ( jump && cn->nextSibling() ) { |
1029 | cn = cn->nextSibling(); | 1032 | cn = cn->nextSibling(); |
1030 | --jump; | 1033 | --jump; |
1031 | } | 1034 | } |
1032 | setCurrentItem ( cn ); | 1035 | setCurrentItem ( cn ); |
1033 | ensureItemVisible ( cn ); | 1036 | ensureItemVisible ( cn ); |
1034 | 1037 | ||
1035 | } else | 1038 | } else |
1036 | QListView::keyPressEvent ( e ) ; | 1039 | QListView::keyPressEvent ( e ) ; |
1037 | e->accept(); | 1040 | e->accept(); |
1038 | break; | 1041 | break; |
1039 | 1042 | ||
1040 | case Qt::Key_Up: | 1043 | case Qt::Key_Up: |
1041 | if ( e->state() == ShiftButton ) { | 1044 | if ( e->state() == ShiftButton ) { |
1042 | QListViewItem* cn = firstChild(); | 1045 | QListViewItem* cn = firstChild(); |
1043 | if ( cn ) { | 1046 | if ( cn ) { |
1044 | setCurrentItem ( cn ); | 1047 | setCurrentItem ( cn ); |
1045 | ensureItemVisible ( cn ); | 1048 | ensureItemVisible ( cn ); |
1046 | } | 1049 | } |
1047 | e->accept(); | 1050 | e->accept(); |
1048 | return; | 1051 | return; |
1049 | } | 1052 | } |
1050 | if ( e->state() == ControlButton ) { | 1053 | if ( e->state() == ControlButton ) { |
1051 | int count = childCount (); | 1054 | int count = childCount (); |
1052 | int jump = count / 5; | 1055 | int jump = count / 5; |
1053 | QListViewItem* cn; | 1056 | QListViewItem* cn; |
1054 | cn = currentItem(); | 1057 | cn = currentItem(); |
1055 | if ( ! cn ) | 1058 | if ( ! cn ) |
1056 | return; | 1059 | return; |
1057 | if ( jump == 0 ) | 1060 | if ( jump == 0 ) |
1058 | jump = 1; | 1061 | jump = 1; |
1059 | while ( jump && cn->itemAbove ()) { | 1062 | while ( jump && cn->itemAbove ()) { |
1060 | cn = cn->itemAbove (); | 1063 | cn = cn->itemAbove (); |
1061 | --jump; | 1064 | --jump; |
1062 | } | 1065 | } |
1063 | setCurrentItem ( cn ); | 1066 | setCurrentItem ( cn ); |
1064 | ensureItemVisible ( cn ); | 1067 | ensureItemVisible ( cn ); |
1065 | } else | 1068 | } else |
1066 | QListView::keyPressEvent ( e ) ; | 1069 | QListView::keyPressEvent ( e ) ; |
1067 | e->accept(); | 1070 | e->accept(); |
1068 | break; | 1071 | break; |
1069 | case Qt::Key_I: { | 1072 | case Qt::Key_I: { |
1070 | QListViewItem* cn; | 1073 | QListViewItem* cn; |
1071 | cn = currentItem(); | 1074 | cn = currentItem(); |
1072 | if ( cn ) { | 1075 | if ( cn ) { |
1073 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1076 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1074 | if ( ci ){ | 1077 | if ( ci ){ |
1075 | emit showIncidence( ci->data()); | 1078 | emit showIncidence( ci->data()); |
1076 | cn = cn->nextSibling(); | 1079 | cn = cn->nextSibling(); |
1077 | if ( cn ) { | 1080 | if ( cn ) { |
1078 | setCurrentItem ( cn ); | 1081 | setCurrentItem ( cn ); |
1079 | ensureItemVisible ( cn ); | 1082 | ensureItemVisible ( cn ); |
1080 | } | 1083 | } |
1081 | } | 1084 | } |
1082 | } | 1085 | } |
1083 | e->accept(); | 1086 | e->accept(); |
1084 | } | 1087 | } |
1085 | break; | 1088 | break; |
1086 | case Qt::Key_Return: | 1089 | case Qt::Key_Return: |
1087 | case Qt::Key_Enter: | 1090 | case Qt::Key_Enter: |
1088 | { | 1091 | { |
1089 | QListViewItem* cn; | 1092 | QListViewItem* cn; |
1090 | cn = currentItem(); | 1093 | cn = currentItem(); |
1091 | if ( cn ) { | 1094 | if ( cn ) { |
1092 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1095 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1093 | if ( ci ){ | 1096 | if ( ci ){ |
1094 | if ( e->state() == ShiftButton ) | 1097 | if ( e->state() == ShiftButton ) |
1095 | ci->setSelected( false ); | 1098 | ci->setSelected( false ); |
1096 | else | 1099 | else |
1097 | ci->setSelected( true ); | 1100 | ci->setSelected( true ); |
1098 | cn = cn->nextSibling(); | 1101 | cn = cn->nextSibling(); |
1099 | if ( cn ) { | 1102 | if ( cn ) { |
1100 | setCurrentItem ( cn ); | 1103 | setCurrentItem ( cn ); |
1101 | ensureItemVisible ( cn ); | 1104 | ensureItemVisible ( cn ); |
1102 | } | 1105 | } |
1103 | } | 1106 | } |
1104 | } | 1107 | } |
1105 | e->accept(); | 1108 | e->accept(); |
1106 | } | 1109 | } |
1107 | break; | 1110 | break; |
1108 | default: | 1111 | default: |
1109 | e->ignore(); | 1112 | e->ignore(); |
1110 | } | 1113 | } |
1111 | } | 1114 | } |
1112 | KOListViewListView::KOListViewListView(KOListView * lv ) | 1115 | KOListViewListView::KOListViewListView(KOListView * lv ) |
1113 | : KListView( lv ) | 1116 | : KListView( lv ) |
1114 | { | 1117 | { |
1115 | #ifndef DESKTOP_VERSION | 1118 | #ifndef DESKTOP_VERSION |
1116 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 1119 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
1117 | #endif | 1120 | #endif |
1118 | mYMousePos = -1000; | 1121 | mYMousePos = -1000; |
1119 | setSelectionMode( QListView::Multi ); | 1122 | setSelectionMode( QListView::Multi ); |
1120 | setMultiSelection( true); | 1123 | setMultiSelection( true); |
1121 | mAllowPopupMenu = true; | 1124 | mAllowPopupMenu = true; |
1122 | mMouseDown = false; | 1125 | mMouseDown = false; |
1123 | 1126 | ||
1124 | } | 1127 | } |
1125 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 1128 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
1126 | { | 1129 | { |
1127 | if (!e) return; | 1130 | if (!e) return; |
1128 | QPoint vp = contentsToViewport(e->pos()); | 1131 | QPoint vp = contentsToViewport(e->pos()); |
1129 | QListViewItem *item = itemAt(vp); | 1132 | QListViewItem *item = itemAt(vp); |
1130 | if (!item) { | 1133 | if (!item) { |
1131 | emit newEvent(); | 1134 | emit newEvent(); |
1132 | return; | 1135 | return; |
1133 | } | 1136 | } |
1134 | KListView::contentsMouseDoubleClickEvent(e); | 1137 | KListView::contentsMouseDoubleClickEvent(e); |
1135 | } | 1138 | } |
1136 | 1139 | ||
1137 | 1140 | ||
1138 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1141 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1139 | { | 1142 | { |
1140 | //qDebug("contentsMousePressEvent++++ "); | 1143 | //qDebug("contentsMousePressEvent++++ "); |
1141 | if (! mMouseDown ) { | 1144 | if (! mMouseDown ) { |
1142 | mAllowPopupMenu = true; | 1145 | mAllowPopupMenu = true; |
1143 | mYMousePos = mapToGlobal( (e->pos())).y(); | 1146 | mYMousePos = mapToGlobal( (e->pos())).y(); |
1144 | } | 1147 | } |
1145 | if ( e->button() == RightButton && mMouseDown ) | 1148 | if ( e->button() == RightButton && mMouseDown ) |
1146 | return; | 1149 | return; |
1147 | if ( e->button() == LeftButton ) | 1150 | if ( e->button() == LeftButton ) |
1148 | mMouseDown = true; | 1151 | mMouseDown = true; |
1149 | KListView::contentsMousePressEvent( e ); | 1152 | KListView::contentsMousePressEvent( e ); |
1150 | } | 1153 | } |
1151 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1154 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1152 | { | 1155 | { |
1153 | //qDebug("contentsMouseReleaseEv---- "); | 1156 | //qDebug("contentsMouseReleaseEv---- "); |
1154 | if ( ! mMouseDown ) { | 1157 | if ( ! mMouseDown ) { |
1155 | if ( e->button() == RightButton && ! mAllowPopupMenu ) | 1158 | if ( e->button() == RightButton && ! mAllowPopupMenu ) |
1156 | return; | 1159 | return; |
1157 | QListViewItem* ci = currentItem(); | 1160 | QListViewItem* ci = currentItem(); |
1158 | if ( ci ) | 1161 | if ( ci ) |
1159 | ci->setSelected( true ); | 1162 | ci->setSelected( true ); |
1160 | KListView::contentsMouseReleaseEvent(e); | 1163 | KListView::contentsMouseReleaseEvent(e); |
1161 | return; | 1164 | return; |
1162 | } | 1165 | } |
1163 | if ( e->button() == LeftButton ) | 1166 | if ( e->button() == LeftButton ) |
1164 | mMouseDown = false; | 1167 | mMouseDown = false; |
1165 | if ( e->button() == RightButton && ! mAllowPopupMenu ) | 1168 | if ( e->button() == RightButton && ! mAllowPopupMenu ) |
1166 | return; | 1169 | return; |
1167 | if ( e->button() == RightButton ) { | 1170 | if ( e->button() == RightButton ) { |
1168 | QListViewItem* ci = currentItem(); | 1171 | QListViewItem* ci = currentItem(); |
1169 | if ( ci ) | 1172 | if ( ci ) |
1170 | ci->setSelected( true ); | 1173 | ci->setSelected( true ); |
1171 | } | 1174 | } |
1172 | KListView::contentsMouseReleaseEvent(e); | 1175 | KListView::contentsMouseReleaseEvent(e); |
1173 | } | 1176 | } |
1174 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1177 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1175 | { | 1178 | { |
1176 | // qDebug("contentsMouseMoveEv....... "); | 1179 | // qDebug("contentsMouseMoveEv....... "); |
1177 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); | 1180 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); |
1178 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); | 1181 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); |
1179 | if ( diff < 0 ) diff = -diff; | 1182 | if ( diff < 0 ) diff = -diff; |
1180 | if ( diff > 20 ) | 1183 | if ( diff > 20 ) |
1181 | mAllowPopupMenu = false; | 1184 | mAllowPopupMenu = false; |
1182 | KListView::contentsMouseMoveEvent(e); | 1185 | KListView::contentsMouseMoveEvent(e); |
1183 | } | 1186 | } |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index f9bc1ca..2fe80af 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1,1615 +1,1617 @@ | |||
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 <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | #include <qtooltip.h> | 28 | #include <qtooltip.h> |
29 | #include <qpainter.h> | 29 | #include <qpainter.h> |
30 | #include <qtimer.h> | 30 | #include <qtimer.h> |
31 | #include <qwhatsthis.h> | 31 | #include <qwhatsthis.h> |
32 | #ifndef DESKTOP_VERSION | 32 | #ifndef DESKTOP_VERSION |
33 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
34 | #else | 34 | #else |
35 | #include <qapplication.h> | 35 | #include <qapplication.h> |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #include <kdebug.h> | 38 | #include <kdebug.h> |
39 | #include <klocale.h> | 39 | #include <klocale.h> |
40 | #include <kglobal.h> | 40 | #include <kglobal.h> |
41 | #include <kconfig.h> | 41 | #include <kconfig.h> |
42 | #include <kiconloader.h> | 42 | #include <kiconloader.h> |
43 | 43 | ||
44 | #include <kcalendarsystem.h> | 44 | #include <kcalendarsystem.h> |
45 | 45 | ||
46 | #ifndef KORG_NOPRINTER | 46 | #ifndef KORG_NOPRINTER |
47 | #include "calprinter.h" | 47 | #include "calprinter.h" |
48 | #endif | 48 | #endif |
49 | #include "koprefs.h" | 49 | #include "koprefs.h" |
50 | #ifndef KORG_NOPLUGINS | 50 | #ifndef KORG_NOPLUGINS |
51 | #include "kocore.h" | 51 | #include "kocore.h" |
52 | #endif | 52 | #endif |
53 | #include "koglobals.h" | 53 | #include "koglobals.h" |
54 | #include <libkcal/kincidenceformatter.h> | 54 | #include <libkcal/kincidenceformatter.h> |
55 | 55 | ||
56 | #include "komonthview.h" | 56 | #include "komonthview.h" |
57 | 57 | ||
58 | #define PIXMAP_SIZE 5 | 58 | #define PIXMAP_SIZE 5 |
59 | #ifdef DESKTOP_VERSION | 59 | #ifdef DESKTOP_VERSION |
60 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; | 60 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; |
61 | #endif | 61 | #endif |
62 | class KNOWhatsThis :public QWhatsThis | 62 | class KNOWhatsThis :public QWhatsThis |
63 | { | 63 | { |
64 | public: | 64 | public: |
65 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; | 65 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; |
66 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; | 66 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; |
67 | 67 | ||
68 | protected: | 68 | protected: |
69 | virtual QString text( const QPoint& p) | 69 | virtual QString text( const QPoint& p) |
70 | { | 70 | { |
71 | return _wid->getWhatsThisText(p) ; | 71 | return _wid->getWhatsThisText(p) ; |
72 | }; | 72 | }; |
73 | private: | 73 | private: |
74 | KNoScrollListBox* _wid; | 74 | KNoScrollListBox* _wid; |
75 | 75 | ||
76 | }; | 76 | }; |
77 | 77 | ||
78 | 78 | ||
79 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) | 79 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) |
80 | : QListBox(parent, name, WRepaintNoErase) | 80 | : QListBox(parent, name, WRepaintNoErase) |
81 | { | 81 | { |
82 | #ifndef DESKTOP_VERSION | 82 | #ifndef DESKTOP_VERSION |
83 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 83 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
84 | #endif | 84 | #endif |
85 | mWT = new KNOWhatsThis(this); | 85 | mWT = new KNOWhatsThis(this); |
86 | } | 86 | } |
87 | KNoScrollListBox::~KNoScrollListBox() | 87 | KNoScrollListBox::~KNoScrollListBox() |
88 | { | 88 | { |
89 | 89 | ||
90 | } | 90 | } |
91 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 91 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
92 | { | 92 | { |
93 | QListBoxItem* item = itemAt ( p ); | 93 | QListBoxItem* item = itemAt ( p ); |
94 | if ( ! item ) { | 94 | if ( ! item ) { |
95 | return i18n("Click in the cell\nto add an event!"); | 95 | return i18n("Click in the cell\nto add an event!"); |
96 | } | 96 | } |
97 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); | 97 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), |
98 | KOPrefs::instance()->mWTshowDetails, | ||
99 | KOPrefs::instance()->mWTshowCreated, | ||
100 | KOPrefs::instance()->mWTshowChanged); | ||
98 | } | 101 | } |
99 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 102 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
100 | { | 103 | { |
101 | 104 | ||
102 | switch(e->key()) { | 105 | switch(e->key()) { |
103 | case Key_Right: | 106 | case Key_Right: |
104 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 107 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
105 | { | 108 | { |
106 | e->ignore(); | 109 | e->ignore(); |
107 | return; | 110 | return; |
108 | } | 111 | } |
109 | scrollBy(10,0); | 112 | scrollBy(10,0); |
110 | break; | 113 | break; |
111 | case Key_Left: | 114 | case Key_Left: |
112 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 115 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
113 | { | 116 | { |
114 | e->ignore(); | 117 | e->ignore(); |
115 | return; | 118 | return; |
116 | } | 119 | } |
117 | scrollBy(-10,0); | 120 | scrollBy(-10,0); |
118 | break; | 121 | break; |
119 | case Key_Up: | 122 | case Key_Up: |
120 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 123 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
121 | e->ignore(); | 124 | e->ignore(); |
122 | break; | 125 | break; |
123 | } | 126 | } |
124 | setCurrentItem((currentItem()+count()-1)%count()); | 127 | setCurrentItem((currentItem()+count()-1)%count()); |
125 | if(!itemVisible(currentItem())) { | 128 | if(!itemVisible(currentItem())) { |
126 | if((unsigned int) currentItem() == (count()-1)) { | 129 | if((unsigned int) currentItem() == (count()-1)) { |
127 | setTopItem(currentItem()-numItemsVisible()+1); | 130 | setTopItem(currentItem()-numItemsVisible()+1); |
128 | } else { | 131 | } else { |
129 | setTopItem(topItem()-1); | 132 | setTopItem(topItem()-1); |
130 | } | 133 | } |
131 | } | 134 | } |
132 | break; | 135 | break; |
133 | case Key_Down: | 136 | case Key_Down: |
134 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 137 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
135 | e->ignore(); | 138 | e->ignore(); |
136 | break; | 139 | break; |
137 | } | 140 | } |
138 | setCurrentItem((currentItem()+1)%count()); | 141 | setCurrentItem((currentItem()+1)%count()); |
139 | if(!itemVisible(currentItem())) { | 142 | if(!itemVisible(currentItem())) { |
140 | if(currentItem() == 0) { | 143 | if(currentItem() == 0) { |
141 | setTopItem(0); | 144 | setTopItem(0); |
142 | } else { | 145 | } else { |
143 | setTopItem(topItem()+1); | 146 | setTopItem(topItem()+1); |
144 | } | 147 | } |
145 | } | 148 | } |
146 | break; | 149 | break; |
147 | case Key_I: | 150 | case Key_I: |
148 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); | 151 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); |
149 | e->ignore(); | 152 | e->ignore(); |
150 | break; | 153 | break; |
151 | case Key_Shift: | 154 | case Key_Shift: |
152 | emit shiftDown(); | 155 | emit shiftDown(); |
153 | break; | 156 | break; |
154 | default: | 157 | default: |
155 | e->ignore(); | 158 | e->ignore(); |
156 | break; | 159 | break; |
157 | } | 160 | } |
158 | } | 161 | } |
159 | 162 | ||
160 | void KNoScrollListBox::oneDown() | 163 | void KNoScrollListBox::oneDown() |
161 | { | 164 | { |
162 | setCurrentItem((currentItem()+1)%count()); | 165 | setCurrentItem((currentItem()+1)%count()); |
163 | if(!itemVisible(currentItem())) { | 166 | if(!itemVisible(currentItem())) { |
164 | if(currentItem() == 0) { | 167 | if(currentItem() == 0) { |
165 | setTopItem(0); | 168 | setTopItem(0); |
166 | } else { | 169 | } else { |
167 | setTopItem(topItem()+1); | 170 | setTopItem(topItem()+1); |
168 | } | 171 | } |
169 | } | 172 | } |
170 | } | 173 | } |
171 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 174 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
172 | { | 175 | { |
173 | switch(e->key()) { | 176 | switch(e->key()) { |
174 | case Key_Shift: | 177 | case Key_Shift: |
175 | emit shiftUp(); | 178 | emit shiftUp(); |
176 | break; | 179 | break; |
177 | default: | 180 | default: |
178 | break; | 181 | break; |
179 | } | 182 | } |
180 | } | 183 | } |
181 | 184 | ||
182 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 185 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
183 | { | 186 | { |
184 | QListBox::mousePressEvent(e); | 187 | QListBox::mousePressEvent(e); |
185 | 188 | ||
186 | if(e->button() == RightButton) { | 189 | if(e->button() == RightButton) { |
187 | emit rightClick(); | 190 | emit rightClick(); |
188 | } | 191 | } |
189 | } | 192 | } |
190 | 193 | ||
191 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 194 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
192 | : QListBoxItem() | 195 | : QListBoxItem() |
193 | { | 196 | { |
194 | setText( s ); | 197 | setText( s ); |
195 | 198 | ||
196 | mIncidence = incidence; | 199 | mIncidence = incidence; |
197 | mDate = qd; | 200 | mDate = qd; |
198 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); | ||
199 | mRecur = false; | 201 | mRecur = false; |
200 | mAlarm = false; | 202 | mAlarm = false; |
201 | mReply = false; | 203 | mReply = false; |
202 | mInfo = false; | 204 | mInfo = false; |
203 | } | 205 | } |
204 | 206 | ||
205 | void MonthViewItem::paint(QPainter *p) | 207 | void MonthViewItem::paint(QPainter *p) |
206 | { | 208 | { |
207 | #if QT_VERSION >= 0x030000 | 209 | #if QT_VERSION >= 0x030000 |
208 | bool sel = isSelected(); | 210 | bool sel = isSelected(); |
209 | #else | 211 | #else |
210 | bool sel = selected(); | 212 | bool sel = selected(); |
211 | #endif | 213 | #endif |
212 | 214 | ||
213 | 215 | ||
214 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) | 216 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) |
215 | { | 217 | { |
216 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 218 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
217 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 219 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
218 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); | 220 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); |
219 | } | 221 | } |
220 | int x = 1; | 222 | int x = 1; |
221 | int y = 3;//(height() - mRecurPixmap.height()) /2; | 223 | int y = 3;//(height() - mRecurPixmap.height()) /2; |
222 | int size = PIXMAP_SIZE; | 224 | int size = PIXMAP_SIZE; |
223 | if ( QApplication::desktop()->width() < 300 ) | 225 | if ( QApplication::desktop()->width() < 300 ) |
224 | size = 3; | 226 | size = 3; |
225 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 227 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
226 | if ( mInfo ) { | 228 | if ( mInfo ) { |
227 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 229 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
228 | x += size + 1; | 230 | x += size + 1; |
229 | } | 231 | } |
230 | if ( mRecur ) { | 232 | if ( mRecur ) { |
231 | p->fillRect ( x, y,size,size, Qt::blue ); | 233 | p->fillRect ( x, y,size,size, Qt::blue ); |
232 | x += size + 1; | 234 | x += size + 1; |
233 | } | 235 | } |
234 | if ( mAlarm ) { | 236 | if ( mAlarm ) { |
235 | p->fillRect ( x, y,size,size, Qt::red ); | 237 | p->fillRect ( x, y,size,size, Qt::red ); |
236 | x += size + 1; | 238 | x += size + 1; |
237 | } | 239 | } |
238 | if ( mReply ) { | 240 | if ( mReply ) { |
239 | p->fillRect ( x, y,size,size, Qt::yellow ); | 241 | p->fillRect ( x, y,size,size, Qt::yellow ); |
240 | x += size + 1; | 242 | x += size + 1; |
241 | } | 243 | } |
242 | } | 244 | } |
243 | QFontMetrics fm = p->fontMetrics(); | 245 | QFontMetrics fm = p->fontMetrics(); |
244 | int yPos; | 246 | int yPos; |
245 | int pmheight = size; | 247 | int pmheight = size; |
246 | if( pmheight < fm.height() ) | 248 | if( pmheight < fm.height() ) |
247 | yPos = fm.ascent() + fm.leading()/2; | 249 | yPos = fm.ascent() + fm.leading()/2; |
248 | else | 250 | else |
249 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 251 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
250 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 252 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
251 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 253 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
252 | p->drawText( x, yPos, text() ); | 254 | p->drawText( x, yPos, text() ); |
253 | if ( mIncidence->cancelled() ) { | 255 | if ( mIncidence->cancelled() ) { |
254 | int wid = fm.width( text() ); | 256 | int wid = fm.width( text() ); |
255 | p->drawLine( x, yPos- fm.height()/2+3,x+wid, yPos- fm.height()/2 +3); | 257 | p->drawLine( x, yPos- fm.height()/2+3,x+wid, yPos- fm.height()/2 +3); |
256 | } | 258 | } |
257 | 259 | ||
258 | } | 260 | } |
259 | 261 | ||
260 | int MonthViewItem::height(const QListBox *lb) const | 262 | int MonthViewItem::height(const QListBox *lb) const |
261 | { | 263 | { |
262 | return lb->fontMetrics().lineSpacing()+1; | 264 | return lb->fontMetrics().lineSpacing()+1; |
263 | } | 265 | } |
264 | 266 | ||
265 | int MonthViewItem::width(const QListBox *lb) const | 267 | int MonthViewItem::width(const QListBox *lb) const |
266 | { | 268 | { |
267 | int size = PIXMAP_SIZE; | 269 | int size = PIXMAP_SIZE; |
268 | if ( QApplication::desktop()->width() < 300 ) | 270 | if ( QApplication::desktop()->width() < 300 ) |
269 | size = 3; | 271 | size = 3; |
270 | int x = 1; | 272 | int x = 1; |
271 | if ( mInfo ) { | 273 | if ( mInfo ) { |
272 | x += size + 1; | 274 | x += size + 1; |
273 | } | 275 | } |
274 | if( mRecur ) { | 276 | if( mRecur ) { |
275 | x += size+1; | 277 | x += size+1; |
276 | } | 278 | } |
277 | if( mAlarm ) { | 279 | if( mAlarm ) { |
278 | x += size+1; | 280 | x += size+1; |
279 | } | 281 | } |
280 | if( mReply ) { | 282 | if( mReply ) { |
281 | x += size+1; | 283 | x += size+1; |
282 | } | 284 | } |
283 | 285 | ||
284 | return( x + lb->fontMetrics().width( text() ) + 1 ); | 286 | return( x + lb->fontMetrics().width( text() ) + 1 ); |
285 | } | 287 | } |
286 | 288 | ||
287 | 289 | ||
288 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | 290 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) |
289 | : QWidget( par ), | 291 | : QWidget( par ), |
290 | mMonthView( parent ) | 292 | mMonthView( parent ) |
291 | { | 293 | { |
292 | 294 | ||
293 | QVBoxLayout *topLayout = new QVBoxLayout( this ); | 295 | QVBoxLayout *topLayout = new QVBoxLayout( this ); |
294 | 296 | ||
295 | // mLabel = new QLabel( this );QPushButton | 297 | // mLabel = new QLabel( this );QPushButton |
296 | mLabel = new QPushButton( this ); | 298 | mLabel = new QPushButton( this ); |
297 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 299 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
298 | //mLabel->setLineWidth( 1 ); | 300 | //mLabel->setLineWidth( 1 ); |
299 | //mLabel->setAlignment( AlignCenter ); | 301 | //mLabel->setAlignment( AlignCenter ); |
300 | mLabel->setFlat( true ); | 302 | mLabel->setFlat( true ); |
301 | mLabel->setFocusPolicy(NoFocus); | 303 | mLabel->setFocusPolicy(NoFocus); |
302 | mItemList = new KNoScrollListBox( this ); | 304 | mItemList = new KNoScrollListBox( this ); |
303 | mItemList->setMinimumSize( 10, 10 ); | 305 | mItemList->setMinimumSize( 10, 10 ); |
304 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 306 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
305 | mItemList->setLineWidth( 1 ); | 307 | mItemList->setLineWidth( 1 ); |
306 | topLayout->addWidget( mItemList ); | 308 | topLayout->addWidget( mItemList ); |
307 | mLabel->raise(); | 309 | mLabel->raise(); |
308 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 310 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
309 | mStandardPalette = palette(); | 311 | mStandardPalette = palette(); |
310 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); | 312 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); |
311 | 313 | ||
312 | enableScrollBars( false ); | 314 | enableScrollBars( false ); |
313 | updateConfig(); | 315 | updateConfig(); |
314 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); | 316 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); |
315 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); | 317 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); |
316 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), | 318 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), |
317 | SLOT( defaultAction( QListBoxItem * ) ) ); | 319 | SLOT( defaultAction( QListBoxItem * ) ) ); |
318 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, | 320 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, |
319 | const QPoint &) ), | 321 | const QPoint &) ), |
320 | SLOT( contextMenu( QListBoxItem * ) ) ); | 322 | SLOT( contextMenu( QListBoxItem * ) ) ); |
321 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), | 323 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), |
322 | SLOT( selection( QListBoxItem * ) ) ); | 324 | SLOT( selection( QListBoxItem * ) ) ); |
323 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 325 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
324 | SLOT( cellClicked( QListBoxItem * ) ) ); | 326 | SLOT( cellClicked( QListBoxItem * ) ) ); |
325 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 327 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
326 | SLOT( selection( QListBoxItem * ) ) ); | 328 | SLOT( selection( QListBoxItem * ) ) ); |
327 | } | 329 | } |
328 | #ifdef DESKTOP_VERSION | 330 | #ifdef DESKTOP_VERSION |
329 | QToolTipGroup *MonthViewCell::toolTipGroup() | 331 | QToolTipGroup *MonthViewCell::toolTipGroup() |
330 | { | 332 | { |
331 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 333 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
332 | return mToolTipGroup; | 334 | return mToolTipGroup; |
333 | } | 335 | } |
334 | #endif | 336 | #endif |
335 | 337 | ||
336 | void MonthViewCell::setDate( const QDate &date ) | 338 | void MonthViewCell::setDate( const QDate &date ) |
337 | { | 339 | { |
338 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 340 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
339 | mDate = date; | 341 | mDate = date; |
340 | 342 | ||
341 | 343 | ||
342 | 344 | ||
343 | //resizeEvent( 0 ); | 345 | //resizeEvent( 0 ); |
344 | } | 346 | } |
345 | 347 | ||
346 | QDate MonthViewCell::date() const | 348 | QDate MonthViewCell::date() const |
347 | { | 349 | { |
348 | return mDate; | 350 | return mDate; |
349 | } | 351 | } |
350 | 352 | ||
351 | void MonthViewCell::setPrimary( bool primary ) | 353 | void MonthViewCell::setPrimary( bool primary ) |
352 | { | 354 | { |
353 | mPrimary = primary; | 355 | mPrimary = primary; |
354 | //setMyPalette(); | 356 | //setMyPalette(); |
355 | } | 357 | } |
356 | void MonthViewCell::setMyPalette() | 358 | void MonthViewCell::setMyPalette() |
357 | { | 359 | { |
358 | 360 | ||
359 | if ( mHoliday) { | 361 | if ( mHoliday) { |
360 | setPalette( mHolidayPalette ); | 362 | setPalette( mHolidayPalette ); |
361 | } else { | 363 | } else { |
362 | if ( mPrimary ) { | 364 | if ( mPrimary ) { |
363 | setPalette( mPrimaryPalette ); | 365 | setPalette( mPrimaryPalette ); |
364 | } else { | 366 | } else { |
365 | setPalette( mNonPrimaryPalette ); | 367 | setPalette( mNonPrimaryPalette ); |
366 | } | 368 | } |
367 | } | 369 | } |
368 | QPalette pal = palette(); | 370 | QPalette pal = palette(); |
369 | 371 | ||
370 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 372 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
371 | } | 373 | } |
372 | QPalette MonthViewCell::getPalette () | 374 | QPalette MonthViewCell::getPalette () |
373 | { | 375 | { |
374 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 376 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
375 | return mStandardPalette; | 377 | return mStandardPalette; |
376 | if ( mHoliday) { | 378 | if ( mHoliday) { |
377 | return mHolidayPalette ; | 379 | return mHolidayPalette ; |
378 | } else { | 380 | } else { |
379 | if ( mPrimary ) { | 381 | if ( mPrimary ) { |
380 | return mPrimaryPalette ; | 382 | return mPrimaryPalette ; |
381 | } | 383 | } |
382 | } | 384 | } |
383 | return mNonPrimaryPalette; | 385 | return mNonPrimaryPalette; |
384 | } | 386 | } |
385 | bool MonthViewCell::isPrimary() const | 387 | bool MonthViewCell::isPrimary() const |
386 | { | 388 | { |
387 | return mPrimary; | 389 | return mPrimary; |
388 | } | 390 | } |
389 | 391 | ||
390 | void MonthViewCell::setHoliday( bool holiday ) | 392 | void MonthViewCell::setHoliday( bool holiday ) |
391 | { | 393 | { |
392 | mHoliday = holiday; | 394 | mHoliday = holiday; |
393 | //setMyPalette(); | 395 | //setMyPalette(); |
394 | } | 396 | } |
395 | 397 | ||
396 | void MonthViewCell::setHoliday( const QString &holiday ) | 398 | void MonthViewCell::setHoliday( const QString &holiday ) |
397 | { | 399 | { |
398 | mHolidayString = holiday; | 400 | mHolidayString = holiday; |
399 | 401 | ||
400 | if ( !holiday.isEmpty() ) { | 402 | if ( !holiday.isEmpty() ) { |
401 | setHoliday( true ); | 403 | setHoliday( true ); |
402 | } | 404 | } |
403 | } | 405 | } |
404 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) | 406 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) |
405 | { | 407 | { |
406 | 408 | ||
407 | e->ignore(); | 409 | e->ignore(); |
408 | 410 | ||
409 | } | 411 | } |
410 | 412 | ||
411 | void MonthViewCell::startUpdateCell() | 413 | void MonthViewCell::startUpdateCell() |
412 | { | 414 | { |
413 | 415 | ||
414 | mItemList->setFocusPolicy(NoFocus); | 416 | mItemList->setFocusPolicy(NoFocus); |
415 | if ( !mMonthView->isUpdatePossible() ) | 417 | if ( !mMonthView->isUpdatePossible() ) |
416 | return; | 418 | return; |
417 | 419 | ||
418 | /* | 420 | /* |
419 | if ( !isVisible() ){ | 421 | if ( !isVisible() ){ |
420 | return; | 422 | return; |
421 | } | 423 | } |
422 | */ | 424 | */ |
423 | // qDebug("MonthViewCell::updateCell() "); | 425 | // qDebug("MonthViewCell::updateCell() "); |
424 | setPrimary( mDate.month()%2 ); | 426 | setPrimary( mDate.month()%2 ); |
425 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 427 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
426 | if ( mDate == QDate::currentDate() ) { | 428 | if ( mDate == QDate::currentDate() ) { |
427 | mItemList->setLineWidth( 3 ); | 429 | mItemList->setLineWidth( 3 ); |
428 | } else { | 430 | } else { |
429 | mItemList->setLineWidth( 1 ); | 431 | mItemList->setLineWidth( 1 ); |
430 | } | 432 | } |
431 | mItemList->clear(); | 433 | mItemList->clear(); |
432 | 434 | ||
433 | #ifdef DESKTOP_VERSION | 435 | #ifdef DESKTOP_VERSION |
434 | QToolTip::remove(this); | 436 | QToolTip::remove(this); |
435 | #endif | 437 | #endif |
436 | mToolTip = ""; | 438 | mToolTip = ""; |
437 | //qApp->processEvents(); | 439 | //qApp->processEvents(); |
438 | if ( !mHolidayString.isEmpty() ) { | 440 | if ( !mHolidayString.isEmpty() ) { |
439 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 441 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
440 | item->setPalette( mHolidayPalette ); | 442 | item->setPalette( mHolidayPalette ); |
441 | mItemList->insertItem( item ); | 443 | mItemList->insertItem( item ); |
442 | mToolTip += mHolidayString+"\n"; | 444 | mToolTip += mHolidayString+"\n"; |
443 | } | 445 | } |
444 | } | 446 | } |
445 | 447 | ||
446 | void MonthViewCell::insertEvent(Event *event) | 448 | void MonthViewCell::insertEvent(Event *event) |
447 | { | 449 | { |
448 | 450 | ||
449 | mItemList->setFocusPolicy(WheelFocus); | 451 | mItemList->setFocusPolicy(WheelFocus); |
450 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 452 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
451 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 453 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
452 | return; | 454 | return; |
453 | else | 455 | else |
454 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 456 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
455 | return; | 457 | return; |
456 | } | 458 | } |
457 | 459 | ||
458 | if ( event->categories().contains("Holiday") || | 460 | if ( event->categories().contains("Holiday") || |
459 | event->categories().contains(i18n("Holiday"))) { | 461 | event->categories().contains(i18n("Holiday"))) { |
460 | setHoliday( true ); | 462 | setHoliday( true ); |
461 | if ( mDate.dayOfWeek() == 7 ) | 463 | if ( mDate.dayOfWeek() == 7 ) |
462 | mItemList->setLineWidth( 3 ); | 464 | mItemList->setLineWidth( 3 ); |
463 | } | 465 | } |
464 | QString text; | 466 | QString text; |
465 | if (event->isMultiDay()) { | 467 | if (event->isMultiDay()) { |
466 | QString prefix = "<->"; | 468 | QString prefix = "<->"; |
467 | if ( event->doesRecur() ) { | 469 | if ( event->doesRecur() ) { |
468 | if ( event->recursOn( mDate) ) | 470 | if ( event->recursOn( mDate) ) |
469 | prefix ="->" ; | 471 | prefix ="->" ; |
470 | else { | 472 | else { |
471 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 473 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
472 | if ( event->recursOn( mDate.addDays( -days)) ) | 474 | if ( event->recursOn( mDate.addDays( -days)) ) |
473 | prefix ="<-" ; | 475 | prefix ="<-" ; |
474 | } | 476 | } |
475 | 477 | ||
476 | } else { | 478 | } else { |
477 | if (mDate == event->dtStart().date()) { | 479 | if (mDate == event->dtStart().date()) { |
478 | prefix ="->" ; | 480 | prefix ="->" ; |
479 | } else if (mDate == event->dtEnd().date()) { | 481 | } else if (mDate == event->dtEnd().date()) { |
480 | prefix ="<-" ; | 482 | prefix ="<-" ; |
481 | } | 483 | } |
482 | } | 484 | } |
483 | if ( !event->doesFloat() ) { | 485 | if ( !event->doesFloat() ) { |
484 | if ( mDate == event->dtStart().date () ) | 486 | if ( mDate == event->dtStart().date () ) |
485 | prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 487 | prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
486 | else if ( mDate == event->dtEnd().date () ) | 488 | else if ( mDate == event->dtEnd().date () ) |
487 | prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 489 | prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
488 | 490 | ||
489 | } | 491 | } |
490 | text = prefix + event->summary(); | 492 | text = prefix + event->summary(); |
491 | mToolTip += text; | 493 | mToolTip += text; |
492 | } else { | 494 | } else { |
493 | if (event->doesFloat()) { | 495 | if (event->doesFloat()) { |
494 | text = event->summary(); | 496 | text = event->summary(); |
495 | mToolTip += text; | 497 | mToolTip += text; |
496 | } | 498 | } |
497 | else { | 499 | else { |
498 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 500 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
499 | text += " " + event->summary(); | 501 | text += " " + event->summary(); |
500 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 502 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
501 | } | 503 | } |
502 | } | 504 | } |
503 | 505 | ||
504 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); | 506 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); |
505 | QPalette pal; | 507 | QPalette pal; |
506 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 508 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
507 | QStringList categories = event->categories(); | 509 | QStringList categories = event->categories(); |
508 | QString cat = categories.first(); | 510 | QString cat = categories.first(); |
509 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 511 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
510 | pal = getPalette(); | 512 | pal = getPalette(); |
511 | if (cat.isEmpty()) { | 513 | if (cat.isEmpty()) { |
512 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 514 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
513 | } else { | 515 | } else { |
514 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 516 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
515 | } | 517 | } |
516 | 518 | ||
517 | } else { | 519 | } else { |
518 | if (cat.isEmpty()) { | 520 | if (cat.isEmpty()) { |
519 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 521 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
520 | } else { | 522 | } else { |
521 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 523 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
522 | } | 524 | } |
523 | } | 525 | } |
524 | 526 | ||
525 | } else { | 527 | } else { |
526 | pal = mStandardPalette ; | 528 | pal = mStandardPalette ; |
527 | } | 529 | } |
528 | item->setPalette( pal ); | 530 | item->setPalette( pal ); |
529 | item->setRecur( event->recurrence()->doesRecur() ); | 531 | item->setRecur( event->recurrence()->doesRecur() ); |
530 | item->setAlarm( event->isAlarmEnabled() ); | 532 | item->setAlarm( event->isAlarmEnabled() ); |
531 | item->setMoreInfo( event->description().length() > 0 ); | 533 | item->setMoreInfo( event->description().length() > 0 ); |
532 | #ifdef DESKTOP_VERSION | 534 | #ifdef DESKTOP_VERSION |
533 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 535 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
534 | KOPrefs::instance()->email()); | 536 | KOPrefs::instance()->email()); |
535 | if ( me != 0 ) { | 537 | if ( me != 0 ) { |
536 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 538 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
537 | item->setReply(true); | 539 | item->setReply(true); |
538 | else | 540 | else |
539 | item->setReply(false); | 541 | item->setReply(false); |
540 | } else | 542 | } else |
541 | item->setReply(false); | 543 | item->setReply(false); |
542 | #endif | 544 | #endif |
543 | mItemList->insertItem( item ); | 545 | mItemList->insertItem( item ); |
544 | mToolTip += "\n"; | 546 | mToolTip += "\n"; |
545 | } | 547 | } |
546 | void MonthViewCell::insertTodo(Todo *todo) | 548 | void MonthViewCell::insertTodo(Todo *todo) |
547 | { | 549 | { |
548 | mItemList->setFocusPolicy(WheelFocus); | 550 | mItemList->setFocusPolicy(WheelFocus); |
549 | QString text; | 551 | QString text; |
550 | if (todo->hasDueDate()) { | 552 | if (todo->hasDueDate()) { |
551 | if (!todo->doesFloat()) { | 553 | if (!todo->doesFloat()) { |
552 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 554 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
553 | text += " "; | 555 | text += " "; |
554 | } | 556 | } |
555 | } | 557 | } |
556 | text += i18n("T: %1").arg(todo->summary()); | 558 | text += i18n("T: %1").arg(todo->summary()); |
557 | 559 | ||
558 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 560 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
559 | //item->setPalette( mStandardPalette ); | 561 | //item->setPalette( mStandardPalette ); |
560 | QPalette pal; | 562 | QPalette pal; |
561 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 563 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
562 | QStringList categories = todo->categories(); | 564 | QStringList categories = todo->categories(); |
563 | QString cat = categories.first(); | 565 | QString cat = categories.first(); |
564 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 566 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
565 | pal = getPalette(); | 567 | pal = getPalette(); |
566 | if (cat.isEmpty()) { | 568 | if (cat.isEmpty()) { |
567 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 569 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
568 | } else { | 570 | } else { |
569 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 571 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
570 | } | 572 | } |
571 | 573 | ||
572 | } else { | 574 | } else { |
573 | if (cat.isEmpty()) { | 575 | if (cat.isEmpty()) { |
574 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 576 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
575 | } else { | 577 | } else { |
576 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 578 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
577 | } | 579 | } |
578 | } | 580 | } |
579 | 581 | ||
580 | } else { | 582 | } else { |
581 | pal = mStandardPalette ; | 583 | pal = mStandardPalette ; |
582 | } | 584 | } |
583 | item->setPalette( pal ); | 585 | item->setPalette( pal ); |
584 | item->setRecur( todo->recurrence()->doesRecur() ); | 586 | item->setRecur( todo->recurrence()->doesRecur() ); |
585 | item->setAlarm( todo->isAlarmEnabled() ); | 587 | item->setAlarm( todo->isAlarmEnabled() ); |
586 | item->setMoreInfo( todo->description().length() > 0 ); | 588 | item->setMoreInfo( todo->description().length() > 0 ); |
587 | mItemList->insertItem( item ); | 589 | mItemList->insertItem( item ); |
588 | mToolTip += text+"\n"; | 590 | mToolTip += text+"\n"; |
589 | } | 591 | } |
590 | void MonthViewCell::finishUpdateCell() | 592 | void MonthViewCell::finishUpdateCell() |
591 | { | 593 | { |
592 | #ifdef DESKTOP_VERSION | 594 | #ifdef DESKTOP_VERSION |
593 | if (mToolTip != "") | 595 | if (mToolTip != "") |
594 | QToolTip::add(this,mToolTip,toolTipGroup(),""); | 596 | QToolTip::add(this,mToolTip,toolTipGroup(),""); |
595 | #endif | 597 | #endif |
596 | mItemList->sort(); | 598 | mItemList->sort(); |
597 | //setMyPalette(); | 599 | //setMyPalette(); |
598 | setMyPalette(); | 600 | setMyPalette(); |
599 | QString text; | 601 | QString text; |
600 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 602 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
601 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 603 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
602 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 604 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
603 | mLabel->resize( mLabelBigSize ); | 605 | mLabel->resize( mLabelBigSize ); |
604 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 606 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
605 | } else { | 607 | } else { |
606 | mLabel->resize( mLabelSize ); | 608 | mLabel->resize( mLabelSize ); |
607 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 609 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
608 | } | 610 | } |
609 | 611 | ||
610 | mLabel->setText( text ); | 612 | mLabel->setText( text ); |
611 | resizeEvent( 0 ); | 613 | resizeEvent( 0 ); |
612 | } | 614 | } |
613 | void MonthViewCell::updateCell() | 615 | void MonthViewCell::updateCell() |
614 | { | 616 | { |
615 | qDebug("MonthViewCell::updateCell() "); | 617 | qDebug("MonthViewCell::updateCell() "); |
616 | if ( !mMonthView->isUpdatePossible() ) | 618 | if ( !mMonthView->isUpdatePossible() ) |
617 | return; | 619 | return; |
618 | startUpdateCell(); | 620 | startUpdateCell(); |
619 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 621 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
620 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 622 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
621 | Event *event; | 623 | Event *event; |
622 | for( event = events.first(); event; event = events.next() ) { // for event | 624 | for( event = events.first(); event; event = events.next() ) { // for event |
623 | insertEvent(event); | 625 | insertEvent(event); |
624 | } | 626 | } |
625 | // insert due todos | 627 | // insert due todos |
626 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 628 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
627 | Todo *todo; | 629 | Todo *todo; |
628 | for(todo = todos.first(); todo; todo = todos.next()) { | 630 | for(todo = todos.first(); todo; todo = todos.next()) { |
629 | insertTodo( todo ); | 631 | insertTodo( todo ); |
630 | } | 632 | } |
631 | finishUpdateCell(); | 633 | finishUpdateCell(); |
632 | // if ( isVisible()) | 634 | // if ( isVisible()) |
633 | //qApp->processEvents(); | 635 | //qApp->processEvents(); |
634 | } | 636 | } |
635 | 637 | ||
636 | void MonthViewCell::updateConfig( bool bigFont ) // = false | 638 | void MonthViewCell::updateConfig( bool bigFont ) // = false |
637 | { | 639 | { |
638 | 640 | ||
639 | if ( bigFont ) { | 641 | if ( bigFont ) { |
640 | QFont fo = KOPrefs::instance()->mMonthViewFont; | 642 | QFont fo = KOPrefs::instance()->mMonthViewFont; |
641 | int ps = fo.pointSize() + 2; | 643 | int ps = fo.pointSize() + 2; |
642 | if ( ps < 18 ) | 644 | if ( ps < 18 ) |
643 | ps += 2; | 645 | ps += 2; |
644 | fo.setPointSize( ps ); | 646 | fo.setPointSize( ps ); |
645 | setFont( fo ); | 647 | setFont( fo ); |
646 | } else | 648 | } else |
647 | setFont( KOPrefs::instance()->mMonthViewFont ); | 649 | setFont( KOPrefs::instance()->mMonthViewFont ); |
648 | 650 | ||
649 | QFontMetrics fm( font() ); | 651 | QFontMetrics fm( font() ); |
650 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 652 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
651 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 653 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
652 | mHolidayPalette = mStandardPalette; | 654 | mHolidayPalette = mStandardPalette; |
653 | mPrimaryPalette = mStandardPalette; | 655 | mPrimaryPalette = mStandardPalette; |
654 | mNonPrimaryPalette = mStandardPalette; | 656 | mNonPrimaryPalette = mStandardPalette; |
655 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 657 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
656 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 658 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
657 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 659 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
658 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 660 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
659 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 661 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
660 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 662 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
661 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 663 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
662 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 664 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
663 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 665 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
664 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 666 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
665 | } | 667 | } |
666 | //updateCell(); | 668 | //updateCell(); |
667 | } | 669 | } |
668 | 670 | ||
669 | void MonthViewCell::enableScrollBars( bool enabled ) | 671 | void MonthViewCell::enableScrollBars( bool enabled ) |
670 | { | 672 | { |
671 | if ( enabled ) { | 673 | if ( enabled ) { |
672 | mItemList->setVScrollBarMode(QScrollView::Auto); | 674 | mItemList->setVScrollBarMode(QScrollView::Auto); |
673 | mItemList->setHScrollBarMode(QScrollView::Auto); | 675 | mItemList->setHScrollBarMode(QScrollView::Auto); |
674 | } else { | 676 | } else { |
675 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); | 677 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); |
676 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); | 678 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); |
677 | } | 679 | } |
678 | } | 680 | } |
679 | 681 | ||
680 | Incidence *MonthViewCell::selectedIncidence() | 682 | Incidence *MonthViewCell::selectedIncidence() |
681 | { | 683 | { |
682 | int index = mItemList->currentItem(); | 684 | int index = mItemList->currentItem(); |
683 | if ( index < 0 ) return 0; | 685 | if ( index < 0 ) return 0; |
684 | 686 | ||
685 | MonthViewItem *item = | 687 | MonthViewItem *item = |
686 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 688 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
687 | 689 | ||
688 | if ( !item ) return 0; | 690 | if ( !item ) return 0; |
689 | 691 | ||
690 | return item->incidence(); | 692 | return item->incidence(); |
691 | } | 693 | } |
692 | 694 | ||
693 | QDate MonthViewCell::selectedIncidenceDate() | 695 | QDate MonthViewCell::selectedIncidenceDate() |
694 | { | 696 | { |
695 | QDate qd; | 697 | QDate qd; |
696 | int index = mItemList->currentItem(); | 698 | int index = mItemList->currentItem(); |
697 | if ( index < 0 ) return qd; | 699 | if ( index < 0 ) return qd; |
698 | 700 | ||
699 | MonthViewItem *item = | 701 | MonthViewItem *item = |
700 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 702 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
701 | 703 | ||
702 | if ( !item ) return qd; | 704 | if ( !item ) return qd; |
703 | 705 | ||
704 | return item->incidenceDate(); | 706 | return item->incidenceDate(); |
705 | } | 707 | } |
706 | 708 | ||
707 | void MonthViewCell::deselect() | 709 | void MonthViewCell::deselect() |
708 | { | 710 | { |
709 | mItemList->clearSelection(); | 711 | mItemList->clearSelection(); |
710 | enableScrollBars( false ); | 712 | enableScrollBars( false ); |
711 | // updateCell(); | 713 | // updateCell(); |
712 | } | 714 | } |
713 | void MonthViewCell::select() | 715 | void MonthViewCell::select() |
714 | { | 716 | { |
715 | ;// updateCell(); | 717 | ;// updateCell(); |
716 | } | 718 | } |
717 | 719 | ||
718 | void MonthViewCell::resizeEvent ( QResizeEvent * ) | 720 | void MonthViewCell::resizeEvent ( QResizeEvent * ) |
719 | { | 721 | { |
720 | if ( !mMonthView->isUpdatePossible() ) | 722 | if ( !mMonthView->isUpdatePossible() ) |
721 | return; | 723 | return; |
722 | 724 | ||
723 | int size = height() - mLabel->height() - 2; | 725 | int size = height() - mLabel->height() - 2; |
724 | if ( size > 0 ) | 726 | if ( size > 0 ) |
725 | mItemList->verticalScrollBar()->setMaximumHeight( size ); | 727 | mItemList->verticalScrollBar()->setMaximumHeight( size ); |
726 | size = width() - mLabel->width() -2; | 728 | size = width() - mLabel->width() -2; |
727 | if ( size > 0 ) | 729 | if ( size > 0 ) |
728 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); | 730 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); |
729 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); | 731 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); |
730 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 732 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
731 | } | 733 | } |
732 | 734 | ||
733 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 735 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
734 | { | 736 | { |
735 | if ( !item ) return; | 737 | if ( !item ) return; |
736 | 738 | ||
737 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 739 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
738 | Incidence *incidence = eventItem->incidence(); | 740 | Incidence *incidence = eventItem->incidence(); |
739 | if ( incidence ) mMonthView->defaultAction( incidence ); | 741 | if ( incidence ) mMonthView->defaultAction( incidence ); |
740 | } | 742 | } |
741 | void MonthViewCell::showDay() | 743 | void MonthViewCell::showDay() |
742 | { | 744 | { |
743 | emit showDaySignal( date() ); | 745 | emit showDaySignal( date() ); |
744 | } | 746 | } |
745 | void MonthViewCell::newEvent() | 747 | void MonthViewCell::newEvent() |
746 | { | 748 | { |
747 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 749 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
748 | emit newEventSignal( dt ); | 750 | emit newEventSignal( dt ); |
749 | } | 751 | } |
750 | void MonthViewCell::cellClicked( QListBoxItem *item ) | 752 | void MonthViewCell::cellClicked( QListBoxItem *item ) |
751 | { | 753 | { |
752 | static QListBoxItem * lastClicked = 0; | 754 | static QListBoxItem * lastClicked = 0; |
753 | if ( item == 0 ) { | 755 | if ( item == 0 ) { |
754 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 756 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
755 | emit newEventSignal( dt ); | 757 | emit newEventSignal( dt ); |
756 | return; | 758 | return; |
757 | } | 759 | } |
758 | /* | 760 | /* |
759 | if ( lastClicked ) | 761 | if ( lastClicked ) |
760 | if ( ! item ) { | 762 | if ( ! item ) { |
761 | if ( lastClicked->listBox() != item->listBox() ) | 763 | if ( lastClicked->listBox() != item->listBox() ) |
762 | lastClicked->listBox()->clearSelection(); | 764 | lastClicked->listBox()->clearSelection(); |
763 | } | 765 | } |
764 | */ | 766 | */ |
765 | 767 | ||
766 | mMonthView->setSelectedCell( this ); | 768 | mMonthView->setSelectedCell( this ); |
767 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); | 769 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); |
768 | select(); | 770 | select(); |
769 | } | 771 | } |
770 | 772 | ||
771 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 773 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
772 | { | 774 | { |
773 | if ( !item ) return; | 775 | if ( !item ) return; |
774 | 776 | ||
775 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 777 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
776 | Incidence *incidence = eventItem->incidence(); | 778 | Incidence *incidence = eventItem->incidence(); |
777 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 779 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
778 | } | 780 | } |
779 | 781 | ||
780 | void MonthViewCell::selection( QListBoxItem *item ) | 782 | void MonthViewCell::selection( QListBoxItem *item ) |
781 | { | 783 | { |
782 | if ( !item ) return; | 784 | if ( !item ) return; |
783 | 785 | ||
784 | mMonthView->setSelectedCell( this ); | 786 | mMonthView->setSelectedCell( this ); |
785 | } | 787 | } |
786 | 788 | ||
787 | 789 | ||
788 | // ******************************************************************************* | 790 | // ******************************************************************************* |
789 | // ******************************************************************************* | 791 | // ******************************************************************************* |
790 | // ******************************************************************************* | 792 | // ******************************************************************************* |
791 | 793 | ||
792 | 794 | ||
793 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 795 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
794 | : KOEventView( calendar, parent, name ), | 796 | : KOEventView( calendar, parent, name ), |
795 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 797 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
796 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 798 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
797 | { | 799 | { |
798 | mShortDayLabelsM = false; | 800 | mShortDayLabelsM = false; |
799 | mShortDayLabelsW = false; | 801 | mShortDayLabelsW = false; |
800 | skipResize = false; | 802 | skipResize = false; |
801 | clPending = true; | 803 | clPending = true; |
802 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); | 804 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); |
803 | mWidStack = new QWidgetStack( this ); | 805 | mWidStack = new QWidgetStack( this ); |
804 | QVBoxLayout* hb = new QVBoxLayout( this ); | 806 | QVBoxLayout* hb = new QVBoxLayout( this ); |
805 | mMonthView = new QWidget( mWidStack ); | 807 | mMonthView = new QWidget( mWidStack ); |
806 | mWeekView = new QWidget( mWidStack ); | 808 | mWeekView = new QWidget( mWidStack ); |
807 | #if QT_VERSION >= 0x030000 | 809 | #if QT_VERSION >= 0x030000 |
808 | mWidStack->addWidget(mMonthView ); | 810 | mWidStack->addWidget(mMonthView ); |
809 | mWidStack->addWidget(mWeekView ); | 811 | mWidStack->addWidget(mWeekView ); |
810 | #else | 812 | #else |
811 | mWidStack->addWidget( mMonthView, 1 ); | 813 | mWidStack->addWidget( mMonthView, 1 ); |
812 | mWidStack->addWidget( mWeekView , 1 ); | 814 | mWidStack->addWidget( mWeekView , 1 ); |
813 | #endif | 815 | #endif |
814 | hb->addWidget( mNavigatorBar ); | 816 | hb->addWidget( mNavigatorBar ); |
815 | hb->addWidget( mWidStack ); | 817 | hb->addWidget( mWidStack ); |
816 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 818 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
817 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; | 819 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; |
818 | if ( mShowWeekView ) | 820 | if ( mShowWeekView ) |
819 | mWeekStartsMonday = true; | 821 | mWeekStartsMonday = true; |
820 | updatePossible = false; | 822 | updatePossible = false; |
821 | //updatePossible = true; | 823 | //updatePossible = true; |
822 | mCells.setAutoDelete( true ); | 824 | mCells.setAutoDelete( true ); |
823 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 825 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
824 | mDayLabels.resize( mDaysPerWeek ); | 826 | mDayLabels.resize( mDaysPerWeek ); |
825 | mDayLabelsW.resize( mDaysPerWeek ); | 827 | mDayLabelsW.resize( mDaysPerWeek ); |
826 | QFont bfont = font(); | 828 | QFont bfont = font(); |
827 | if ( QApplication::desktop()->width() < 650 ) { | 829 | if ( QApplication::desktop()->width() < 650 ) { |
828 | bfont.setPointSize( bfont.pointSize() - 2 ); | 830 | bfont.setPointSize( bfont.pointSize() - 2 ); |
829 | } | 831 | } |
830 | bfont.setBold( true ); | 832 | bfont.setBold( true ); |
831 | int i; | 833 | int i; |
832 | 834 | ||
833 | for( i = 0; i < mDaysPerWeek; i++ ) { | 835 | for( i = 0; i < mDaysPerWeek; i++ ) { |
834 | QLabel *label = new QLabel( mMonthView ); | 836 | QLabel *label = new QLabel( mMonthView ); |
835 | label->setFont(bfont); | 837 | label->setFont(bfont); |
836 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 838 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
837 | label->setLineWidth(1); | 839 | label->setLineWidth(1); |
838 | label->setAlignment(AlignCenter); | 840 | label->setAlignment(AlignCenter); |
839 | mDayLabels.insert( i, label ); | 841 | mDayLabels.insert( i, label ); |
840 | label = new QLabel( mWeekView ); | 842 | label = new QLabel( mWeekView ); |
841 | label->setFont(bfont); | 843 | label->setFont(bfont); |
842 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 844 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
843 | label->setLineWidth(1); | 845 | label->setLineWidth(1); |
844 | label->setAlignment(AlignCenter); | 846 | label->setAlignment(AlignCenter); |
845 | mDayLabelsW.insert( i, label ); | 847 | mDayLabelsW.insert( i, label ); |
846 | } | 848 | } |
847 | 849 | ||
848 | bfont.setBold( false ); | 850 | bfont.setBold( false ); |
849 | mWeekLabels.resize( mNumWeeks+1 ); | 851 | mWeekLabels.resize( mNumWeeks+1 ); |
850 | mWeekLabelsW.resize( 2 ); | 852 | mWeekLabelsW.resize( 2 ); |
851 | for( i = 0; i < mNumWeeks+1; i++ ) { | 853 | for( i = 0; i < mNumWeeks+1; i++ ) { |
852 | KOWeekButton *label = new KOWeekButton( mMonthView ); | 854 | KOWeekButton *label = new KOWeekButton( mMonthView ); |
853 | label->setFocusPolicy(NoFocus); | 855 | label->setFocusPolicy(NoFocus); |
854 | label->setFont(bfont); | 856 | label->setFont(bfont); |
855 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 857 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
856 | label->setFlat(true); | 858 | label->setFlat(true); |
857 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 859 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
858 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 860 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
859 | //label->setLineWidth(1); | 861 | //label->setLineWidth(1); |
860 | //label->setAlignment(AlignCenter); | 862 | //label->setAlignment(AlignCenter); |
861 | mWeekLabels.insert( i, label ); | 863 | mWeekLabels.insert( i, label ); |
862 | } | 864 | } |
863 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 865 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
864 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); | 866 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); |
865 | 867 | ||
866 | for( i = 0; i < 1+1; i++ ) { | 868 | for( i = 0; i < 1+1; i++ ) { |
867 | KOWeekButton *label = new KOWeekButton( mWeekView ); | 869 | KOWeekButton *label = new KOWeekButton( mWeekView ); |
868 | label->setFocusPolicy(NoFocus); | 870 | label->setFocusPolicy(NoFocus); |
869 | label->setFont(bfont); | 871 | label->setFont(bfont); |
870 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 872 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
871 | label->setFlat(true); | 873 | label->setFlat(true); |
872 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 874 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
873 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 875 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
874 | //label->setLineWidth(1); | 876 | //label->setLineWidth(1); |
875 | //label->setAlignment(AlignCenter); | 877 | //label->setAlignment(AlignCenter); |
876 | mWeekLabelsW.insert( i, label ); | 878 | mWeekLabelsW.insert( i, label ); |
877 | } | 879 | } |
878 | mWeekLabelsW[1]->setText( i18n("W")); | 880 | mWeekLabelsW[1]->setText( i18n("W")); |
879 | 881 | ||
880 | 882 | ||
881 | int row, col; | 883 | int row, col; |
882 | mCells.resize( mNumCells ); | 884 | mCells.resize( mNumCells ); |
883 | for( row = 0; row < mNumWeeks; ++row ) { | 885 | for( row = 0; row < mNumWeeks; ++row ) { |
884 | for( col = 0; col < mDaysPerWeek; ++col ) { | 886 | for( col = 0; col < mDaysPerWeek; ++col ) { |
885 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); | 887 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); |
886 | mCells.insert( row * mDaysPerWeek + col, cell ); | 888 | mCells.insert( row * mDaysPerWeek + col, cell ); |
887 | 889 | ||
888 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 890 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
889 | SLOT( defaultAction( Incidence * ) ) ); | 891 | SLOT( defaultAction( Incidence * ) ) ); |
890 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 892 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
891 | SIGNAL( newEventSignal( QDateTime ) ) ); | 893 | SIGNAL( newEventSignal( QDateTime ) ) ); |
892 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 894 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
893 | SIGNAL( showDaySignal( QDate ) ) ); | 895 | SIGNAL( showDaySignal( QDate ) ) ); |
894 | } | 896 | } |
895 | } | 897 | } |
896 | mCellsW.resize( mDaysPerWeek ); | 898 | mCellsW.resize( mDaysPerWeek ); |
897 | for( col = 0; col < mDaysPerWeek; ++col ) { | 899 | for( col = 0; col < mDaysPerWeek; ++col ) { |
898 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); | 900 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); |
899 | mCellsW.insert( col, cell ); | 901 | mCellsW.insert( col, cell ); |
900 | 902 | ||
901 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 903 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
902 | SLOT( defaultAction( Incidence * ) ) ); | 904 | SLOT( defaultAction( Incidence * ) ) ); |
903 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 905 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
904 | SIGNAL( newEventSignal( QDateTime ) ) ); | 906 | SIGNAL( newEventSignal( QDateTime ) ) ); |
905 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 907 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
906 | SIGNAL( showDaySignal( QDate ) ) ); | 908 | SIGNAL( showDaySignal( QDate ) ) ); |
907 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); | 909 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); |
908 | } | 910 | } |
909 | 911 | ||
910 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); | 912 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); |
911 | mContextMenu = eventPopup(); | 913 | mContextMenu = eventPopup(); |
912 | // updateConfig(); //useless here... | 914 | // updateConfig(); //useless here... |
913 | // ... but we need mWidthLongDayLabel computed | 915 | // ... but we need mWidthLongDayLabel computed |
914 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 916 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
915 | mWidthLongDayLabel = 0; | 917 | mWidthLongDayLabel = 0; |
916 | for (int i = 0; i < 7; i++) { | 918 | for (int i = 0; i < 7; i++) { |
917 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 919 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
918 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 920 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
919 | } | 921 | } |
920 | 922 | ||
921 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 923 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
922 | 924 | ||
923 | #if 0 | 925 | #if 0 |
924 | if ( mShowWeekView ) | 926 | if ( mShowWeekView ) |
925 | mWidStack->raiseWidget( mWeekView ); | 927 | mWidStack->raiseWidget( mWeekView ); |
926 | else | 928 | else |
927 | mWidStack->raiseWidget( mMonthView ); | 929 | mWidStack->raiseWidget( mMonthView ); |
928 | #endif | 930 | #endif |
929 | 931 | ||
930 | emit incidenceSelected( 0 ); | 932 | emit incidenceSelected( 0 ); |
931 | #ifndef DESKTOP_VERSION | 933 | #ifndef DESKTOP_VERSION |
932 | resize( QApplication::desktop()->size() ); | 934 | resize( QApplication::desktop()->size() ); |
933 | #else | 935 | #else |
934 | resize(640, 480 ); | 936 | resize(640, 480 ); |
935 | updatePossible = true; | 937 | updatePossible = true; |
936 | #endif | 938 | #endif |
937 | computeLayout(); | 939 | computeLayout(); |
938 | 940 | ||
939 | if ( mShowWeekView ) | 941 | if ( mShowWeekView ) |
940 | mWidStack->raiseWidget( mWeekView ); | 942 | mWidStack->raiseWidget( mWeekView ); |
941 | else | 943 | else |
942 | mWidStack->raiseWidget( mMonthView ); | 944 | mWidStack->raiseWidget( mMonthView ); |
943 | } | 945 | } |
944 | 946 | ||
945 | KOMonthView::~KOMonthView() | 947 | KOMonthView::~KOMonthView() |
946 | { | 948 | { |
947 | delete mContextMenu; | 949 | delete mContextMenu; |
948 | } | 950 | } |
949 | 951 | ||
950 | void KOMonthView::selectInternalWeekNum ( int n ) | 952 | void KOMonthView::selectInternalWeekNum ( int n ) |
951 | { | 953 | { |
952 | switchView(); | 954 | switchView(); |
953 | if ( !KOPrefs::instance()->mMonthViewWeek ) | 955 | if ( !KOPrefs::instance()->mMonthViewWeek ) |
954 | emit selectMonth (); | 956 | emit selectMonth (); |
955 | else | 957 | else |
956 | emit selectWeekNum ( n ); | 958 | emit selectWeekNum ( n ); |
957 | } | 959 | } |
958 | 960 | ||
959 | int KOMonthView::currentWeek() | 961 | int KOMonthView::currentWeek() |
960 | { | 962 | { |
961 | if ( mShowWeekView ) | 963 | if ( mShowWeekView ) |
962 | return mWeekLabelsW[0]->getWeekNum(); | 964 | return mWeekLabelsW[0]->getWeekNum(); |
963 | return mWeekLabels[0]->getWeekNum(); | 965 | return mWeekLabels[0]->getWeekNum(); |
964 | } | 966 | } |
965 | void KOMonthView::switchView() | 967 | void KOMonthView::switchView() |
966 | { | 968 | { |
967 | if ( selectedCell( ) ) | 969 | if ( selectedCell( ) ) |
968 | selectedCell()->deselect(); | 970 | selectedCell()->deselect(); |
969 | mShowWeekView = !mShowWeekView; | 971 | mShowWeekView = !mShowWeekView; |
970 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; | 972 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; |
971 | if ( clPending ) { | 973 | if ( clPending ) { |
972 | computeLayout(); | 974 | computeLayout(); |
973 | updateConfig(); | 975 | updateConfig(); |
974 | } | 976 | } |
975 | if ( mShowWeekView ) | 977 | if ( mShowWeekView ) |
976 | mWidStack->raiseWidget( mWeekView ); | 978 | mWidStack->raiseWidget( mWeekView ); |
977 | else | 979 | else |
978 | mWidStack->raiseWidget( mMonthView ); | 980 | mWidStack->raiseWidget( mMonthView ); |
979 | clPending = false; | 981 | clPending = false; |
980 | } | 982 | } |
981 | 983 | ||
982 | int KOMonthView::maxDatesHint() | 984 | int KOMonthView::maxDatesHint() |
983 | { | 985 | { |
984 | return mNumCells; | 986 | return mNumCells; |
985 | } | 987 | } |
986 | 988 | ||
987 | int KOMonthView::currentDateCount() | 989 | int KOMonthView::currentDateCount() |
988 | { | 990 | { |
989 | return mNumCells; | 991 | return mNumCells; |
990 | } | 992 | } |
991 | 993 | ||
992 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 994 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
993 | { | 995 | { |
994 | QPtrList<Incidence> selected; | 996 | QPtrList<Incidence> selected; |
995 | 997 | ||
996 | if ( mSelectedCell ) { | 998 | if ( mSelectedCell ) { |
997 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 999 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
998 | if ( incidence ) selected.append( incidence ); | 1000 | if ( incidence ) selected.append( incidence ); |
999 | } | 1001 | } |
1000 | 1002 | ||
1001 | return selected; | 1003 | return selected; |
1002 | } | 1004 | } |
1003 | 1005 | ||
1004 | DateList KOMonthView::selectedDates() | 1006 | DateList KOMonthView::selectedDates() |
1005 | { | 1007 | { |
1006 | DateList selected; | 1008 | DateList selected; |
1007 | 1009 | ||
1008 | if ( mSelectedCell ) { | 1010 | if ( mSelectedCell ) { |
1009 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 1011 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
1010 | if ( qd.isValid() ) selected.append( qd ); | 1012 | if ( qd.isValid() ) selected.append( qd ); |
1011 | } | 1013 | } |
1012 | 1014 | ||
1013 | return selected; | 1015 | return selected; |
1014 | } | 1016 | } |
1015 | 1017 | ||
1016 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1018 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1017 | const QDate &td) | 1019 | const QDate &td) |
1018 | { | 1020 | { |
1019 | #ifndef KORG_NOPRINTER | 1021 | #ifndef KORG_NOPRINTER |
1020 | calPrinter->preview(CalPrinter::Month, fd, td); | 1022 | calPrinter->preview(CalPrinter::Month, fd, td); |
1021 | #endif | 1023 | #endif |
1022 | } | 1024 | } |
1023 | 1025 | ||
1024 | void KOMonthView::updateConfig() | 1026 | void KOMonthView::updateConfig() |
1025 | { | 1027 | { |
1026 | 1028 | ||
1027 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 1029 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
1028 | 1030 | ||
1029 | if ( mShowWeekView ) { | 1031 | if ( mShowWeekView ) { |
1030 | mWeekStartsMonday = true; | 1032 | mWeekStartsMonday = true; |
1031 | } | 1033 | } |
1032 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 1034 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
1033 | mWidthLongDayLabel = 0; | 1035 | mWidthLongDayLabel = 0; |
1034 | 1036 | ||
1035 | for (int i = 0; i < 7; i++) { | 1037 | for (int i = 0; i < 7; i++) { |
1036 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 1038 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
1037 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 1039 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
1038 | } | 1040 | } |
1039 | bool temp = mShowSatSunComp ; | 1041 | bool temp = mShowSatSunComp ; |
1040 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 1042 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
1041 | if ( ! mShowWeekView ) { | 1043 | if ( ! mShowWeekView ) { |
1042 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) | 1044 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) |
1043 | computeLayout(); | 1045 | computeLayout(); |
1044 | } | 1046 | } |
1045 | updateDayLabels(); | 1047 | updateDayLabels(); |
1046 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 1048 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
1047 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 1049 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
1048 | //resizeEvent( 0 ); | 1050 | //resizeEvent( 0 ); |
1049 | for (uint i = 0; i < mCells.count(); ++i) { | 1051 | for (uint i = 0; i < mCells.count(); ++i) { |
1050 | mCells[i]->updateConfig(); | 1052 | mCells[i]->updateConfig(); |
1051 | } | 1053 | } |
1052 | 1054 | ||
1053 | for (uint i = 0; i < mCellsW.count(); ++i) { | 1055 | for (uint i = 0; i < mCellsW.count(); ++i) { |
1054 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); | 1056 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); |
1055 | } | 1057 | } |
1056 | #ifdef DESKTOP_VERSION | 1058 | #ifdef DESKTOP_VERSION |
1057 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | 1059 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); |
1058 | #endif | 1060 | #endif |
1059 | updateView(); | 1061 | updateView(); |
1060 | } | 1062 | } |
1061 | 1063 | ||
1062 | void KOMonthView::updateDayLabels() | 1064 | void KOMonthView::updateDayLabels() |
1063 | { | 1065 | { |
1064 | 1066 | ||
1065 | QPtrVector<QLabel> *mDayLabelsT; | 1067 | QPtrVector<QLabel> *mDayLabelsT; |
1066 | 1068 | ||
1067 | mDayLabelsT = &mDayLabelsW; | 1069 | mDayLabelsT = &mDayLabelsW; |
1068 | for (int i = 0; i < 7; i++) { | 1070 | for (int i = 0; i < 7; i++) { |
1069 | if (mWeekStartsMonday) { | 1071 | if (mWeekStartsMonday) { |
1070 | bool show = mShortDayLabelsW; | 1072 | bool show = mShortDayLabelsW; |
1071 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1073 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1072 | show = true; | 1074 | show = true; |
1073 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1075 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1074 | } else { | 1076 | } else { |
1075 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW)); | 1077 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW)); |
1076 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW)); | 1078 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW)); |
1077 | 1079 | ||
1078 | } | 1080 | } |
1079 | } | 1081 | } |
1080 | mDayLabelsT = &mDayLabels; | 1082 | mDayLabelsT = &mDayLabels; |
1081 | for (int i = 0; i < 7; i++) { | 1083 | for (int i = 0; i < 7; i++) { |
1082 | if (mWeekStartsMonday) { | 1084 | if (mWeekStartsMonday) { |
1083 | bool show = mShortDayLabelsM; | 1085 | bool show = mShortDayLabelsM; |
1084 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1086 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1085 | show = true; | 1087 | show = true; |
1086 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1088 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1087 | } else { | 1089 | } else { |
1088 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); | 1090 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); |
1089 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); | 1091 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); |
1090 | 1092 | ||
1091 | } | 1093 | } |
1092 | } | 1094 | } |
1093 | 1095 | ||
1094 | } | 1096 | } |
1095 | 1097 | ||
1096 | void KOMonthView::showDates(const QDate &start, const QDate &) | 1098 | void KOMonthView::showDates(const QDate &start, const QDate &) |
1097 | { | 1099 | { |
1098 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 1100 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
1099 | 1101 | ||
1100 | QPtrVector<MonthViewCell> *cells; | 1102 | QPtrVector<MonthViewCell> *cells; |
1101 | QPtrVector<QLabel> *dayLabels; | 1103 | QPtrVector<QLabel> *dayLabels; |
1102 | QPtrVector<KOWeekButton> *weekLabels; | 1104 | QPtrVector<KOWeekButton> *weekLabels; |
1103 | int weekNum = 6; | 1105 | int weekNum = 6; |
1104 | if ( mShowWeekView ) { | 1106 | if ( mShowWeekView ) { |
1105 | weekNum = 1; | 1107 | weekNum = 1; |
1106 | cells = &mCellsW; | 1108 | cells = &mCellsW; |
1107 | dayLabels = &mDayLabelsW; | 1109 | dayLabels = &mDayLabelsW; |
1108 | weekLabels = &mWeekLabelsW; | 1110 | weekLabels = &mWeekLabelsW; |
1109 | } else { | 1111 | } else { |
1110 | cells = &mCells; | 1112 | cells = &mCells; |
1111 | dayLabels = &mDayLabels; | 1113 | dayLabels = &mDayLabels; |
1112 | weekLabels = &mWeekLabels; | 1114 | weekLabels = &mWeekLabels; |
1113 | } | 1115 | } |
1114 | 1116 | ||
1115 | mStartDate = start; | 1117 | mStartDate = start; |
1116 | 1118 | ||
1117 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 1119 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
1118 | 1120 | ||
1119 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 1121 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
1120 | mStartDate = mStartDate.addDays( -1 ); | 1122 | mStartDate = mStartDate.addDays( -1 ); |
1121 | } | 1123 | } |
1122 | 1124 | ||
1123 | bool primary = false; | 1125 | bool primary = false; |
1124 | uint i; | 1126 | uint i; |
1125 | for( i = 0; i < (*cells).size(); ++i ) { | 1127 | for( i = 0; i < (*cells).size(); ++i ) { |
1126 | QDate date = mStartDate.addDays( i ); | 1128 | QDate date = mStartDate.addDays( i ); |
1127 | (*cells)[i]->setDate( date ); | 1129 | (*cells)[i]->setDate( date ); |
1128 | 1130 | ||
1129 | #ifndef KORG_NOPLUGINS | 1131 | #ifndef KORG_NOPLUGINS |
1130 | // add holiday, if present | 1132 | // add holiday, if present |
1131 | QString hstring(KOCore::self()->holiday(date)); | 1133 | QString hstring(KOCore::self()->holiday(date)); |
1132 | (*cells)[i]->setHoliday( hstring ); | 1134 | (*cells)[i]->setHoliday( hstring ); |
1133 | #endif | 1135 | #endif |
1134 | 1136 | ||
1135 | } | 1137 | } |
1136 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 1138 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
1137 | for( i = 0; i < weekNum; ++i ) { | 1139 | for( i = 0; i < weekNum; ++i ) { |
1138 | int wno; | 1140 | int wno; |
1139 | // remember, according to ISO 8601, the first week of the year is the | 1141 | // remember, according to ISO 8601, the first week of the year is the |
1140 | // first week that contains a thursday. Thus we must subtract off 4, | 1142 | // first week that contains a thursday. Thus we must subtract off 4, |
1141 | // not just 1. | 1143 | // not just 1. |
1142 | int dayOfYear = date.dayOfYear(); | 1144 | int dayOfYear = date.dayOfYear(); |
1143 | if (dayOfYear % 7 != 0) | 1145 | if (dayOfYear % 7 != 0) |
1144 | wno = dayOfYear / 7 + 1; | 1146 | wno = dayOfYear / 7 + 1; |
1145 | else | 1147 | else |
1146 | wno =dayOfYear / 7; | 1148 | wno =dayOfYear / 7; |
1147 | (*weekLabels)[i]->setWeekNum( wno ); | 1149 | (*weekLabels)[i]->setWeekNum( wno ); |
1148 | date = date.addDays( 7 ); | 1150 | date = date.addDays( 7 ); |
1149 | } | 1151 | } |
1150 | updateView(); | 1152 | updateView(); |
1151 | } | 1153 | } |
1152 | 1154 | ||
1153 | void KOMonthView::showEvents(QPtrList<Event>) | 1155 | void KOMonthView::showEvents(QPtrList<Event>) |
1154 | { | 1156 | { |
1155 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 1157 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
1156 | } | 1158 | } |
1157 | 1159 | ||
1158 | void KOMonthView::changeEventDisplay(Event *, int) | 1160 | void KOMonthView::changeEventDisplay(Event *, int) |
1159 | { | 1161 | { |
1160 | // this should be re-written to be much more efficient, but this | 1162 | // this should be re-written to be much more efficient, but this |
1161 | // quick-and-dirty-hack gets the job done for right now. | 1163 | // quick-and-dirty-hack gets the job done for right now. |
1162 | updateView(); | 1164 | updateView(); |
1163 | } | 1165 | } |
1164 | 1166 | ||
1165 | void KOMonthView::updateView() | 1167 | void KOMonthView::updateView() |
1166 | { | 1168 | { |
1167 | 1169 | ||
1168 | if ( !updatePossible ) | 1170 | if ( !updatePossible ) |
1169 | return; | 1171 | return; |
1170 | //QTime ti; | 1172 | //QTime ti; |
1171 | //ti.start(); | 1173 | //ti.start(); |
1172 | QPtrVector<MonthViewCell> *cells; | 1174 | QPtrVector<MonthViewCell> *cells; |
1173 | if ( mShowWeekView ) { | 1175 | if ( mShowWeekView ) { |
1174 | cells = &mCellsW; | 1176 | cells = &mCellsW; |
1175 | } else { | 1177 | } else { |
1176 | cells = &mCells; | 1178 | cells = &mCells; |
1177 | } | 1179 | } |
1178 | #if 1 | 1180 | #if 1 |
1179 | int i; | 1181 | int i; |
1180 | int timeSpan = (*cells).size()-1; | 1182 | int timeSpan = (*cells).size()-1; |
1181 | if ( KOPrefs::instance()->mMonthViewWeek ) | 1183 | if ( KOPrefs::instance()->mMonthViewWeek ) |
1182 | timeSpan = 6; | 1184 | timeSpan = 6; |
1183 | for( i = 0; i < timeSpan + 1; ++i ) { | 1185 | for( i = 0; i < timeSpan + 1; ++i ) { |
1184 | (*cells)[i]->startUpdateCell(); | 1186 | (*cells)[i]->startUpdateCell(); |
1185 | } | 1187 | } |
1186 | 1188 | ||
1187 | QPtrList<Event> events = calendar()->events(); | 1189 | QPtrList<Event> events = calendar()->events(); |
1188 | Event *event; | 1190 | Event *event; |
1189 | QDateTime dt; | 1191 | QDateTime dt; |
1190 | bool ok; | 1192 | bool ok; |
1191 | QDate endDate = mStartDate.addDays( timeSpan ); | 1193 | QDate endDate = mStartDate.addDays( timeSpan ); |
1192 | for( event = events.first(); event; event = events.next() ) { // for event | 1194 | for( event = events.first(); event; event = events.next() ) { // for event |
1193 | if ( event->doesRecur() ) { | 1195 | if ( event->doesRecur() ) { |
1194 | bool last; | 1196 | bool last; |
1195 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 1197 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
1196 | QDateTime incidenceEnd; | 1198 | QDateTime incidenceEnd; |
1197 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 1199 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
1198 | bool invalid = false; | 1200 | bool invalid = false; |
1199 | while( true ) { | 1201 | while( true ) { |
1200 | if ( incidenceStart.isValid() ) { | 1202 | if ( incidenceStart.isValid() ) { |
1201 | incidenceEnd = incidenceStart.addDays( eventlen ); | 1203 | incidenceEnd = incidenceStart.addDays( eventlen ); |
1202 | int st = incidenceStart.date().daysTo( endDate ); | 1204 | int st = incidenceStart.date().daysTo( endDate ); |
1203 | if ( st >= 0 ) { // start before timeend | 1205 | if ( st >= 0 ) { // start before timeend |
1204 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 1206 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
1205 | if ( end >= 0 ) { // end after timestart --- got one! | 1207 | if ( end >= 0 ) { // end after timestart --- got one! |
1206 | //normalize | 1208 | //normalize |
1207 | st = timeSpan - st; | 1209 | st = timeSpan - st; |
1208 | if ( st < 0 ) st = 0; | 1210 | if ( st < 0 ) st = 0; |
1209 | if ( end > timeSpan ) end = timeSpan; | 1211 | if ( end > timeSpan ) end = timeSpan; |
1210 | int iii; | 1212 | int iii; |
1211 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 1213 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
1212 | for ( iii = st;iii<= end;++iii) | 1214 | for ( iii = st;iii<= end;++iii) |
1213 | (*cells)[iii]->insertEvent( event ); | 1215 | (*cells)[iii]->insertEvent( event ); |
1214 | } | 1216 | } |
1215 | } | 1217 | } |
1216 | } else { | 1218 | } else { |
1217 | if ( invalid ) | 1219 | if ( invalid ) |
1218 | break; | 1220 | break; |
1219 | invalid = true; | 1221 | invalid = true; |
1220 | //qDebug("invalid %s", event->summary().latin1()); | 1222 | //qDebug("invalid %s", event->summary().latin1()); |
1221 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; | 1223 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; |
1222 | } | 1224 | } |
1223 | if ( last ) | 1225 | if ( last ) |
1224 | break; | 1226 | break; |
1225 | bool ok; | 1227 | bool ok; |
1226 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); | 1228 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); |
1227 | if ( ! ok ) | 1229 | if ( ! ok ) |
1228 | break; | 1230 | break; |
1229 | if ( incidenceStart.date() > endDate ) | 1231 | if ( incidenceStart.date() > endDate ) |
1230 | break; | 1232 | break; |
1231 | } | 1233 | } |
1232 | } else { // no recur | 1234 | } else { // no recur |
1233 | int st = event->dtStart().date().daysTo( endDate ); | 1235 | int st = event->dtStart().date().daysTo( endDate ); |
1234 | if ( st >= 0 ) { // start before timeend | 1236 | if ( st >= 0 ) { // start before timeend |
1235 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 1237 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
1236 | if ( end >= 0 ) { // end after timestart --- got one! | 1238 | if ( end >= 0 ) { // end after timestart --- got one! |
1237 | //normalize | 1239 | //normalize |
1238 | st = timeSpan - st; | 1240 | st = timeSpan - st; |
1239 | if ( st < 0 ) st = 0; | 1241 | if ( st < 0 ) st = 0; |
1240 | if ( end > timeSpan ) end = timeSpan; | 1242 | if ( end > timeSpan ) end = timeSpan; |
1241 | int iii; | 1243 | int iii; |
1242 | for ( iii = st;iii<= end;++iii) | 1244 | for ( iii = st;iii<= end;++iii) |
1243 | (*cells)[iii]->insertEvent( event ); | 1245 | (*cells)[iii]->insertEvent( event ); |
1244 | } | 1246 | } |
1245 | } | 1247 | } |
1246 | } | 1248 | } |
1247 | } | 1249 | } |
1248 | // insert due todos | 1250 | // insert due todos |
1249 | QPtrList<Todo> todos = calendar()->todos( ); | 1251 | QPtrList<Todo> todos = calendar()->todos( ); |
1250 | Todo *todo; | 1252 | Todo *todo; |
1251 | for(todo = todos.first(); todo; todo = todos.next()) { | 1253 | for(todo = todos.first(); todo; todo = todos.next()) { |
1252 | //insertTodo( todo ); | 1254 | //insertTodo( todo ); |
1253 | if ( todo->hasDueDate() ) { | 1255 | if ( todo->hasDueDate() ) { |
1254 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 1256 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
1255 | if ( day >= 0 && day < timeSpan + 1) { | 1257 | if ( day >= 0 && day < timeSpan + 1) { |
1256 | (*cells)[day]->insertTodo( todo ); | 1258 | (*cells)[day]->insertTodo( todo ); |
1257 | } | 1259 | } |
1258 | } | 1260 | } |
1259 | } | 1261 | } |
1260 | 1262 | ||
1261 | for( i = 0; i < timeSpan+1; ++i ) { | 1263 | for( i = 0; i < timeSpan+1; ++i ) { |
1262 | (*cells)[i]->finishUpdateCell(); | 1264 | (*cells)[i]->finishUpdateCell(); |
1263 | } | 1265 | } |
1264 | processSelectionChange(); | 1266 | processSelectionChange(); |
1265 | (*cells)[0]->setFocus(); | 1267 | (*cells)[0]->setFocus(); |
1266 | 1268 | ||
1267 | 1269 | ||
1268 | #else | 1270 | #else |
1269 | // old code | 1271 | // old code |
1270 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1272 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1271 | int i; | 1273 | int i; |
1272 | for( i = 0; i < (*cells).count(); ++i ) { | 1274 | for( i = 0; i < (*cells).count(); ++i ) { |
1273 | (*cells)[i]->updateCell(); | 1275 | (*cells)[i]->updateCell(); |
1274 | } | 1276 | } |
1275 | 1277 | ||
1276 | //qDebug("KOMonthView::updateView() "); | 1278 | //qDebug("KOMonthView::updateView() "); |
1277 | processSelectionChange(); | 1279 | processSelectionChange(); |
1278 | // qDebug("---------------------------------------------------------------------+ "); | 1280 | // qDebug("---------------------------------------------------------------------+ "); |
1279 | (*cells)[0]->setFocus(); | 1281 | (*cells)[0]->setFocus(); |
1280 | #endif | 1282 | #endif |
1281 | 1283 | ||
1282 | //qDebug("update time %d ", ti.elapsed()); | 1284 | //qDebug("update time %d ", ti.elapsed()); |
1283 | } | 1285 | } |
1284 | 1286 | ||
1285 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1287 | void KOMonthView::resizeEvent(QResizeEvent * e) |
1286 | { | 1288 | { |
1287 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); | 1289 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); |
1288 | computeLayout(); | 1290 | computeLayout(); |
1289 | clPending = true; | 1291 | clPending = true; |
1290 | if ( mShowWeekView ) | 1292 | if ( mShowWeekView ) |
1291 | mCellsW[0]->setFocus(); | 1293 | mCellsW[0]->setFocus(); |
1292 | else | 1294 | else |
1293 | mCells[0]->setFocus(); | 1295 | mCells[0]->setFocus(); |
1294 | } | 1296 | } |
1295 | void KOMonthView::computeLayoutWeek() | 1297 | void KOMonthView::computeLayoutWeek() |
1296 | { | 1298 | { |
1297 | static int lastWid = 0; | 1299 | static int lastWid = 0; |
1298 | static int lastHei = 0; | 1300 | static int lastHei = 0; |
1299 | int daysToShow; | 1301 | int daysToShow; |
1300 | bool combinedSatSun = false; | 1302 | bool combinedSatSun = false; |
1301 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1303 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1302 | daysToShow = 6; | 1304 | daysToShow = 6; |
1303 | combinedSatSun = true; | 1305 | combinedSatSun = true; |
1304 | } | 1306 | } |
1305 | int tWid = topLevelWidget()->size().width(); | 1307 | int tWid = topLevelWidget()->size().width(); |
1306 | int tHei = topLevelWidget()->size().height(); | 1308 | int tHei = topLevelWidget()->size().height(); |
1307 | 1309 | ||
1308 | int wid = width();//e | 1310 | int wid = width();//e |
1309 | int hei = height()-1-mNavigatorBar->height(); | 1311 | int hei = height()-1-mNavigatorBar->height(); |
1310 | 1312 | ||
1311 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 1313 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
1312 | return; | 1314 | return; |
1313 | 1315 | ||
1314 | if ( lastWid == width() && lastHei == height() ) | 1316 | if ( lastWid == width() && lastHei == height() ) |
1315 | return; | 1317 | return; |
1316 | lastWid = width(); | 1318 | lastWid = width(); |
1317 | lastHei = height(); | 1319 | lastHei = height(); |
1318 | 1320 | ||
1319 | 1321 | ||
1320 | if ( wid < hei ) | 1322 | if ( wid < hei ) |
1321 | daysToShow = 2; | 1323 | daysToShow = 2; |
1322 | else | 1324 | else |
1323 | daysToShow = 3; | 1325 | daysToShow = 3; |
1324 | mShowSatSunComp = true; | 1326 | mShowSatSunComp = true; |
1325 | combinedSatSun = true; | 1327 | combinedSatSun = true; |
1326 | 1328 | ||
1327 | //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); | 1329 | //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); |
1328 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1330 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1329 | int weeklabelwid = fm.width( "888" ); | 1331 | int weeklabelwid = fm.width( "888" ); |
1330 | wid -= weeklabelwid; | 1332 | wid -= weeklabelwid; |
1331 | 1333 | ||
1332 | int colWid = wid / daysToShow; | 1334 | int colWid = wid / daysToShow; |
1333 | int lastCol = wid - ( colWid*6 ); | 1335 | int lastCol = wid - ( colWid*6 ); |
1334 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); | 1336 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); |
1335 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); | 1337 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); |
1336 | int colModulo = wid % daysToShow; | 1338 | int colModulo = wid % daysToShow; |
1337 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; | 1339 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; |
1338 | //qDebug("rowmod %d ", rowModulo); | 1340 | //qDebug("rowmod %d ", rowModulo); |
1339 | int i; | 1341 | int i; |
1340 | int x,y,w,h; | 1342 | int x,y,w,h; |
1341 | x= 0; | 1343 | x= 0; |
1342 | y= 0; | 1344 | y= 0; |
1343 | w = colWid; | 1345 | w = colWid; |
1344 | h = dayLabelHei ; | 1346 | h = dayLabelHei ; |
1345 | for ( i = 0; i < 7; i++) { | 1347 | for ( i = 0; i < 7; i++) { |
1346 | if ( i && !( i % daysToShow) && i < 6) { | 1348 | if ( i && !( i % daysToShow) && i < 6) { |
1347 | y += hei/(5-daysToShow); | 1349 | y += hei/(5-daysToShow); |
1348 | x = 0; | 1350 | x = 0; |
1349 | w = colWid; | 1351 | w = colWid; |
1350 | } | 1352 | } |
1351 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1353 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1352 | ++w; | 1354 | ++w; |
1353 | } | 1355 | } |
1354 | if ( i >= 5 ) { | 1356 | if ( i >= 5 ) { |
1355 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); | 1357 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); |
1356 | x -= (w/2 ); | 1358 | x -= (w/2 ); |
1357 | } | 1359 | } |
1358 | else | 1360 | else |
1359 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); | 1361 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); |
1360 | x += w; | 1362 | x += w; |
1361 | } | 1363 | } |
1362 | x= 0; | 1364 | x= 0; |
1363 | y= dayLabelHei; | 1365 | y= dayLabelHei; |
1364 | w = colWid; | 1366 | w = colWid; |
1365 | h = cellHei; | 1367 | h = cellHei; |
1366 | for ( i = 0; i < mCellsW.count(); ++i) { | 1368 | for ( i = 0; i < mCellsW.count(); ++i) { |
1367 | if ( i > 6 ) { | 1369 | if ( i > 6 ) { |
1368 | mCellsW[i]->hide(); | 1370 | mCellsW[i]->hide(); |
1369 | continue; | 1371 | continue; |
1370 | } | 1372 | } |
1371 | 1373 | ||
1372 | w = colWid; | 1374 | w = colWid; |
1373 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1375 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1374 | ++w; | 1376 | ++w; |
1375 | } | 1377 | } |
1376 | if ( i == (daysToShow-1-rowModulo)*7) | 1378 | if ( i == (daysToShow-1-rowModulo)*7) |
1377 | ++h; | 1379 | ++h; |
1378 | 1380 | ||
1379 | if ( i >= 5 ) { | 1381 | if ( i >= 5 ) { |
1380 | if ( i ==5 ) { | 1382 | if ( i ==5 ) { |
1381 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1383 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1382 | x -= w ;y += h/2; | 1384 | x -= w ;y += h/2; |
1383 | } else { | 1385 | } else { |
1384 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { | 1386 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { |
1385 | ++w; | 1387 | ++w; |
1386 | } | 1388 | } |
1387 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1389 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1388 | y -= h/2; | 1390 | y -= h/2; |
1389 | } | 1391 | } |
1390 | } else | 1392 | } else |
1391 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1393 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1392 | 1394 | ||
1393 | 1395 | ||
1394 | x += w; | 1396 | x += w; |
1395 | if ( x + w/2 > wid ) { | 1397 | if ( x + w/2 > wid ) { |
1396 | x = 0; | 1398 | x = 0; |
1397 | y += h+dayLabelHei ; | 1399 | y += h+dayLabelHei ; |
1398 | } | 1400 | } |
1399 | } | 1401 | } |
1400 | y= dayLabelHei; | 1402 | y= dayLabelHei; |
1401 | h = cellHei ; | 1403 | h = cellHei ; |
1402 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); | 1404 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); |
1403 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1405 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1404 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1406 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1405 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1407 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1406 | mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ; | 1408 | mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ; |
1407 | updateDayLabels(); | 1409 | updateDayLabels(); |
1408 | //bool forceUpdate = !updatePossible; | 1410 | //bool forceUpdate = !updatePossible; |
1409 | updatePossible = true; | 1411 | updatePossible = true; |
1410 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); | 1412 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); |
1411 | //if ( forceUpdate ) | 1413 | //if ( forceUpdate ) |
1412 | // updateView(); | 1414 | // updateView(); |
1413 | } | 1415 | } |
1414 | void KOMonthView::computeLayout() | 1416 | void KOMonthView::computeLayout() |
1415 | { | 1417 | { |
1416 | 1418 | ||
1417 | 1419 | ||
1418 | static int lastWid = 0; | 1420 | static int lastWid = 0; |
1419 | static int lastHei = 0; | 1421 | static int lastHei = 0; |
1420 | 1422 | ||
1421 | if ( mShowWeekView ){ | 1423 | if ( mShowWeekView ){ |
1422 | computeLayoutWeek(); | 1424 | computeLayoutWeek(); |
1423 | return; | 1425 | return; |
1424 | } | 1426 | } |
1425 | int daysToShow = 7; | 1427 | int daysToShow = 7; |
1426 | bool combinedSatSun = false; | 1428 | bool combinedSatSun = false; |
1427 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1429 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1428 | daysToShow = 6; | 1430 | daysToShow = 6; |
1429 | combinedSatSun = true; | 1431 | combinedSatSun = true; |
1430 | } | 1432 | } |
1431 | int tWid = topLevelWidget()->size().width(); | 1433 | int tWid = topLevelWidget()->size().width(); |
1432 | int tHei = topLevelWidget()->size().height(); | 1434 | int tHei = topLevelWidget()->size().height(); |
1433 | 1435 | ||
1434 | int wid = width();//e | 1436 | int wid = width();//e |
1435 | int hei = height()-1-mNavigatorBar->height(); | 1437 | int hei = height()-1-mNavigatorBar->height(); |
1436 | 1438 | ||
1437 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { | 1439 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { |
1438 | return; | 1440 | return; |
1439 | } | 1441 | } |
1440 | if ( lastWid == width() && lastHei == height() ){ | 1442 | if ( lastWid == width() && lastHei == height() ){ |
1441 | return; | 1443 | return; |
1442 | } | 1444 | } |
1443 | 1445 | ||
1444 | lastWid = width(); | 1446 | lastWid = width(); |
1445 | lastHei = height(); | 1447 | lastHei = height(); |
1446 | //qDebug("KOMonthView::computeLayout() MMM ------------------------------------ "); | 1448 | //qDebug("KOMonthView::computeLayout() MMM ------------------------------------ "); |
1447 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1449 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1448 | int weeklabelwid = fm.width( "888" ); | 1450 | int weeklabelwid = fm.width( "888" ); |
1449 | wid -= weeklabelwid; | 1451 | wid -= weeklabelwid; |
1450 | 1452 | ||
1451 | int colWid = wid / daysToShow; | 1453 | int colWid = wid / daysToShow; |
1452 | int lastCol = wid - ( colWid*6 ); | 1454 | int lastCol = wid - ( colWid*6 ); |
1453 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 1455 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
1454 | int cellHei = (hei - dayLabelHei) /6; | 1456 | int cellHei = (hei - dayLabelHei) /6; |
1455 | int colModulo = wid % daysToShow; | 1457 | int colModulo = wid % daysToShow; |
1456 | int rowModulo = (hei- dayLabelHei) % 6; | 1458 | int rowModulo = (hei- dayLabelHei) % 6; |
1457 | //qDebug("rowmod %d ", rowModulo); | 1459 | //qDebug("rowmod %d ", rowModulo); |
1458 | int i; | 1460 | int i; |
1459 | int x,y,w,h; | 1461 | int x,y,w,h; |
1460 | x= 0; | 1462 | x= 0; |
1461 | y= 0; | 1463 | y= 0; |
1462 | w = colWid; | 1464 | w = colWid; |
1463 | h = dayLabelHei ; | 1465 | h = dayLabelHei ; |
1464 | for ( i = 0; i < 7; i++) { | 1466 | for ( i = 0; i < 7; i++) { |
1465 | if ( i == daysToShow-colModulo ) | 1467 | if ( i == daysToShow-colModulo ) |
1466 | ++w; | 1468 | ++w; |
1467 | if ( combinedSatSun ) { | 1469 | if ( combinedSatSun ) { |
1468 | if ( i >= daysToShow-1 ) { | 1470 | if ( i >= daysToShow-1 ) { |
1469 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); | 1471 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); |
1470 | x -= w/2 ; | 1472 | x -= w/2 ; |
1471 | } | 1473 | } |
1472 | else | 1474 | else |
1473 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1475 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1474 | } else | 1476 | } else |
1475 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1477 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1476 | x += w; | 1478 | x += w; |
1477 | } | 1479 | } |
1478 | x= 0; | 1480 | x= 0; |
1479 | y= dayLabelHei; | 1481 | y= dayLabelHei; |
1480 | w = colWid; | 1482 | w = colWid; |
1481 | h = cellHei ; | 1483 | h = cellHei ; |
1482 | for ( i = 0; i < mCells.count(); ++i) { | 1484 | for ( i = 0; i < mCells.count(); ++i) { |
1483 | //qDebug("iii %d ", i); | 1485 | //qDebug("iii %d ", i); |
1484 | w = colWid; | 1486 | w = colWid; |
1485 | if ( ((i) % 7) >= 7-colModulo ) { | 1487 | if ( ((i) % 7) >= 7-colModulo ) { |
1486 | ++w; | 1488 | ++w; |
1487 | } | 1489 | } |
1488 | if ( i == (6-rowModulo)*7) | 1490 | if ( i == (6-rowModulo)*7) |
1489 | ++h; | 1491 | ++h; |
1490 | if ( combinedSatSun ) { | 1492 | if ( combinedSatSun ) { |
1491 | if ( (i)%7 >= daysToShow-1 ) { | 1493 | if ( (i)%7 >= daysToShow-1 ) { |
1492 | if ( (i)%7 == daysToShow-1 ) { | 1494 | if ( (i)%7 == daysToShow-1 ) { |
1493 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1495 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1494 | x -= w ;y += h/2; | 1496 | x -= w ;y += h/2; |
1495 | } else { | 1497 | } else { |
1496 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1498 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1497 | y -= h/2; | 1499 | y -= h/2; |
1498 | } | 1500 | } |
1499 | } else | 1501 | } else |
1500 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1502 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1501 | 1503 | ||
1502 | } | 1504 | } |
1503 | else | 1505 | else |
1504 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1506 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1505 | x += w; | 1507 | x += w; |
1506 | if ( x + w/2 > wid ) { | 1508 | if ( x + w/2 > wid ) { |
1507 | x = 0; | 1509 | x = 0; |
1508 | y += h; | 1510 | y += h; |
1509 | } | 1511 | } |
1510 | } | 1512 | } |
1511 | y= dayLabelHei; | 1513 | y= dayLabelHei; |
1512 | h = cellHei ; | 1514 | h = cellHei ; |
1513 | for ( i = 0; i < 6; i++) { | 1515 | for ( i = 0; i < 6; i++) { |
1514 | if ( i == (6-rowModulo)) | 1516 | if ( i == (6-rowModulo)) |
1515 | ++h; | 1517 | ++h; |
1516 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1518 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1517 | y += h; | 1519 | y += h; |
1518 | } | 1520 | } |
1519 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1521 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1520 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1522 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1521 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1523 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1522 | mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; | 1524 | mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; |
1523 | updateDayLabels(); | 1525 | updateDayLabels(); |
1524 | //bool forceUpdate = !updatePossible; | 1526 | //bool forceUpdate = !updatePossible; |
1525 | updatePossible = true; | 1527 | updatePossible = true; |
1526 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1528 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1527 | } | 1529 | } |
1528 | 1530 | ||
1529 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1531 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1530 | { | 1532 | { |
1531 | mContextMenu->showIncidencePopup(incidence); | 1533 | mContextMenu->showIncidencePopup(incidence); |
1532 | /* | 1534 | /* |
1533 | if( incidence && incidence->type() == "Event" ) { | 1535 | if( incidence && incidence->type() == "Event" ) { |
1534 | Event *event = static_cast<Event *>(incidence); | 1536 | Event *event = static_cast<Event *>(incidence); |
1535 | mContextMenu->showEventPopup(event); | 1537 | mContextMenu->showEventPopup(event); |
1536 | } else { | 1538 | } else { |
1537 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 1539 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
1538 | } | 1540 | } |
1539 | */ | 1541 | */ |
1540 | } | 1542 | } |
1541 | MonthViewCell * KOMonthView::selectedCell( ) | 1543 | MonthViewCell * KOMonthView::selectedCell( ) |
1542 | { | 1544 | { |
1543 | return mSelectedCell; | 1545 | return mSelectedCell; |
1544 | } | 1546 | } |
1545 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1547 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1546 | { | 1548 | { |
1547 | // qDebug("KOMonthView::setSelectedCell "); | 1549 | // qDebug("KOMonthView::setSelectedCell "); |
1548 | if ( mSelectedCell && mSelectedCell != cell ) { | 1550 | if ( mSelectedCell && mSelectedCell != cell ) { |
1549 | MonthViewCell * mvc = mSelectedCell; | 1551 | MonthViewCell * mvc = mSelectedCell; |
1550 | mSelectedCell = cell; | 1552 | mSelectedCell = cell; |
1551 | mvc->deselect(); | 1553 | mvc->deselect(); |
1552 | } else | 1554 | } else |
1553 | mSelectedCell = cell; | 1555 | mSelectedCell = cell; |
1554 | // if ( mSelectedCell ) | 1556 | // if ( mSelectedCell ) |
1555 | // mSelectedCell->select(); | 1557 | // mSelectedCell->select(); |
1556 | if ( !mSelectedCell ) | 1558 | if ( !mSelectedCell ) |
1557 | emit incidenceSelected( 0 ); | 1559 | emit incidenceSelected( 0 ); |
1558 | else | 1560 | else |
1559 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1561 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1560 | } | 1562 | } |
1561 | 1563 | ||
1562 | void KOMonthView::processSelectionChange() | 1564 | void KOMonthView::processSelectionChange() |
1563 | { | 1565 | { |
1564 | QPtrList<Incidence> incidences = selectedIncidences(); | 1566 | QPtrList<Incidence> incidences = selectedIncidences(); |
1565 | if (incidences.count() > 0) { | 1567 | if (incidences.count() > 0) { |
1566 | emit incidenceSelected( incidences.first() ); | 1568 | emit incidenceSelected( incidences.first() ); |
1567 | } else { | 1569 | } else { |
1568 | emit incidenceSelected( 0 ); | 1570 | emit incidenceSelected( 0 ); |
1569 | } | 1571 | } |
1570 | } | 1572 | } |
1571 | 1573 | ||
1572 | void KOMonthView::clearSelection() | 1574 | void KOMonthView::clearSelection() |
1573 | { | 1575 | { |
1574 | if ( mSelectedCell ) { | 1576 | if ( mSelectedCell ) { |
1575 | mSelectedCell->deselect(); | 1577 | mSelectedCell->deselect(); |
1576 | mSelectedCell = 0; | 1578 | mSelectedCell = 0; |
1577 | } | 1579 | } |
1578 | } | 1580 | } |
1579 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 1581 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
1580 | { | 1582 | { |
1581 | //qDebug("KOMonthView::keyPressEvent "); | 1583 | //qDebug("KOMonthView::keyPressEvent "); |
1582 | switch(e->key()) { | 1584 | switch(e->key()) { |
1583 | case Key_Up: | 1585 | case Key_Up: |
1584 | { | 1586 | { |
1585 | emit prevMonth(); | 1587 | emit prevMonth(); |
1586 | if ( mShowWeekView ) | 1588 | if ( mShowWeekView ) |
1587 | mCellsW[0]->setFocus(); | 1589 | mCellsW[0]->setFocus(); |
1588 | else | 1590 | else |
1589 | mCells[0]->setFocus(); | 1591 | mCells[0]->setFocus(); |
1590 | } | 1592 | } |
1591 | e->accept(); | 1593 | e->accept(); |
1592 | break; | 1594 | break; |
1593 | case Key_Down: | 1595 | case Key_Down: |
1594 | { | 1596 | { |
1595 | emit nextMonth(); | 1597 | emit nextMonth(); |
1596 | if ( mShowWeekView ) | 1598 | if ( mShowWeekView ) |
1597 | mCellsW[0]->setFocus(); | 1599 | mCellsW[0]->setFocus(); |
1598 | else | 1600 | else |
1599 | mCells[0]->setFocus(); | 1601 | mCells[0]->setFocus(); |
1600 | 1602 | ||
1601 | } | 1603 | } |
1602 | e->accept(); | 1604 | e->accept(); |
1603 | break; | 1605 | break; |
1604 | case Key_Return: | 1606 | case Key_Return: |
1605 | case Key_Enter: | 1607 | case Key_Enter: |
1606 | { | 1608 | { |
1607 | selectInternalWeekNum ( currentWeek() ); | 1609 | selectInternalWeekNum ( currentWeek() ); |
1608 | } | 1610 | } |
1609 | e->accept(); | 1611 | e->accept(); |
1610 | break; | 1612 | break; |
1611 | default: | 1613 | default: |
1612 | e->ignore(); | 1614 | e->ignore(); |
1613 | break; | 1615 | break; |
1614 | } | 1616 | } |
1615 | } | 1617 | } |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 5efc247..a91074f 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -1,485 +1,491 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 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 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <time.h> | 24 | #include <time.h> |
25 | #ifndef _WIN32_ | 25 | #ifndef _WIN32_ |
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | #endif | 27 | #endif |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qtextstream.h> | 29 | #include <qtextstream.h> |
30 | #include <qtextcodec.h> | 30 | #include <qtextcodec.h> |
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qregexp.h> | 32 | #include <qregexp.h> |
33 | #include <qfont.h> | 33 | #include <qfont.h> |
34 | #include <qcolor.h> | 34 | #include <qcolor.h> |
35 | #include <qstringlist.h> | 35 | #include <qstringlist.h> |
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | 37 | ||
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kglobalsettings.h> | 39 | #include <kglobalsettings.h> |
40 | #include <kconfig.h> | 40 | #include <kconfig.h> |
41 | #include <klocale.h> | 41 | #include <klocale.h> |
42 | #include <kdebug.h> | 42 | #include <kdebug.h> |
43 | #include <kemailsettings.h> | 43 | #include <kemailsettings.h> |
44 | #include <kstaticdeleter.h> | 44 | #include <kstaticdeleter.h> |
45 | #include <libkdepim/kpimglobalprefs.h> | 45 | #include <libkdepim/kpimglobalprefs.h> |
46 | 46 | ||
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | #include "mainwindow.h" | 48 | #include "mainwindow.h" |
49 | 49 | ||
50 | KOPrefs *KOPrefs::mInstance = 0; | 50 | KOPrefs *KOPrefs::mInstance = 0; |
51 | static KStaticDeleter<KOPrefs> insd; | 51 | static KStaticDeleter<KOPrefs> insd; |
52 | 52 | ||
53 | KOPrefs::KOPrefs() : | 53 | KOPrefs::KOPrefs() : |
54 | KPimPrefs("korganizerrc") | 54 | KPimPrefs("korganizerrc") |
55 | { | 55 | { |
56 | mCategoryColors.setAutoDelete(true); | 56 | mCategoryColors.setAutoDelete(true); |
57 | fillMailDefaults(); | 57 | fillMailDefaults(); |
58 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); | 58 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); |
59 | QColor defaultHolidayColor = QColor(255,0,0); | 59 | QColor defaultHolidayColor = QColor(255,0,0); |
60 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); | 60 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); |
61 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); | 61 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); |
62 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); | 62 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); |
63 | QColor defaultTodoDueTodayColor = QColor(255,220,100); | 63 | QColor defaultTodoDueTodayColor = QColor(255,220,100); |
64 | QColor defaultTodoOverdueColor = QColor(255,153,125); | 64 | QColor defaultTodoOverdueColor = QColor(255,153,125); |
65 | 65 | ||
66 | 66 | ||
67 | KPrefs::setCurrentGroup("General"); | 67 | KPrefs::setCurrentGroup("General"); |
68 | 68 | ||
69 | 69 | ||
70 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 70 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
71 | 71 | ||
72 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); | 72 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); |
73 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); | 73 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); |
74 | addItemBool("ShowIconSearch",&mShowIconSearch,true); | 74 | addItemBool("ShowIconSearch",&mShowIconSearch,true); |
75 | addItemBool("ShowIconList",&mShowIconList,true); | 75 | addItemBool("ShowIconList",&mShowIconList,true); |
76 | addItemBool("ShowIconDay1",&mShowIconDay1,true); | 76 | addItemBool("ShowIconDay1",&mShowIconDay1,true); |
77 | addItemBool("ShowIconDay5",&mShowIconDay5,true); | 77 | addItemBool("ShowIconDay5",&mShowIconDay5,true); |
78 | addItemBool("ShowIconDay6",&mShowIconDay6,true); | 78 | addItemBool("ShowIconDay6",&mShowIconDay6,true); |
79 | addItemBool("ShowIconDay7",&mShowIconDay7,true); | 79 | addItemBool("ShowIconDay7",&mShowIconDay7,true); |
80 | addItemBool("ShowIconMonth",&mShowIconMonth,true); | 80 | addItemBool("ShowIconMonth",&mShowIconMonth,true); |
81 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); | 81 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); |
82 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); | 82 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); |
83 | addItemBool("ShowIconBack",&mShowIconBack,true); | 83 | addItemBool("ShowIconBack",&mShowIconBack,true); |
84 | addItemBool("ShowIconToday",&mShowIconToday,true); | 84 | addItemBool("ShowIconToday",&mShowIconToday,true); |
85 | addItemBool("ShowIconForward",&mShowIconForward,true); | 85 | addItemBool("ShowIconForward",&mShowIconForward,true); |
86 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); | 86 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); |
87 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); | 87 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); |
88 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); | 88 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); |
89 | addItemBool("ShowIconNext",&mShowIconNext,true); | 89 | addItemBool("ShowIconNext",&mShowIconNext,true); |
90 | addItemBool("ShowIconJournal",&mShowIconJournal,true); | 90 | addItemBool("ShowIconJournal",&mShowIconJournal,true); |
91 | addItemBool("ShowIconStretch",&mShowIconStretch,true); | 91 | addItemBool("ShowIconStretch",&mShowIconStretch,true); |
92 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); | 92 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); |
93 | 93 | ||
94 | addItemBool("AskForQuit",&mAskForQuit,false); | 94 | addItemBool("AskForQuit",&mAskForQuit,false); |
95 | 95 | ||
96 | #ifndef DESKTOP_VERSION | 96 | #ifndef DESKTOP_VERSION |
97 | addItemBool("ShowFullMenu",&mShowFullMenu,false); | 97 | addItemBool("ShowFullMenu",&mShowFullMenu,false); |
98 | #else | 98 | #else |
99 | addItemBool("ShowFullMenu",&mShowFullMenu,true); | 99 | addItemBool("ShowFullMenu",&mShowFullMenu,true); |
100 | #endif | 100 | #endif |
101 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 101 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
102 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 102 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
103 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); | 103 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); |
104 | addItemInt("Whats Next Days",&mWhatsNextDays,3); | 104 | addItemInt("Whats Next Days",&mWhatsNextDays,3); |
105 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); | 105 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); |
106 | 106 | ||
107 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); | 107 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); |
108 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); | 108 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); |
109 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); | 109 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); |
110 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); | 110 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); |
111 | addItemInt("AllDay Size",&mAllDaySize,28); | 111 | addItemInt("AllDay Size",&mAllDaySize,28); |
112 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; | 112 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; |
113 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); | 113 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); |
114 | 114 | ||
115 | addItemStringList("LocationDefaults",&mLocationDefaults ); | 115 | addItemStringList("LocationDefaults",&mLocationDefaults ); |
116 | addItemStringList("EventSummary User",&mEventSummaryUser); | 116 | addItemStringList("EventSummary User",&mEventSummaryUser); |
117 | addItemStringList("TodoSummary User",&mTodoSummaryUser); | 117 | addItemStringList("TodoSummary User",&mTodoSummaryUser); |
118 | 118 | ||
119 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 119 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
120 | addItemBool("Enable Project View",&mEnableProjectView,false); | 120 | addItemBool("Enable Project View",&mEnableProjectView,false); |
121 | addItemBool("Auto Save",&mAutoSave,false); | 121 | addItemBool("Auto Save",&mAutoSave,false); |
122 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); | 122 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); |
123 | addItemBool("Confirm Deletes",&mConfirm,true); | 123 | addItemBool("Confirm Deletes",&mConfirm,true); |
124 | addItemString("Archive File",&mArchiveFile); | 124 | addItemString("Archive File",&mArchiveFile); |
125 | addItemString("Html Export File",&mHtmlExportFile, | 125 | addItemString("Html Export File",&mHtmlExportFile, |
126 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); | 126 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); |
127 | addItemBool("Html With Save",&mHtmlWithSave,false); | 127 | addItemBool("Html With Save",&mHtmlWithSave,false); |
128 | 128 | ||
129 | KPrefs::setCurrentGroup("Personal Settings"); | 129 | KPrefs::setCurrentGroup("Personal Settings"); |
130 | 130 | ||
131 | addItemInt("Mail Client",&mMailClient,MailClientKMail); | 131 | addItemInt("Mail Client",&mMailClient,MailClientKMail); |
132 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); | 132 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); |
133 | addItemBool("Bcc",&mBcc,false); | 133 | addItemBool("Bcc",&mBcc,false); |
134 | 134 | ||
135 | KPrefs::setCurrentGroup("Time & Date"); | 135 | KPrefs::setCurrentGroup("Time & Date"); |
136 | 136 | ||
137 | 137 | ||
138 | addItemInt("Default Start Time",&mStartTime,10); | 138 | addItemInt("Default Start Time",&mStartTime,10); |
139 | addItemInt("Default Duration",&mDefaultDuration,2); | 139 | addItemInt("Default Duration",&mDefaultDuration,2); |
140 | addItemInt("Default Alarm Time",&mAlarmTime,3); | 140 | addItemInt("Default Alarm Time",&mAlarmTime,3); |
141 | KPrefs::setCurrentGroup("AlarmSettings"); | 141 | KPrefs::setCurrentGroup("AlarmSettings"); |
142 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); | 142 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); |
143 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); | 143 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); |
144 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); | 144 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); |
145 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); | 145 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); |
146 | 146 | ||
147 | 147 | ||
148 | KPrefs::setCurrentGroup("Calendar"); | 148 | KPrefs::setCurrentGroup("Calendar"); |
149 | 149 | ||
150 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); | 150 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); |
151 | 151 | ||
152 | KPrefs::setCurrentGroup("Fonts"); | 152 | KPrefs::setCurrentGroup("Fonts"); |
153 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); | 153 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); |
154 | addItemFont("TimeBar Font",&mTimeBarFont,KGlobalSettings::generalFont() ); | 154 | addItemFont("TimeBar Font",&mTimeBarFont,KGlobalSettings::generalFont() ); |
155 | addItemFont("MonthView Font",&mMonthViewFont,KGlobalSettings::generalFont()); | 155 | addItemFont("MonthView Font",&mMonthViewFont,KGlobalSettings::generalFont()); |
156 | addItemFont("AgendaView Font",&mAgendaViewFont,KGlobalSettings::generalFont()); | 156 | addItemFont("AgendaView Font",&mAgendaViewFont,KGlobalSettings::generalFont()); |
157 | addItemFont("MarcusBains Font",&mMarcusBainsFont,KGlobalSettings::generalFont()); | 157 | addItemFont("MarcusBains Font",&mMarcusBainsFont,KGlobalSettings::generalFont()); |
158 | addItemFont("TimeLabels Font",&mTimeLabelsFont,KGlobalSettings::generalFont()); | 158 | addItemFont("TimeLabels Font",&mTimeLabelsFont,KGlobalSettings::generalFont()); |
159 | addItemFont("TodoView Font",&mTodoViewFont,KGlobalSettings::generalFont()); | 159 | addItemFont("TodoView Font",&mTodoViewFont,KGlobalSettings::generalFont()); |
160 | addItemFont("ListView Font",&mListViewFont,KGlobalSettings::generalFont()); | 160 | addItemFont("ListView Font",&mListViewFont,KGlobalSettings::generalFont()); |
161 | addItemFont("DateNavigator Font",&mDateNavigatorFont,KGlobalSettings::generalFont()); | 161 | addItemFont("DateNavigator Font",&mDateNavigatorFont,KGlobalSettings::generalFont()); |
162 | addItemFont("EditBox Font",&mEditBoxFont,KGlobalSettings::generalFont()); | 162 | addItemFont("EditBox Font",&mEditBoxFont,KGlobalSettings::generalFont()); |
163 | addItemFont("JournalView Font",&mJornalViewFont,KGlobalSettings::generalFont()); | 163 | addItemFont("JournalView Font",&mJornalViewFont,KGlobalSettings::generalFont()); |
164 | addItemFont("WhatsNextView Font",&mWhatsNextFont,KGlobalSettings::generalFont()); | 164 | addItemFont("WhatsNextView Font",&mWhatsNextFont,KGlobalSettings::generalFont()); |
165 | addItemFont("EventView Font",&mEventViewFont,KGlobalSettings::generalFont()); | 165 | addItemFont("EventView Font",&mEventViewFont,KGlobalSettings::generalFont()); |
166 | 166 | ||
167 | KPrefs::setCurrentGroup("RemoteSyncing"); | 167 | KPrefs::setCurrentGroup("RemoteSyncing"); |
168 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); | 168 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); |
169 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); | 169 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); |
170 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 170 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
171 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 171 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
172 | 172 | ||
173 | #ifdef _WIN32_ | 173 | #ifdef _WIN32_ |
174 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 174 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
175 | #else | 175 | #else |
176 | QString hdp= locateLocal("data","korganizer")+"/"; | 176 | QString hdp= locateLocal("data","korganizer")+"/"; |
177 | #endif | 177 | #endif |
178 | 178 | ||
179 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | 179 | KPrefs::setCurrentGroup("LoadSaveFileNames"); |
180 | 180 | ||
181 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | 181 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); |
182 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | 182 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); |
183 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | 183 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); |
184 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 184 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
185 | 185 | ||
186 | 186 | ||
187 | KPrefs::setCurrentGroup("Locale"); | 187 | KPrefs::setCurrentGroup("Locale"); |
188 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 188 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
189 | 189 | ||
190 | 190 | ||
191 | KPrefs::setCurrentGroup("Colors"); | 191 | KPrefs::setCurrentGroup("Colors"); |
192 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | 192 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); |
193 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | 193 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); |
194 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | 194 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); |
195 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); | 195 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); |
196 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | 196 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); |
197 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | 197 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); |
198 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | 198 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); |
199 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | 199 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); |
200 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | 200 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); |
201 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | 201 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); |
202 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | 202 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); |
203 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | 203 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); |
204 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | 204 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); |
205 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); | 205 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); |
206 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | 206 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); |
207 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | 207 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); |
208 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | 208 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); |
209 | addItemBool("UseAppColors",&mUseAppColors,false); | 209 | addItemBool("UseAppColors",&mUseAppColors,false); |
210 | 210 | ||
211 | 211 | ||
212 | 212 | ||
213 | KPrefs::setCurrentGroup("Views"); | 213 | KPrefs::setCurrentGroup("Views"); |
214 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); | 214 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); |
215 | addItemInt("Hour Size",&mHourSize,8); | 215 | addItemInt("Hour Size",&mHourSize,8); |
216 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | 216 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); |
217 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | 217 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); |
218 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | 218 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); |
219 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | 219 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); |
220 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); | 220 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); |
221 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); | 221 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); |
222 | #ifdef DESKTOP_VERION | 222 | #ifdef DESKTOP_VERION |
223 | addItemBool("Enable ToolTips",&mEnableToolTips,true); | 223 | addItemBool("Enable ToolTips",&mEnableToolTips,true); |
224 | #else | 224 | #else |
225 | addItemBool("Enable ToolTips",&mEnableToolTips,false); | 225 | addItemBool("Enable ToolTips",&mEnableToolTips,false); |
226 | #endif | 226 | #endif |
227 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); | 227 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); |
228 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); | 228 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); |
229 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); | 229 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); |
230 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); | 230 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); |
231 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); | 231 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); |
232 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); | 232 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); |
233 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); | 233 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); |
234 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | 234 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); |
235 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | 235 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); |
236 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; | 236 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; |
237 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); | 237 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); |
238 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | 238 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); |
239 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | 239 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); |
240 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | 240 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); |
241 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | 241 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); |
242 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); | 242 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); |
243 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); | 243 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); |
244 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); | 244 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); |
245 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | 245 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); |
246 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | 246 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); |
247 | #ifdef DESKTOP_VERSION | 247 | #ifdef DESKTOP_VERSION |
248 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | 248 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); |
249 | #else | 249 | #else |
250 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | 250 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); |
251 | #endif | 251 | #endif |
252 | addItemInt("Day Begins",&mDayBegins,7); | 252 | addItemInt("Day Begins",&mDayBegins,7); |
253 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | 253 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); |
254 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | 254 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); |
255 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | 255 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); |
256 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | 256 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); |
257 | 257 | ||
258 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | 258 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); |
259 | addItemBool("Full View Month",&mFullViewMonth,true); | 259 | addItemBool("Full View Month",&mFullViewMonth,true); |
260 | addItemBool("Full View Todo",&mFullViewTodo,true); | 260 | addItemBool("Full View Todo",&mFullViewTodo,true); |
261 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | 261 | addItemBool("Quick Todo",&mEnableQuickTodo,false); |
262 | 262 | ||
263 | addItemInt("Next X Days",&mNextXDays,3); | 263 | addItemInt("Next X Days",&mNextXDays,3); |
264 | 264 | ||
265 | KPrefs::setCurrentGroup("Printer"); | 265 | KPrefs::setCurrentGroup("Printer"); |
266 | 266 | ||
267 | KPrefs::setCurrentGroup("Layout"); | 267 | KPrefs::setCurrentGroup("Layout"); |
268 | 268 | ||
269 | addItemBool("CompactDialogs",&mCompactDialogs,false); | 269 | addItemBool("CompactDialogs",&mCompactDialogs,false); |
270 | addItemBool("VerticalScreen",&mVerticalScreen,true); | 270 | addItemBool("VerticalScreen",&mVerticalScreen,true); |
271 | 271 | ||
272 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | 272 | KPrefs::setCurrentGroup("KOrganizer Plugins"); |
273 | 273 | ||
274 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | 274 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); |
275 | 275 | ||
276 | KPrefs::setCurrentGroup("Group Scheduling"); | 276 | KPrefs::setCurrentGroup("Group Scheduling"); |
277 | 277 | ||
278 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | 278 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); |
279 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | 279 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); |
280 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | 280 | addItemStringList("AdditionalMails",&mAdditionalMails,""); |
281 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | 281 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); |
282 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | 282 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); |
283 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | 283 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); |
284 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | 284 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); |
285 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | 285 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); |
286 | 286 | ||
287 | KPrefs::setCurrentGroup( "Editors" ); | 287 | KPrefs::setCurrentGroup( "Editors" ); |
288 | 288 | ||
289 | addItemStringList( "EventTemplates", &mEventTemplates ); | 289 | addItemStringList( "EventTemplates", &mEventTemplates ); |
290 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | 290 | addItemStringList( "TodoTemplates", &mTodoTemplates ); |
291 | 291 | ||
292 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | 292 | addItemInt("DestinationPolicy",&mDestination,standardDestination); |
293 | 293 | ||
294 | 294 | KPrefs::setCurrentGroup( "ViewOptions" ); | |
295 | addItemBool("EVshowDetails",&mEVshowDetails,true); | ||
296 | addItemBool("EVshowCreated",&mEVshowCreated,true); | ||
297 | addItemBool("EVshowChanged",&mEVshowChanged,true); | ||
298 | addItemBool("WTshowDetails",&mWTshowDetails,false); | ||
299 | addItemBool("WTshowCreated",&mWTshowCreated,false); | ||
300 | addItemBool("WTshowChanged",&mWTshowChanged,false); | ||
295 | 301 | ||
296 | } | 302 | } |
297 | 303 | ||
298 | 304 | ||
299 | KOPrefs::~KOPrefs() | 305 | KOPrefs::~KOPrefs() |
300 | { | 306 | { |
301 | if (mInstance == this) | 307 | if (mInstance == this) |
302 | mInstance = insd.setObject(0); | 308 | mInstance = insd.setObject(0); |
303 | 309 | ||
304 | //qDebug("KOPrefs::~KOPrefs() "); | 310 | //qDebug("KOPrefs::~KOPrefs() "); |
305 | } | 311 | } |
306 | 312 | ||
307 | 313 | ||
308 | KOPrefs *KOPrefs::instance() | 314 | KOPrefs *KOPrefs::instance() |
309 | { | 315 | { |
310 | if (!mInstance) { | 316 | if (!mInstance) { |
311 | mInstance = insd.setObject(new KOPrefs()); | 317 | mInstance = insd.setObject(new KOPrefs()); |
312 | mInstance->readConfig(); | 318 | mInstance->readConfig(); |
313 | } | 319 | } |
314 | 320 | ||
315 | return mInstance; | 321 | return mInstance; |
316 | } | 322 | } |
317 | 323 | ||
318 | void KOPrefs::usrSetDefaults() | 324 | void KOPrefs::usrSetDefaults() |
319 | { | 325 | { |
320 | 326 | ||
321 | } | 327 | } |
322 | 328 | ||
323 | void KOPrefs::fillMailDefaults() | 329 | void KOPrefs::fillMailDefaults() |
324 | { | 330 | { |
325 | if (mName.isEmpty()) mName = i18n("Anonymous"); | 331 | if (mName.isEmpty()) mName = i18n("Anonymous"); |
326 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 332 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
327 | } | 333 | } |
328 | 334 | ||
329 | void KOPrefs::setTimeZoneIdDefault() | 335 | void KOPrefs::setTimeZoneIdDefault() |
330 | { | 336 | { |
331 | ; | 337 | ; |
332 | } | 338 | } |
333 | 339 | ||
334 | void KOPrefs::setAllDefaults() | 340 | void KOPrefs::setAllDefaults() |
335 | { | 341 | { |
336 | setCategoryDefaults(); | 342 | setCategoryDefaults(); |
337 | mEventSummaryUser = getDefaultList() ; | 343 | mEventSummaryUser = getDefaultList() ; |
338 | mTodoSummaryUser = getDefaultList() ; | 344 | mTodoSummaryUser = getDefaultList() ; |
339 | mLocationDefaults = getLocationDefaultList(); | 345 | mLocationDefaults = getLocationDefaultList(); |
340 | } | 346 | } |
341 | 347 | ||
342 | void KOPrefs::setCategoryDefaults() | 348 | void KOPrefs::setCategoryDefaults() |
343 | { | 349 | { |
344 | mCustomCategories.clear(); | 350 | mCustomCategories.clear(); |
345 | mCustomCategories = getDefaultList(); | 351 | mCustomCategories = getDefaultList(); |
346 | 352 | ||
347 | QStringList::Iterator it; | 353 | QStringList::Iterator it; |
348 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 354 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
349 | setCategoryColor(*it,mDefaultCategoryColor); | 355 | setCategoryColor(*it,mDefaultCategoryColor); |
350 | } | 356 | } |
351 | } | 357 | } |
352 | QStringList KOPrefs::getLocationDefaultList() | 358 | QStringList KOPrefs::getLocationDefaultList() |
353 | { | 359 | { |
354 | QStringList retval ; | 360 | QStringList retval ; |
355 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | 361 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") |
356 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") | 362 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") |
357 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | 363 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") |
358 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | 364 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; |
359 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | 365 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") |
360 | 366 | ||
361 | retval.sort(); | 367 | retval.sort(); |
362 | return retval; | 368 | return retval; |
363 | } | 369 | } |
364 | QStringList KOPrefs::getDefaultList() | 370 | QStringList KOPrefs::getDefaultList() |
365 | { | 371 | { |
366 | QStringList retval ; | 372 | QStringList retval ; |
367 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") | 373 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") |
368 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") | 374 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") |
369 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") | 375 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") |
370 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") | 376 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") |
371 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") | 377 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") |
372 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") | 378 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") |
373 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") | 379 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") |
374 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; | 380 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; |
375 | retval.sort(); | 381 | retval.sort(); |
376 | //qDebug("cat %s ", retval.join("-").latin1()); | 382 | //qDebug("cat %s ", retval.join("-").latin1()); |
377 | return retval; | 383 | return retval; |
378 | } | 384 | } |
379 | 385 | ||
380 | void KOPrefs::usrReadConfig() | 386 | void KOPrefs::usrReadConfig() |
381 | { | 387 | { |
382 | config()->setGroup("General"); | 388 | config()->setGroup("General"); |
383 | 389 | ||
384 | //qDebug("KOPrefs::usrReadConfig() "); | 390 | //qDebug("KOPrefs::usrReadConfig() "); |
385 | mCustomCategories = config()->readListEntry("Custom Categories"); | 391 | mCustomCategories = config()->readListEntry("Custom Categories"); |
386 | mOldLoadedLanguage = mOldLanguage ; | 392 | mOldLoadedLanguage = mOldLanguage ; |
387 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | 393 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; |
388 | if (mLocationDefaults.isEmpty()) { | 394 | if (mLocationDefaults.isEmpty()) { |
389 | mLocationDefaults = getLocationDefaultList(); | 395 | mLocationDefaults = getLocationDefaultList(); |
390 | } | 396 | } |
391 | 397 | ||
392 | if (mEventSummaryUser.isEmpty()) { | 398 | if (mEventSummaryUser.isEmpty()) { |
393 | mEventSummaryUser = getDefaultList() ; | 399 | mEventSummaryUser = getDefaultList() ; |
394 | } | 400 | } |
395 | if (mTodoSummaryUser.isEmpty()) { | 401 | if (mTodoSummaryUser.isEmpty()) { |
396 | mTodoSummaryUser = getDefaultList() ; | 402 | mTodoSummaryUser = getDefaultList() ; |
397 | } | 403 | } |
398 | 404 | ||
399 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 405 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
400 | 406 | ||
401 | config()->setGroup("Personal Settings"); | 407 | config()->setGroup("Personal Settings"); |
402 | mName = config()->readEntry("user_name",""); | 408 | mName = config()->readEntry("user_name",""); |
403 | mEmail = config()->readEntry("user_email",""); | 409 | mEmail = config()->readEntry("user_email",""); |
404 | fillMailDefaults(); | 410 | fillMailDefaults(); |
405 | 411 | ||
406 | config()->setGroup("Category Colors"); | 412 | config()->setGroup("Category Colors"); |
407 | QStringList::Iterator it; | 413 | QStringList::Iterator it; |
408 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 414 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
409 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); | 415 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); |
410 | 416 | ||
411 | } | 417 | } |
412 | 418 | ||
413 | KPimPrefs::usrReadConfig(); | 419 | KPimPrefs::usrReadConfig(); |
414 | } | 420 | } |
415 | 421 | ||
416 | 422 | ||
417 | void KOPrefs::usrWriteConfig() | 423 | void KOPrefs::usrWriteConfig() |
418 | { | 424 | { |
419 | config()->setGroup("General"); | 425 | config()->setGroup("General"); |
420 | config()->writeEntry("Custom Categories",mCustomCategories); | 426 | config()->writeEntry("Custom Categories",mCustomCategories); |
421 | 427 | ||
422 | config()->setGroup("Personal Settings"); | 428 | config()->setGroup("Personal Settings"); |
423 | config()->writeEntry("user_name",mName); | 429 | config()->writeEntry("user_name",mName); |
424 | config()->writeEntry("user_email",mEmail); | 430 | config()->writeEntry("user_email",mEmail); |
425 | 431 | ||
426 | config()->setGroup("Category Colors"); | 432 | config()->setGroup("Category Colors"); |
427 | QDictIterator<QColor> it(mCategoryColors); | 433 | QDictIterator<QColor> it(mCategoryColors); |
428 | while (it.current()) { | 434 | while (it.current()) { |
429 | config()->writeEntry(it.currentKey(),*(it.current())); | 435 | config()->writeEntry(it.currentKey(),*(it.current())); |
430 | ++it; | 436 | ++it; |
431 | } | 437 | } |
432 | 438 | ||
433 | 439 | ||
434 | KPimPrefs::usrWriteConfig(); | 440 | KPimPrefs::usrWriteConfig(); |
435 | } | 441 | } |
436 | 442 | ||
437 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) | 443 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) |
438 | { | 444 | { |
439 | mCategoryColors.replace(cat,new QColor(color)); | 445 | mCategoryColors.replace(cat,new QColor(color)); |
440 | } | 446 | } |
441 | 447 | ||
442 | QColor *KOPrefs::categoryColor(QString cat) | 448 | QColor *KOPrefs::categoryColor(QString cat) |
443 | { | 449 | { |
444 | QColor *color = 0; | 450 | QColor *color = 0; |
445 | 451 | ||
446 | if (!cat.isEmpty()) color = mCategoryColors[cat]; | 452 | if (!cat.isEmpty()) color = mCategoryColors[cat]; |
447 | 453 | ||
448 | if (color) return color; | 454 | if (color) return color; |
449 | else return &mDefaultCategoryColor; | 455 | else return &mDefaultCategoryColor; |
450 | } | 456 | } |
451 | 457 | ||
452 | void KOPrefs::setFullName(const QString &name) | 458 | void KOPrefs::setFullName(const QString &name) |
453 | { | 459 | { |
454 | mName = name; | 460 | mName = name; |
455 | } | 461 | } |
456 | 462 | ||
457 | void KOPrefs::setEmail(const QString &email) | 463 | void KOPrefs::setEmail(const QString &email) |
458 | { | 464 | { |
459 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); | 465 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); |
460 | mEmail = email; | 466 | mEmail = email; |
461 | } | 467 | } |
462 | 468 | ||
463 | QString KOPrefs::fullName() | 469 | QString KOPrefs::fullName() |
464 | { | 470 | { |
465 | if (mEmailControlCenter) { | 471 | if (mEmailControlCenter) { |
466 | KEMailSettings settings; | 472 | KEMailSettings settings; |
467 | return settings.getSetting(KEMailSettings::RealName); | 473 | return settings.getSetting(KEMailSettings::RealName); |
468 | } else { | 474 | } else { |
469 | return mName; | 475 | return mName; |
470 | } | 476 | } |
471 | } | 477 | } |
472 | 478 | ||
473 | QString KOPrefs::email() | 479 | QString KOPrefs::email() |
474 | { | 480 | { |
475 | if (mEmailControlCenter) { | 481 | if (mEmailControlCenter) { |
476 | KEMailSettings settings; | 482 | KEMailSettings settings; |
477 | return settings.getSetting(KEMailSettings::EmailAddress); | 483 | return settings.getSetting(KEMailSettings::EmailAddress); |
478 | } else { | 484 | } else { |
479 | return mEmail; | 485 | return mEmail; |
480 | } | 486 | } |
481 | } | 487 | } |
482 | KConfig* KOPrefs::getConfig() | 488 | KConfig* KOPrefs::getConfig() |
483 | { | 489 | { |
484 | return config(); | 490 | return config(); |
485 | } | 491 | } |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index e300067..e4e3dd7 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -1,284 +1,292 @@ | |||
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 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KOPREFS_H | 23 | #ifndef KOPREFS_H |
24 | #define KOPREFS_H | 24 | #define KOPREFS_H |
25 | 25 | ||
26 | 26 | ||
27 | #include <libkdepim/kpimprefs.h> | 27 | #include <libkdepim/kpimprefs.h> |
28 | #include <qdict.h> | 28 | #include <qdict.h> |
29 | 29 | ||
30 | class KConfig; | 30 | class KConfig; |
31 | class QFont; | 31 | class QFont; |
32 | class QColor; | 32 | class QColor; |
33 | class QStringList; | 33 | class QStringList; |
34 | 34 | ||
35 | class KOPrefs : public KPimPrefs | 35 | class KOPrefs : public KPimPrefs |
36 | { | 36 | { |
37 | public: | 37 | public: |
38 | enum { FormatVCalendar, FormatICalendar }; | 38 | enum { FormatVCalendar, FormatICalendar }; |
39 | enum { MailClientKMail, MailClientSendmail }; | 39 | enum { MailClientKMail, MailClientSendmail }; |
40 | enum { IMIPDummy, IMIPKMail }; | 40 | enum { IMIPDummy, IMIPKMail }; |
41 | enum { IMIPOutbox, IMIPdirectsend }; | 41 | enum { IMIPOutbox, IMIPdirectsend }; |
42 | enum { neverAuto, addressbookAuto, selectedAuto }; | 42 | enum { neverAuto, addressbookAuto, selectedAuto }; |
43 | enum { standardDestination, askDestination }; | 43 | enum { standardDestination, askDestination }; |
44 | 44 | ||
45 | virtual ~KOPrefs(); | 45 | virtual ~KOPrefs(); |
46 | 46 | ||
47 | /** Get instance of KOPrefs. It is made sure that there is only one | 47 | /** Get instance of KOPrefs. It is made sure that there is only one |
48 | instance. */ | 48 | instance. */ |
49 | static KOPrefs *instance(); | 49 | static KOPrefs *instance(); |
50 | 50 | ||
51 | /** Set preferences to default values */ | 51 | /** Set preferences to default values */ |
52 | void usrSetDefaults(); | 52 | void usrSetDefaults(); |
53 | 53 | ||
54 | /** Read preferences from config file */ | 54 | /** Read preferences from config file */ |
55 | void usrReadConfig(); | 55 | void usrReadConfig(); |
56 | 56 | ||
57 | /** Write preferences to config file */ | 57 | /** Write preferences to config file */ |
58 | void usrWriteConfig(); | 58 | void usrWriteConfig(); |
59 | void setCategoryDefaults(); | 59 | void setCategoryDefaults(); |
60 | void setAllDefaults(); | 60 | void setAllDefaults(); |
61 | 61 | ||
62 | protected: | 62 | protected: |
63 | void setTimeZoneIdDefault(); | 63 | void setTimeZoneIdDefault(); |
64 | 64 | ||
65 | /** Fill empty mail fields with default values. */ | 65 | /** Fill empty mail fields with default values. */ |
66 | void fillMailDefaults(); | 66 | void fillMailDefaults(); |
67 | 67 | ||
68 | private: | 68 | private: |
69 | /** Constructor disabled for public. Use instance() to create a KOPrefs | 69 | /** Constructor disabled for public. Use instance() to create a KOPrefs |
70 | object. */ | 70 | object. */ |
71 | KOPrefs(); | 71 | KOPrefs(); |
72 | 72 | ||
73 | static KOPrefs *mInstance; | 73 | static KOPrefs *mInstance; |
74 | QStringList getDefaultList(); | 74 | QStringList getDefaultList(); |
75 | QStringList getLocationDefaultList(); | 75 | QStringList getLocationDefaultList(); |
76 | public: | 76 | public: |
77 | // preferences data | 77 | // preferences data |
78 | KConfig* getConfig(); | 78 | KConfig* getConfig(); |
79 | void setFullName(const QString &); | 79 | void setFullName(const QString &); |
80 | QString fullName(); | 80 | QString fullName(); |
81 | void setEmail(const QString &); | 81 | void setEmail(const QString &); |
82 | QString email(); | 82 | QString email(); |
83 | 83 | ||
84 | QString mAdditional; | 84 | QString mAdditional; |
85 | 85 | ||
86 | bool mEmailControlCenter; | 86 | bool mEmailControlCenter; |
87 | 87 | ||
88 | bool mBcc; | 88 | bool mBcc; |
89 | bool mAutoSave; | 89 | bool mAutoSave; |
90 | int mAutoSaveInterval; | 90 | int mAutoSaveInterval; |
91 | bool mConfirm; | 91 | bool mConfirm; |
92 | 92 | ||
93 | bool mEnableGroupScheduling; | 93 | bool mEnableGroupScheduling; |
94 | bool mEnableProjectView; | 94 | bool mEnableProjectView; |
95 | 95 | ||
96 | int mDefaultFormat; | 96 | int mDefaultFormat; |
97 | int mMailClient; | 97 | int mMailClient; |
98 | 98 | ||
99 | int mStartTime; | 99 | int mStartTime; |
100 | int mDefaultDuration; | 100 | int mDefaultDuration; |
101 | int mAlarmTime; | 101 | int mAlarmTime; |
102 | 102 | ||
103 | int mWorkingHoursStart; | 103 | int mWorkingHoursStart; |
104 | int mWorkingHoursEnd; | 104 | int mWorkingHoursEnd; |
105 | bool mExcludeHolidays; | 105 | bool mExcludeHolidays; |
106 | bool mExcludeSaturdays; | 106 | bool mExcludeSaturdays; |
107 | bool mMarcusBainsShowSeconds; | 107 | bool mMarcusBainsShowSeconds; |
108 | 108 | ||
109 | QFont mTimeBarFont; | 109 | QFont mTimeBarFont; |
110 | QFont mMonthViewFont; | 110 | QFont mMonthViewFont; |
111 | QFont mAgendaViewFont; | 111 | QFont mAgendaViewFont; |
112 | QFont mMarcusBainsFont; | 112 | QFont mMarcusBainsFont; |
113 | QFont mTimeLabelsFont; | 113 | QFont mTimeLabelsFont; |
114 | QFont mTodoViewFont; | 114 | QFont mTodoViewFont; |
115 | QFont mListViewFont; | 115 | QFont mListViewFont; |
116 | QFont mDateNavigatorFont; | 116 | QFont mDateNavigatorFont; |
117 | QFont mEditBoxFont; | 117 | QFont mEditBoxFont; |
118 | QFont mJornalViewFont; | 118 | QFont mJornalViewFont; |
119 | QFont mWhatsNextFont; | 119 | QFont mWhatsNextFont; |
120 | QFont mEventViewFont; | 120 | QFont mEventViewFont; |
121 | 121 | ||
122 | 122 | ||
123 | 123 | ||
124 | 124 | ||
125 | QColor mHolidayColor; | 125 | QColor mHolidayColor; |
126 | QColor mHighlightColor; | 126 | QColor mHighlightColor; |
127 | QColor mEventColor; | 127 | QColor mEventColor; |
128 | QColor mTodoDoneColor; | 128 | QColor mTodoDoneColor; |
129 | QColor mAgendaBgColor; | 129 | QColor mAgendaBgColor; |
130 | QColor mWorkingHoursColor; | 130 | QColor mWorkingHoursColor; |
131 | QColor mTodoDueTodayColor; | 131 | QColor mTodoDueTodayColor; |
132 | QColor mTodoOverdueColor; | 132 | QColor mTodoOverdueColor; |
133 | QColor mMonthViewEvenColor; | 133 | QColor mMonthViewEvenColor; |
134 | QColor mMonthViewOddColor; | 134 | QColor mMonthViewOddColor; |
135 | QColor mMonthViewHolidayColor; | 135 | QColor mMonthViewHolidayColor; |
136 | bool mMonthViewUsesDayColors; | 136 | bool mMonthViewUsesDayColors; |
137 | bool mMonthViewSatSunTog; | 137 | bool mMonthViewSatSunTog; |
138 | bool mMonthViewWeek; | 138 | bool mMonthViewWeek; |
139 | QColor mAppColor1; | 139 | QColor mAppColor1; |
140 | QColor mAppColor2; | 140 | QColor mAppColor2; |
141 | bool mUseAppColors; | 141 | bool mUseAppColors; |
142 | 142 | ||
143 | int mDayBegins; | 143 | int mDayBegins; |
144 | int mHourSize; | 144 | int mHourSize; |
145 | int mAllDaySize; | 145 | int mAllDaySize; |
146 | bool mShowFullMenu; | 146 | bool mShowFullMenu; |
147 | bool mDailyRecur; | 147 | bool mDailyRecur; |
148 | bool mWeeklyRecur; | 148 | bool mWeeklyRecur; |
149 | bool mMonthDailyRecur; | 149 | bool mMonthDailyRecur; |
150 | bool mMonthWeeklyRecur; | 150 | bool mMonthWeeklyRecur; |
151 | bool mMonthShowIcons; | 151 | bool mMonthShowIcons; |
152 | bool mMonthShowShort; | 152 | bool mMonthShowShort; |
153 | bool mEnableToolTips; | 153 | bool mEnableToolTips; |
154 | bool mEnableMonthScroll; | 154 | bool mEnableMonthScroll; |
155 | bool mFullViewMonth; | 155 | bool mFullViewMonth; |
156 | bool mMonthViewUsesCategoryColor; | 156 | bool mMonthViewUsesCategoryColor; |
157 | bool mFullViewTodo; | 157 | bool mFullViewTodo; |
158 | bool mShowCompletedTodo; | 158 | bool mShowCompletedTodo; |
159 | bool mMarcusBainsEnabled; | 159 | bool mMarcusBainsEnabled; |
160 | int mNextXDays; | 160 | int mNextXDays; |
161 | int mWhatsNextDays; | 161 | int mWhatsNextDays; |
162 | int mWhatsNextPrios; | 162 | int mWhatsNextPrios; |
163 | bool mEnableQuickTodo; | 163 | bool mEnableQuickTodo; |
164 | 164 | ||
165 | bool mCompactDialogs; | 165 | bool mCompactDialogs; |
166 | bool mVerticalScreen; | 166 | bool mVerticalScreen; |
167 | 167 | ||
168 | bool mShowIconNewTodo; | 168 | bool mShowIconNewTodo; |
169 | bool mShowIconNewEvent; | 169 | bool mShowIconNewEvent; |
170 | bool mShowIconSearch; | 170 | bool mShowIconSearch; |
171 | bool mShowIconList; | 171 | bool mShowIconList; |
172 | bool mShowIconDay1; | 172 | bool mShowIconDay1; |
173 | bool mShowIconDay5; | 173 | bool mShowIconDay5; |
174 | bool mShowIconDay6; | 174 | bool mShowIconDay6; |
175 | bool mShowIconDay7; | 175 | bool mShowIconDay7; |
176 | bool mShowIconMonth; | 176 | bool mShowIconMonth; |
177 | bool mShowIconTodoview; | 177 | bool mShowIconTodoview; |
178 | bool mShowIconBackFast; | 178 | bool mShowIconBackFast; |
179 | bool mShowIconBack; | 179 | bool mShowIconBack; |
180 | bool mShowIconToday; | 180 | bool mShowIconToday; |
181 | bool mShowIconForward; | 181 | bool mShowIconForward; |
182 | bool mShowIconForwardFast; | 182 | bool mShowIconForwardFast; |
183 | bool mShowIconWhatsThis; | 183 | bool mShowIconWhatsThis; |
184 | bool mShowIconNextDays; | 184 | bool mShowIconNextDays; |
185 | bool mShowIconNext; | 185 | bool mShowIconNext; |
186 | bool mShowIconJournal; | 186 | bool mShowIconJournal; |
187 | 187 | ||
188 | bool mShowIconStretch; | 188 | bool mShowIconStretch; |
189 | 189 | ||
190 | bool mToolBarHor; | 190 | bool mToolBarHor; |
191 | bool mToolBarUp; | 191 | bool mToolBarUp; |
192 | bool mToolBarMiniIcons; | 192 | bool mToolBarMiniIcons; |
193 | 193 | ||
194 | bool mAskForQuit; | 194 | bool mAskForQuit; |
195 | bool mUsePassWd; | 195 | bool mUsePassWd; |
196 | bool mShowSyncEvents; | 196 | bool mShowSyncEvents; |
197 | bool mShowTodoInAgenda; | 197 | bool mShowTodoInAgenda; |
198 | bool mShowTimeInAgenda; | 198 | bool mShowTimeInAgenda; |
199 | bool mHideNonStartedTodos; | 199 | bool mHideNonStartedTodos; |
200 | 200 | ||
201 | int mLastSyncTime; | 201 | int mLastSyncTime; |
202 | void setCategoryColor(QString cat,const QColor & color); | 202 | void setCategoryColor(QString cat,const QColor & color); |
203 | QColor *categoryColor(QString cat); | 203 | QColor *categoryColor(QString cat); |
204 | 204 | ||
205 | QString mArchiveFile; | 205 | QString mArchiveFile; |
206 | QString mHtmlExportFile; | 206 | QString mHtmlExportFile; |
207 | bool mHtmlWithSave; | 207 | bool mHtmlWithSave; |
208 | 208 | ||
209 | QStringList mSelectedPlugins; | 209 | QStringList mSelectedPlugins; |
210 | 210 | ||
211 | QString mLastImportFile; | 211 | QString mLastImportFile; |
212 | QString mLastVcalFile; | 212 | QString mLastVcalFile; |
213 | QString mLastSaveFile; | 213 | QString mLastSaveFile; |
214 | QString mLastLoadFile; | 214 | QString mLastLoadFile; |
215 | 215 | ||
216 | 216 | ||
217 | QString mDefaultAlarmFile; | 217 | QString mDefaultAlarmFile; |
218 | int mIMIPScheduler; | 218 | int mIMIPScheduler; |
219 | int mIMIPSend; | 219 | int mIMIPSend; |
220 | QStringList mAdditionalMails; | 220 | QStringList mAdditionalMails; |
221 | int mIMIPAutoRefresh; | 221 | int mIMIPAutoRefresh; |
222 | int mIMIPAutoInsertReply; | 222 | int mIMIPAutoInsertReply; |
223 | int mIMIPAutoInsertRequest; | 223 | int mIMIPAutoInsertRequest; |
224 | int mIMIPAutoFreeBusy; | 224 | int mIMIPAutoFreeBusy; |
225 | int mIMIPAutoFreeBusyReply; | 225 | int mIMIPAutoFreeBusyReply; |
226 | 226 | ||
227 | QStringList mTodoTemplates; | 227 | QStringList mTodoTemplates; |
228 | QStringList mEventTemplates; | 228 | QStringList mEventTemplates; |
229 | 229 | ||
230 | int mDestination; | 230 | int mDestination; |
231 | 231 | ||
232 | 232 | ||
233 | bool mEditOnDoubleClick; | 233 | bool mEditOnDoubleClick; |
234 | bool mViewChangeHoldFullscreen; | 234 | bool mViewChangeHoldFullscreen; |
235 | bool mViewChangeHoldNonFullscreen; | 235 | bool mViewChangeHoldNonFullscreen; |
236 | bool mCenterOnCurrentTime; | 236 | bool mCenterOnCurrentTime; |
237 | bool mSetTimeToDayStartAt; | 237 | bool mSetTimeToDayStartAt; |
238 | bool mHighlightCurrentDay; | 238 | bool mHighlightCurrentDay; |
239 | bool mUseHighlightLightColor; | 239 | bool mUseHighlightLightColor; |
240 | bool mListViewMonthTimespan; | 240 | bool mListViewMonthTimespan; |
241 | bool mWNViewShowsParents; | 241 | bool mWNViewShowsParents; |
242 | bool mWNViewShowsPast; | 242 | bool mWNViewShowsPast; |
243 | bool mWNViewShowLocation; | 243 | bool mWNViewShowLocation; |
244 | bool mTodoViewShowsPercentage; | 244 | bool mTodoViewShowsPercentage; |
245 | bool mTodoViewUsesCatColors; | 245 | bool mTodoViewUsesCatColors; |
246 | bool mMonthViewUsesBigFont; | 246 | bool mMonthViewUsesBigFont; |
247 | bool mTodoViewUsesSmallFont; | 247 | bool mTodoViewUsesSmallFont; |
248 | bool mTodoViewUsesForegroundColor; | 248 | bool mTodoViewUsesForegroundColor; |
249 | bool mMonthViewUsesForegroundColor; | 249 | bool mMonthViewUsesForegroundColor; |
250 | 250 | ||
251 | bool mHightlightDateTimeEdit; | 251 | bool mHightlightDateTimeEdit; |
252 | bool mShortDateInViewer; | 252 | bool mShortDateInViewer; |
253 | 253 | ||
254 | bool mShowDateNavigator; | 254 | bool mShowDateNavigator; |
255 | 255 | ||
256 | QStringList mLocationDefaults; | 256 | QStringList mLocationDefaults; |
257 | QStringList mEventSummaryUser; | 257 | QStringList mEventSummaryUser; |
258 | QStringList mTodoSummaryUser; | 258 | QStringList mTodoSummaryUser; |
259 | 259 | ||
260 | bool mUseInternalAlarmNotification; | 260 | bool mUseInternalAlarmNotification; |
261 | int mAlarmPlayBeeps; | 261 | int mAlarmPlayBeeps; |
262 | int mAlarmSuspendTime; | 262 | int mAlarmSuspendTime; |
263 | int mAlarmSuspendCount; | 263 | int mAlarmSuspendCount; |
264 | int mAlarmBeepInterval; | 264 | int mAlarmBeepInterval; |
265 | int mOldLanguage; | 265 | int mOldLanguage; |
266 | int mOldLoadedLanguage; | 266 | int mOldLoadedLanguage; |
267 | 267 | ||
268 | 268 | ||
269 | QString mActiveSyncPort; | 269 | QString mActiveSyncPort; |
270 | QString mActiveSyncIP; | 270 | QString mActiveSyncIP; |
271 | 271 | ||
272 | // settings for eventviewer | ||
273 | bool mEVshowDetails; | ||
274 | bool mEVshowCreated; | ||
275 | bool mEVshowChanged; | ||
276 | bool mWTshowDetails; | ||
277 | bool mWTshowCreated; | ||
278 | bool mWTshowChanged; | ||
279 | |||
272 | private: | 280 | private: |
273 | QDict<QColor> mCategoryColors; | 281 | QDict<QColor> mCategoryColors; |
274 | QColor mDefaultCategoryColor; | 282 | QColor mDefaultCategoryColor; |
275 | 283 | ||
276 | QFont mDefaultTimeBarFont; | 284 | QFont mDefaultTimeBarFont; |
277 | QFont mDefaultViewFont; | 285 | QFont mDefaultViewFont; |
278 | QFont mDefaultMonthViewFont; | 286 | QFont mDefaultMonthViewFont; |
279 | 287 | ||
280 | QString mName; | 288 | QString mName; |
281 | QString mEmail; | 289 | QString mEmail; |
282 | }; | 290 | }; |
283 | 291 | ||
284 | #endif | 292 | #endif |
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp index 452d019..443508d 100644 --- a/korganizer/koprefsdialog.cpp +++ b/korganizer/koprefsdialog.cpp | |||
@@ -1,1668 +1,1700 @@ | |||
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 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qgroupbox.h> | 26 | #include <qgroupbox.h> |
27 | #include <qbuttongroup.h> | 27 | #include <qbuttongroup.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | #include <qfont.h> | 29 | #include <qfont.h> |
30 | #include <qslider.h> | 30 | #include <qslider.h> |
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qvbox.h> | 34 | #include <qvbox.h> |
35 | #include <qhbox.h> | 35 | #include <qhbox.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
38 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
39 | #include <qcheckbox.h> | 39 | #include <qcheckbox.h> |
40 | #include <qradiobutton.h> | 40 | #include <qradiobutton.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qstrlist.h> | 42 | #include <qstrlist.h> |
43 | #include <qapplication.h> | 43 | #include <qapplication.h> |
44 | 44 | ||
45 | #include <kcolorbutton.h> | 45 | #include <kcolorbutton.h> |
46 | #include <kdebug.h> | 46 | #include <kdebug.h> |
47 | #include <klocale.h> | 47 | #include <klocale.h> |
48 | #include <kglobal.h> | 48 | #include <kglobal.h> |
49 | #include <kfontdialog.h> | 49 | #include <kfontdialog.h> |
50 | #include <kfiledialog.h> | 50 | #include <kfiledialog.h> |
51 | #include <kmessagebox.h> | 51 | #include <kmessagebox.h> |
52 | #include <kcolordialog.h> | 52 | #include <kcolordialog.h> |
53 | #include <kiconloader.h> | 53 | #include <kiconloader.h> |
54 | #include <kemailsettings.h> | 54 | #include <kemailsettings.h> |
55 | #include <kstandarddirs.h> | 55 | #include <kstandarddirs.h> |
56 | 56 | ||
57 | #include <kurlrequester.h> | 57 | #include <kurlrequester.h> |
58 | #include <klineedit.h> | 58 | #include <klineedit.h> |
59 | 59 | ||
60 | #if defined(USE_SOLARIS) | 60 | #if defined(USE_SOLARIS) |
61 | #include <sys/param.h> | 61 | #include <sys/param.h> |
62 | 62 | ||
63 | #define ZONEINFODIR "/usr/share/lib/zoneinfo" | 63 | #define ZONEINFODIR "/usr/share/lib/zoneinfo" |
64 | #define INITFILE "/etc/default/init" | 64 | #define INITFILE "/etc/default/init" |
65 | #endif | 65 | #endif |
66 | 66 | ||
67 | #include "koprefs.h" | 67 | #include "koprefs.h" |
68 | 68 | ||
69 | #include "koprefsdialog.h" | 69 | #include "koprefsdialog.h" |
70 | #include "kpimglobalprefs.h" | 70 | #include "kpimglobalprefs.h" |
71 | 71 | ||
72 | 72 | ||
73 | KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : | 73 | KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : |
74 | KPrefsDialog(KOPrefs::instance(),parent,name,true) | 74 | KPrefsDialog(KOPrefs::instance(),parent,name,true) |
75 | { | 75 | { |
76 | 76 | ||
77 | setCaption( i18n("Preferences - some settings need a restart (nr)")); | 77 | setCaption( i18n("Preferences - some settings need a restart (nr)")); |
78 | mCategoryDict.setAutoDelete(true); | 78 | mCategoryDict.setAutoDelete(true); |
79 | 79 | ||
80 | KGlobal::locale()->insertCatalogue("timezones"); | 80 | KGlobal::locale()->insertCatalogue("timezones"); |
81 | 81 | ||
82 | setupGlobalTab(); | 82 | setupGlobalTab(); |
83 | setupMainTab(); | 83 | setupMainTab(); |
84 | // setupLocaleTab(); | 84 | // setupLocaleTab(); |
85 | //setupTimeZoneTab(); | 85 | //setupTimeZoneTab(); |
86 | setupTimeTab(); | 86 | setupTimeTab(); |
87 | //setupLocaleDateTab(); | 87 | //setupLocaleDateTab(); |
88 | setupFontsTab(); | 88 | setupFontsTab(); |
89 | setupColorsTab(); | 89 | setupColorsTab(); |
90 | setupViewsTab(); | 90 | setupViewsTab(); |
91 | //setupSyncTab(); | 91 | //setupSyncTab(); |
92 | //setupSyncAlgTab(); | 92 | //setupSyncAlgTab(); |
93 | //setupPrinterTab(); | 93 | //setupPrinterTab(); |
94 | //setupGroupSchedulingTab(); | 94 | //setupGroupSchedulingTab(); |
95 | //setupGroupAutomationTab(); | 95 | //setupGroupAutomationTab(); |
96 | 96 | ||
97 | #ifndef DESKTOP_VERSION | 97 | #ifndef DESKTOP_VERSION |
98 | if ( QApplication::desktop()->height() == 480 ) | 98 | if ( QApplication::desktop()->height() == 480 ) |
99 | hideButtons(); | 99 | hideButtons(); |
100 | #endif | 100 | #endif |
101 | } | 101 | } |
102 | 102 | ||
103 | 103 | ||
104 | KOPrefsDialog::~KOPrefsDialog() | 104 | KOPrefsDialog::~KOPrefsDialog() |
105 | { | 105 | { |
106 | } | 106 | } |
107 | void KOPrefsDialog::setupGlobalTab() | 107 | void KOPrefsDialog::setupGlobalTab() |
108 | { | 108 | { |
109 | QFrame *topFrame = addPage(i18n("Global"),0,0); | 109 | QFrame *topFrame = addPage(i18n("Global"),0,0); |
110 | kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); | 110 | kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); |
111 | QVBoxLayout *topLayout = new QVBoxLayout(topFrame); | 111 | QVBoxLayout *topLayout = new QVBoxLayout(topFrame); |
112 | topLayout->addWidget( kdelibcfg ); | 112 | topLayout->addWidget( kdelibcfg ); |
113 | 113 | ||
114 | 114 | ||
115 | } | 115 | } |
116 | void KOPrefsDialog::setupLocaleDateTab() | 116 | void KOPrefsDialog::setupLocaleDateTab() |
117 | { | 117 | { |
118 | #if 0 | 118 | #if 0 |
119 | QFrame *topFrame = addPage(i18n("Date Format"),0,0); | 119 | QFrame *topFrame = addPage(i18n("Date Format"),0,0); |
120 | QGridLayout *topLayout = new QGridLayout(topFrame,3,2); | 120 | QGridLayout *topLayout = new QGridLayout(topFrame,3,2); |
121 | topLayout->setSpacing(spacingHint()); | 121 | topLayout->setSpacing(spacingHint()); |
122 | topLayout->setMargin(marginHint()); | 122 | topLayout->setMargin(marginHint()); |
123 | int iii = 0; | 123 | int iii = 0; |
124 | 124 | ||
125 | 125 | ||
126 | KPrefsDialogWidRadios *syncPrefsGroup = | 126 | KPrefsDialogWidRadios *syncPrefsGroup = |
127 | addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); | 127 | addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); |
128 | QString format; | 128 | QString format; |
129 | if ( QApplication::desktop()->width() < 480 ) | 129 | if ( QApplication::desktop()->width() < 480 ) |
130 | format = "(%d.%m.%Y)"; | 130 | format = "(%d.%m.%Y)"; |
131 | else | 131 | else |
132 | format = "(%d.%m.%Y|%A %d %B %Y)"; | 132 | format = "(%d.%m.%Y|%A %d %B %Y)"; |
133 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); | 133 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); |
134 | if ( QApplication::desktop()->width() < 480 ) | 134 | if ( QApplication::desktop()->width() < 480 ) |
135 | format = "(%m.%d.%Y)"; | 135 | format = "(%m.%d.%Y)"; |
136 | else | 136 | else |
137 | format = "(%m.%d.%Y|%A %B %d %Y)"; | 137 | format = "(%m.%d.%Y|%A %B %d %Y)"; |
138 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); | 138 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); |
139 | if ( QApplication::desktop()->width() < 480 ) | 139 | if ( QApplication::desktop()->width() < 480 ) |
140 | format = "(%Y-%m-%d)"; | 140 | format = "(%Y-%m-%d)"; |
141 | else | 141 | else |
142 | format = "(%Y-%m-%d|%A %Y %B %d)"; | 142 | format = "(%Y-%m-%d|%A %Y %B %d)"; |
143 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); | 143 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); |
144 | syncPrefsGroup->addRadio(i18n("User defined")); | 144 | syncPrefsGroup->addRadio(i18n("User defined")); |
145 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 145 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
146 | ++iii; | 146 | ++iii; |
147 | ++iii; | 147 | ++iii; |
148 | QLabel * lab; | 148 | QLabel * lab; |
149 | mUserDateFormatLong = new QLineEdit(topFrame); | 149 | mUserDateFormatLong = new QLineEdit(topFrame); |
150 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); | 150 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); |
151 | topLayout->addWidget(lab ,iii,0); | 151 | topLayout->addWidget(lab ,iii,0); |
152 | topLayout->addWidget(mUserDateFormatLong,iii,1); | 152 | topLayout->addWidget(mUserDateFormatLong,iii,1); |
153 | ++iii; | 153 | ++iii; |
154 | mUserDateFormatShort = new QLineEdit(topFrame); | 154 | mUserDateFormatShort = new QLineEdit(topFrame); |
155 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); | 155 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); |
156 | topLayout->addWidget(lab ,iii,0); | 156 | topLayout->addWidget(lab ,iii,0); |
157 | topLayout->addWidget(mUserDateFormatShort,iii,1); | 157 | topLayout->addWidget(mUserDateFormatShort,iii,1); |
158 | ++iii; | 158 | ++iii; |
159 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); | 159 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); |
160 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 160 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
161 | ++iii; | 161 | ++iii; |
162 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); | 162 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); |
163 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 163 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
164 | ++iii; | 164 | ++iii; |
165 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); | 165 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); |
166 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 166 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
167 | ++iii; | 167 | ++iii; |
168 | #endif | 168 | #endif |
169 | 169 | ||
170 | } | 170 | } |
171 | 171 | ||
172 | void KOPrefsDialog::setupLocaleTab() | 172 | void KOPrefsDialog::setupLocaleTab() |
173 | { | 173 | { |
174 | #if 0 | 174 | #if 0 |
175 | QFrame *topFrame = addPage(i18n("Locale"),0,0); | 175 | QFrame *topFrame = addPage(i18n("Locale"),0,0); |
176 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 176 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); |
177 | topLayout->setSpacing(spacingHint()); | 177 | topLayout->setSpacing(spacingHint()); |
178 | topLayout->setMargin(marginHint()); | 178 | topLayout->setMargin(marginHint()); |
179 | int iii = 0; | 179 | int iii = 0; |
180 | KPrefsDialogWidRadios *syncPrefsGroup = | 180 | KPrefsDialogWidRadios *syncPrefsGroup = |
181 | addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); | 181 | addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); |
182 | syncPrefsGroup->addRadio(i18n("English")); | 182 | syncPrefsGroup->addRadio(i18n("English")); |
183 | syncPrefsGroup->addRadio(i18n("German")); | 183 | syncPrefsGroup->addRadio(i18n("German")); |
184 | syncPrefsGroup->addRadio(i18n("French")); | 184 | syncPrefsGroup->addRadio(i18n("French")); |
185 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); | 185 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); |
186 | if ( QApplication::desktop()->width() < 300 ) | 186 | if ( QApplication::desktop()->width() < 300 ) |
187 | ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | 187 | ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); |
188 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 188 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
189 | ++iii; | 189 | ++iii; |
190 | 190 | ||
191 | syncPrefsGroup = | 191 | syncPrefsGroup = |
192 | addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); | 192 | addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); |
193 | if ( QApplication::desktop()->width() > 300 ) | 193 | if ( QApplication::desktop()->width() > 300 ) |
194 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | 194 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); |
195 | syncPrefsGroup->addRadio(i18n("24:00")); | 195 | syncPrefsGroup->addRadio(i18n("24:00")); |
196 | syncPrefsGroup->addRadio(i18n("12:00am")); | 196 | syncPrefsGroup->addRadio(i18n("12:00am")); |
197 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | 197 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); |
198 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 198 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
199 | ++iii; | 199 | ++iii; |
200 | KPrefsDialogWidBool *sb; | 200 | KPrefsDialogWidBool *sb; |
201 | if ( QApplication::desktop()->width() < 300 ) { | 201 | if ( QApplication::desktop()->width() < 300 ) { |
202 | sb = | 202 | sb = |
203 | addWidBool(i18n("Week starts on Sunday"), | 203 | addWidBool(i18n("Week starts on Sunday"), |
204 | &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); | 204 | &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); |
205 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 205 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
206 | ++iii; | 206 | ++iii; |
207 | sb = | 207 | sb = |
208 | addWidBool(i18n("Use short date in (WN/E) view"), | 208 | addWidBool(i18n("Use short date in (WN/E) view"), |
209 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); | 209 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); |
210 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 210 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
211 | } | 211 | } |
212 | else { | 212 | else { |
213 | QWidget * hb = new QWidget( topFrame ); | 213 | QWidget * hb = new QWidget( topFrame ); |
214 | QHBoxLayout *hbLayout = new QHBoxLayout(hb); | 214 | QHBoxLayout *hbLayout = new QHBoxLayout(hb); |
215 | sb = | 215 | sb = |
216 | addWidBool(i18n("Week starts on Sunday"), | 216 | addWidBool(i18n("Week starts on Sunday"), |
217 | &(KOPrefs::instance()->mWeekStartsOnSunday),hb); | 217 | &(KOPrefs::instance()->mWeekStartsOnSunday),hb); |
218 | hbLayout->addWidget(sb->checkBox() ); | 218 | hbLayout->addWidget(sb->checkBox() ); |
219 | sb = | 219 | sb = |
220 | addWidBool(i18n("Use short date in (WN/E) view"), | 220 | addWidBool(i18n("Use short date in (WN/E) view"), |
221 | &(KOPrefs::instance()->mShortDateInViewer),hb); | 221 | &(KOPrefs::instance()->mShortDateInViewer),hb); |
222 | hbLayout->addWidget(sb->checkBox() ); | 222 | hbLayout->addWidget(sb->checkBox() ); |
223 | topLayout->addMultiCellWidget(hb, iii,iii,0,1); | 223 | topLayout->addMultiCellWidget(hb, iii,iii,0,1); |
224 | 224 | ||
225 | } | 225 | } |
226 | // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION | 226 | // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION |
227 | #if 0 | 227 | #if 0 |
228 | ++iii; | 228 | ++iii; |
229 | sb = | 229 | sb = |
230 | addWidBool(i18n("Quick load/save (w/o Unicode)"), | 230 | addWidBool(i18n("Quick load/save (w/o Unicode)"), |
231 | &(KOPrefs::instance()->mUseQuicksave),topFrame); | 231 | &(KOPrefs::instance()->mUseQuicksave),topFrame); |
232 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 232 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
233 | #endif | 233 | #endif |
234 | #endif | 234 | #endif |
235 | } | 235 | } |
236 | void KOPrefsDialog::showSyncPage() | 236 | void KOPrefsDialog::showSyncPage() |
237 | { | 237 | { |
238 | showPage ( 0 ) ; | 238 | showPage ( 0 ) ; |
239 | kdelibcfg->showTimeZoneTab() ; | 239 | kdelibcfg->showTimeZoneTab() ; |
240 | 240 | ||
241 | } | 241 | } |
242 | void KOPrefsDialog::setupSyncAlgTab() | 242 | void KOPrefsDialog::setupSyncAlgTab() |
243 | { | 243 | { |
244 | #if 0 | 244 | #if 0 |
245 | QLabel * lab; | 245 | QLabel * lab; |
246 | QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); | 246 | QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); |
247 | mSetupSyncAlgTab = topFrame; | 247 | mSetupSyncAlgTab = topFrame; |
248 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 248 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
249 | topLayout->setSpacing(spacingHint()); | 249 | topLayout->setSpacing(spacingHint()); |
250 | topLayout->setMargin(marginHint()); | 250 | topLayout->setMargin(marginHint()); |
251 | int iii = 0; | 251 | int iii = 0; |
252 | 252 | ||
253 | KPrefsDialogWidBool *sb = | 253 | KPrefsDialogWidBool *sb = |
254 | addWidBool(i18n("Ask for preferences before syncing"), | 254 | addWidBool(i18n("Ask for preferences before syncing"), |
255 | &(KOPrefs::instance()->mAskForPreferences),topFrame); | 255 | &(KOPrefs::instance()->mAskForPreferences),topFrame); |
256 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 256 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
257 | 257 | ||
258 | ++iii; | 258 | ++iii; |
259 | 259 | ||
260 | KPrefsDialogWidRadios *syncPrefsGroup = | 260 | KPrefsDialogWidRadios *syncPrefsGroup = |
261 | addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), | 261 | addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), |
262 | topFrame); | 262 | topFrame); |
263 | syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 263 | syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
264 | syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 264 | syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
265 | syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 265 | syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
266 | syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 266 | syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
267 | syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 267 | syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
268 | syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 268 | syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
269 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 269 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
270 | ++iii; | 270 | ++iii; |
271 | sb = | 271 | sb = |
272 | addWidBool(i18n("Show summary after syncing"), | 272 | addWidBool(i18n("Show summary after syncing"), |
273 | &(KOPrefs::instance()->mShowSyncSummary),topFrame); | 273 | &(KOPrefs::instance()->mShowSyncSummary),topFrame); |
274 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 274 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
275 | 275 | ||
276 | ++iii; | 276 | ++iii; |
277 | #endif | 277 | #endif |
278 | 278 | ||
279 | 279 | ||
280 | 280 | ||
281 | } | 281 | } |
282 | 282 | ||
283 | 283 | ||
284 | void KOPrefsDialog::setupSyncTab() | 284 | void KOPrefsDialog::setupSyncTab() |
285 | { | 285 | { |
286 | #if 0 | 286 | #if 0 |
287 | QLabel * lab; | 287 | QLabel * lab; |
288 | QFrame *topFrame = addPage(i18n("Sync Network"),0,0); | 288 | QFrame *topFrame = addPage(i18n("Sync Network"),0,0); |
289 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 289 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
290 | topLayout->setSpacing(spacingHint()); | 290 | topLayout->setSpacing(spacingHint()); |
291 | topLayout->setMargin(marginHint()); | 291 | topLayout->setMargin(marginHint()); |
292 | lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); | 292 | lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); |
293 | int iii = 0; | 293 | int iii = 0; |
294 | topLayout->addMultiCellWidget(lab , iii,iii,0,1); | 294 | topLayout->addMultiCellWidget(lab , iii,iii,0,1); |
295 | ++iii; | 295 | ++iii; |
296 | 296 | ||
297 | mRemoteIPEdit = new QLineEdit(topFrame); | 297 | mRemoteIPEdit = new QLineEdit(topFrame); |
298 | lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); | 298 | lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); |
299 | topLayout->addWidget(lab ,iii,0); | 299 | topLayout->addWidget(lab ,iii,0); |
300 | topLayout->addWidget(mRemoteIPEdit,iii,1); | 300 | topLayout->addWidget(mRemoteIPEdit,iii,1); |
301 | ++iii; | 301 | ++iii; |
302 | mRemoteUser = new QLineEdit(topFrame); | 302 | mRemoteUser = new QLineEdit(topFrame); |
303 | lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); | 303 | lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); |
304 | topLayout->addWidget(lab ,iii,0); | 304 | topLayout->addWidget(lab ,iii,0); |
305 | topLayout->addWidget(mRemoteUser, iii,1); | 305 | topLayout->addWidget(mRemoteUser, iii,1); |
306 | ++iii; | 306 | ++iii; |
307 | 307 | ||
308 | mRemoteFile = new QLineEdit(topFrame); | 308 | mRemoteFile = new QLineEdit(topFrame); |
309 | lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); | 309 | lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); |
310 | topLayout->addWidget(lab ,iii,0); | 310 | topLayout->addWidget(lab ,iii,0); |
311 | topLayout->addWidget(mRemoteFile,iii,1); | 311 | topLayout->addWidget(mRemoteFile,iii,1); |
312 | ++iii; | 312 | ++iii; |
313 | 313 | ||
314 | mLocalTempFile = new QLineEdit(topFrame); | 314 | mLocalTempFile = new QLineEdit(topFrame); |
315 | lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); | 315 | lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); |
316 | topLayout->addWidget(lab ,iii,0); | 316 | topLayout->addWidget(lab ,iii,0); |
317 | topLayout->addWidget(mLocalTempFile,iii,1); | 317 | topLayout->addWidget(mLocalTempFile,iii,1); |
318 | ++iii; | 318 | ++iii; |
319 | 319 | ||
320 | KPrefsDialogWidBool *wb = | 320 | KPrefsDialogWidBool *wb = |
321 | addWidBool(i18n("Write back synced file"), | 321 | addWidBool(i18n("Write back synced file"), |
322 | &(KOPrefs::instance()->mWriteBackFile),topFrame); | 322 | &(KOPrefs::instance()->mWriteBackFile),topFrame); |
323 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); | 323 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); |
324 | ++iii; | 324 | ++iii; |
325 | wb = | 325 | wb = |
326 | addWidBool(i18n("Write back existing entries only"), | 326 | addWidBool(i18n("Write back existing entries only"), |
327 | &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); | 327 | &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); |
328 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); | 328 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); |
329 | ++iii; | 329 | ++iii; |
330 | 330 | ||
331 | #endif | 331 | #endif |
332 | } | 332 | } |
333 | 333 | ||
334 | void KOPrefsDialog::setupMainTab() | 334 | void KOPrefsDialog::setupMainTab() |
335 | { | 335 | { |
336 | QFrame *topFrame = addPage(i18n("General"),0,0); | 336 | QFrame *topFrame = addPage(i18n("General"),0,0); |
337 | // DesktopIcon("identity",KIcon::SizeMedium)); | 337 | // DesktopIcon("identity",KIcon::SizeMedium)); |
338 | 338 | ||
339 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 339 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
340 | topLayout->setSpacing(spacingHint()); | 340 | topLayout->setSpacing(spacingHint()); |
341 | topLayout->setMargin(marginHint()); | 341 | topLayout->setMargin(marginHint()); |
342 | 342 | ||
343 | // KPrefsDialogWidBool *emailControlCenter = | 343 | // KPrefsDialogWidBool *emailControlCenter = |
344 | // addWidBool(i18n("&Use email settings from Control Center"), | 344 | // addWidBool(i18n("&Use email settings from Control Center"), |
345 | // &(KOPrefs::instance()->mEmailControlCenter),topFrame); | 345 | // &(KOPrefs::instance()->mEmailControlCenter),topFrame); |
346 | // topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); | 346 | // topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); |
347 | // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), | 347 | // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), |
348 | // SLOT(toggleEmailSettings(bool))); | 348 | // SLOT(toggleEmailSettings(bool))); |
349 | 349 | ||
350 | mNameEdit = new QLineEdit(topFrame); | 350 | mNameEdit = new QLineEdit(topFrame); |
351 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); | 351 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); |
352 | topLayout->addWidget(mNameLabel,0,0); | 352 | topLayout->addWidget(mNameLabel,0,0); |
353 | topLayout->addWidget(mNameEdit,0,1); | 353 | topLayout->addWidget(mNameEdit,0,1); |
354 | 354 | ||
355 | mEmailEdit = new QLineEdit(topFrame); | 355 | mEmailEdit = new QLineEdit(topFrame); |
356 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); | 356 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); |
357 | topLayout->addWidget(mEmailLabel,1,0); | 357 | topLayout->addWidget(mEmailLabel,1,0); |
358 | topLayout->addWidget(mEmailEdit,1,1); | 358 | topLayout->addWidget(mEmailEdit,1,1); |
359 | KPrefsDialogWidBool *wb; | 359 | KPrefsDialogWidBool *wb; |
360 | QHBox *dummy; | 360 | QHBox *dummy; |
361 | if ( QApplication::desktop()->width() > 480 ) { | 361 | if ( QApplication::desktop()->width() > 480 ) { |
362 | dummy = new QHBox(topFrame); | 362 | dummy = new QHBox(topFrame); |
363 | } else { | 363 | } else { |
364 | dummy = new QVBox(topFrame); | 364 | dummy = new QVBox(topFrame); |
365 | } | 365 | } |
366 | 366 | ||
367 | topLayout->addMultiCellWidget(dummy, 2,2,0,1); | 367 | topLayout->addMultiCellWidget(dummy, 2,2,0,1); |
368 | addWidBool(i18n("Full menu bar(nr)"), | 368 | addWidBool(i18n("Full menu bar(nr)"), |
369 | &(KOPrefs::instance()->mShowFullMenu),dummy); | 369 | &(KOPrefs::instance()->mShowFullMenu),dummy); |
370 | 370 | ||
371 | 371 | ||
372 | addWidBool(i18n("Mini icons in toolbar(nr)"), | 372 | addWidBool(i18n("Mini icons in toolbar(nr)"), |
373 | &(KOPrefs::instance()->mToolBarMiniIcons),dummy); | 373 | &(KOPrefs::instance()->mToolBarMiniIcons),dummy); |
374 | 374 | ||
375 | 375 | ||
376 | dummy = new QHBox(topFrame); | 376 | dummy = new QHBox(topFrame); |
377 | new QLabel(i18n("Days in What's Next:"),dummy); | 377 | new QLabel(i18n("Days in What's Next:"),dummy); |
378 | mWhatsNextSpin = new QSpinBox(1,14,1,dummy); | 378 | mWhatsNextSpin = new QSpinBox(1,14,1,dummy); |
379 | 379 | ||
380 | topLayout->addMultiCellWidget(dummy,3,3,0,1); | 380 | topLayout->addMultiCellWidget(dummy,3,3,0,1); |
381 | 381 | ||
382 | 382 | ||
383 | 383 | ||
384 | dummy = new QHBox(topFrame); | 384 | dummy = new QHBox(topFrame); |
385 | new QLabel(i18n("Days in Next-X-Days:"),dummy); | 385 | new QLabel(i18n("Days in Next-X-Days:"),dummy); |
386 | mNextXDaysSpin = new QSpinBox(2,14,1,dummy); | 386 | mNextXDaysSpin = new QSpinBox(2,14,1,dummy); |
387 | 387 | ||
388 | topLayout->addMultiCellWidget(dummy,4,4,0,1); | 388 | topLayout->addMultiCellWidget(dummy,4,4,0,1); |
389 | 389 | ||
390 | QHBox *prioBox = new QHBox(topFrame); | 390 | QHBox *prioBox = new QHBox(topFrame); |
391 | // intervalBox->setSpacing(spacingHint()); | 391 | // intervalBox->setSpacing(spacingHint()); |
392 | topLayout->addMultiCellWidget(prioBox,5,5,0,1); | 392 | topLayout->addMultiCellWidget(prioBox,5,5,0,1); |
393 | QString messa = i18n("Show topmost todo prios in What's Next:"); | 393 | QString messa = i18n("Show topmost todo prios in What's Next:"); |
394 | 394 | ||
395 | if ( QApplication::desktop()->width() < 300 ) | 395 | if ( QApplication::desktop()->width() < 300 ) |
396 | messa = i18n("Show topmost todo prios in What's N.:"); | 396 | messa = i18n("Show topmost todo prios in What's N.:"); |
397 | QLabel *prioLabel = new QLabel(messa, prioBox); | 397 | QLabel *prioLabel = new QLabel(messa, prioBox); |
398 | mPrioSpin = new QSpinBox(0,5,1,prioBox); | 398 | mPrioSpin = new QSpinBox(0,5,1,prioBox); |
399 | if ( QApplication::desktop()->width() < 300 ) | 399 | if ( QApplication::desktop()->width() < 300 ) |
400 | mPrioSpin->setFixedWidth( 40 ); | 400 | mPrioSpin->setFixedWidth( 40 ); |
401 | 401 | ||
402 | // KPrefsDialogWidBool *bcc = | 402 | // KPrefsDialogWidBool *bcc = |
403 | // addWidBool(i18n("Send copy to owner when mailing events"), | 403 | // addWidBool(i18n("Send copy to owner when mailing events"), |
404 | // &(KOPrefs::instance()->mBcc),topFrame); | 404 | // &(KOPrefs::instance()->mBcc),topFrame); |
405 | // topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); | 405 | // topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); |
406 | 406 | ||
407 | 407 | ||
408 | // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); | 408 | // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); |
409 | //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); | 409 | //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); |
410 | 410 | ||
411 | // addWidBool(i18n("Enable automatic saving of calendar"), | 411 | // addWidBool(i18n("Enable automatic saving of calendar"), |
412 | // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); | 412 | // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); |
413 | 413 | ||
414 | QHBox *intervalBox = new QHBox(topFrame); | 414 | QHBox *intervalBox = new QHBox(topFrame); |
415 | // intervalBox->setSpacing(spacingHint()); | 415 | // intervalBox->setSpacing(spacingHint()); |
416 | topLayout->addMultiCellWidget(intervalBox,6,6,0,1); | 416 | topLayout->addMultiCellWidget(intervalBox,6,6,0,1); |
417 | QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); | 417 | QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); |
418 | mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); | 418 | mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); |
419 | autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); | 419 | autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); |
420 | /* | 420 | /* |
421 | QHBox * agendasize = new QHBox ( topFrame ); | 421 | QHBox * agendasize = new QHBox ( topFrame ); |
422 | 422 | ||
423 | new QLabel (i18n("AllDayAgenda Height:"), agendasize ); | 423 | new QLabel (i18n("AllDayAgenda Height:"), agendasize ); |
424 | 424 | ||
425 | 425 | ||
426 | mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); | 426 | mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); |
427 | topLayout->addMultiCellWidget(agendasize,7,7,0,1); | 427 | topLayout->addMultiCellWidget(agendasize,7,7,0,1); |
428 | */ | 428 | */ |
429 | KPrefsDialogWidBool *verticalScreen = | 429 | KPrefsDialogWidBool *verticalScreen = |
430 | addWidBool(i18n("Show vertical screen (Needs restart)"), | 430 | addWidBool(i18n("Show vertical screen (Needs restart)"), |
431 | &(KOPrefs::instance()->mVerticalScreen),topFrame); | 431 | &(KOPrefs::instance()->mVerticalScreen),topFrame); |
432 | //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); | 432 | //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); |
433 | topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1); | 433 | topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1); |
434 | 434 | ||
435 | KPrefsDialogWidBool *ask = | 435 | KPrefsDialogWidBool *ask = |
436 | addWidBool(i18n("Ask for quit when closing KO/Pi"), | 436 | addWidBool(i18n("Ask for quit when closing KO/Pi"), |
437 | &(KOPrefs::instance()->mAskForQuit),topFrame); | 437 | &(KOPrefs::instance()->mAskForQuit),topFrame); |
438 | topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1); | 438 | topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1); |
439 | 439 | ||
440 | 440 | ||
441 | /* | 441 | /* |
442 | KPrefsDialogWidBool *confirmCheck = | 442 | KPrefsDialogWidBool *confirmCheck = |
443 | addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), | 443 | addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), |
444 | topFrame); | 444 | topFrame); |
445 | topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); | 445 | topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); |
446 | 446 | ||
447 | 447 | ||
448 | mEnableGroupScheduling = | 448 | mEnableGroupScheduling = |
449 | addWidBool(i18n("Enable group scheduling"), | 449 | addWidBool(i18n("Enable group scheduling"), |
450 | &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); | 450 | &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); |
451 | topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); | 451 | topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); |
452 | connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), | 452 | connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), |
453 | SLOT(warningGroupScheduling())); | 453 | SLOT(warningGroupScheduling())); |
454 | 454 | ||
455 | mEnableProjectView = | 455 | mEnableProjectView = |
456 | addWidBool(i18n("Enable project view"), | 456 | addWidBool(i18n("Enable project view"), |
457 | &(KOPrefs::instance()->mEnableProjectView),topFrame); | 457 | &(KOPrefs::instance()->mEnableProjectView),topFrame); |
458 | topLayout->addWidget(mEnableProjectView->checkBox(),9,0); | 458 | topLayout->addWidget(mEnableProjectView->checkBox(),9,0); |
459 | connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), | 459 | connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), |
460 | SLOT(warningProjectView())); | 460 | SLOT(warningProjectView())); |
461 | 461 | ||
462 | // Can't be disabled anymore | 462 | // Can't be disabled anymore |
463 | mEnableGroupScheduling->checkBox()->hide(); | 463 | mEnableGroupScheduling->checkBox()->hide(); |
464 | 464 | ||
465 | // Disable setting, because this feature now becomes stable | 465 | // Disable setting, because this feature now becomes stable |
466 | mEnableProjectView->checkBox()->hide(); | 466 | mEnableProjectView->checkBox()->hide(); |
467 | 467 | ||
468 | KPrefsDialogWidRadios *defaultFormatGroup = | 468 | KPrefsDialogWidRadios *defaultFormatGroup = |
469 | addWidRadios(i18n("Default Calendar Format"), | 469 | addWidRadios(i18n("Default Calendar Format"), |
470 | &(KOPrefs::instance()->mDefaultFormat),topFrame); | 470 | &(KOPrefs::instance()->mDefaultFormat),topFrame); |
471 | defaultFormatGroup->addRadio(i18n("vCalendar")); | 471 | defaultFormatGroup->addRadio(i18n("vCalendar")); |
472 | defaultFormatGroup->addRadio(i18n("iCalendar")); | 472 | defaultFormatGroup->addRadio(i18n("iCalendar")); |
473 | 473 | ||
474 | topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); | 474 | topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); |
475 | 475 | ||
476 | // Default format unconditionally is iCalendar | 476 | // Default format unconditionally is iCalendar |
477 | defaultFormatGroup->groupBox()->hide(); | 477 | defaultFormatGroup->groupBox()->hide(); |
478 | 478 | ||
479 | KPrefsDialogWidRadios *mailClientGroup = | 479 | KPrefsDialogWidRadios *mailClientGroup = |
480 | addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), | 480 | addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), |
481 | topFrame); | 481 | topFrame); |
482 | mailClientGroup->addRadio(i18n("KMail")); | 482 | mailClientGroup->addRadio(i18n("KMail")); |
483 | mailClientGroup->addRadio(i18n("Sendmail")); | 483 | mailClientGroup->addRadio(i18n("Sendmail")); |
484 | topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); | 484 | topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); |
485 | 485 | ||
486 | KPrefsDialogWidBool *htmlsave = | 486 | KPrefsDialogWidBool *htmlsave = |
487 | addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), | 487 | addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), |
488 | topFrame); | 488 | topFrame); |
489 | topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); | 489 | topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); |
490 | 490 | ||
491 | KPrefsDialogWidRadios *destinationGroup = | 491 | KPrefsDialogWidRadios *destinationGroup = |
492 | addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), | 492 | addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), |
493 | topFrame); | 493 | topFrame); |
494 | destinationGroup->addRadio(i18n("be added to the standard resource")); | 494 | destinationGroup->addRadio(i18n("be added to the standard resource")); |
495 | destinationGroup->addRadio(i18n("be asked which resource to use")); | 495 | destinationGroup->addRadio(i18n("be asked which resource to use")); |
496 | topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); | 496 | topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); |
497 | 497 | ||
498 | topLayout->setRowStretch(14,1); | 498 | topLayout->setRowStretch(14,1); |
499 | */ | 499 | */ |
500 | } | 500 | } |
501 | 501 | ||
502 | 502 | ||
503 | void KOPrefsDialog::setupTimeTab() | 503 | void KOPrefsDialog::setupTimeTab() |
504 | { | 504 | { |
505 | QFrame *topFrame = addPage(i18n("Time"),0,0); | 505 | QFrame *topFrame = addPage(i18n("Time"),0,0); |
506 | // DesktopIcon("clock",KIcon::SizeMedium)); | 506 | // DesktopIcon("clock",KIcon::SizeMedium)); |
507 | 507 | ||
508 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 508 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); |
509 | topLayout->setSpacing(spacingHint()); | 509 | topLayout->setSpacing(spacingHint()); |
510 | topLayout->setMargin(marginHint()); | 510 | topLayout->setMargin(marginHint()); |
511 | 511 | ||
512 | QHBox *dummy = new QHBox(topFrame); | 512 | QHBox *dummy = new QHBox(topFrame); |
513 | KPrefsDialogWidTime *dayBegins = | 513 | KPrefsDialogWidTime *dayBegins = |
514 | addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), | 514 | addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), |
515 | dummy); | 515 | dummy); |
516 | //topLayout->addWidget(dayBegins->label(),2,0); | 516 | //topLayout->addWidget(dayBegins->label(),2,0); |
517 | 517 | ||
518 | //topLayout->addWidget(dayBegins->spinBox(),2,1); | 518 | //topLayout->addWidget(dayBegins->spinBox(),2,1); |
519 | topLayout->addMultiCellWidget(dummy,0,0,0,1); | 519 | topLayout->addMultiCellWidget(dummy,0,0,0,1); |
520 | 520 | ||
521 | topLayout->addWidget(new QLabel(i18n("Default appointment time:"), | 521 | topLayout->addWidget(new QLabel(i18n("Default appointment time:"), |
522 | topFrame),1,0); | 522 | topFrame),1,0); |
523 | mStartTimeSpin = new QSpinBox(0,23,1,topFrame); | 523 | mStartTimeSpin = new QSpinBox(0,23,1,topFrame); |
524 | mStartTimeSpin->setSuffix(":00"); | 524 | mStartTimeSpin->setSuffix(":00"); |
525 | topLayout->addWidget(mStartTimeSpin,1,1); | 525 | topLayout->addWidget(mStartTimeSpin,1,1); |
526 | 526 | ||
527 | topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), | 527 | topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), |
528 | topFrame),2,0); | 528 | topFrame),2,0); |
529 | mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); | 529 | mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); |
530 | mDefaultDurationSpin->setSuffix(":00"); | 530 | mDefaultDurationSpin->setSuffix(":00"); |
531 | topLayout->addWidget(mDefaultDurationSpin,2,1); | 531 | topLayout->addWidget(mDefaultDurationSpin,2,1); |
532 | 532 | ||
533 | QStringList alarmList; | 533 | QStringList alarmList; |
534 | alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") | 534 | alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") |
535 | << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; | 535 | << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; |
536 | topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), | 536 | topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), |
537 | 3,0); | 537 | 3,0); |
538 | mAlarmTimeCombo = new QComboBox(topFrame); | 538 | mAlarmTimeCombo = new QComboBox(topFrame); |
539 | mAlarmTimeCombo->insertStringList(alarmList); | 539 | mAlarmTimeCombo->insertStringList(alarmList); |
540 | topLayout->addWidget(mAlarmTimeCombo,3,1); | 540 | topLayout->addWidget(mAlarmTimeCombo,3,1); |
541 | 541 | ||
542 | 542 | ||
543 | QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, | 543 | QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, |
544 | i18n("Working Hours"), | 544 | i18n("Working Hours"), |
545 | topFrame); | 545 | topFrame); |
546 | topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); | 546 | topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); |
547 | workingHoursGroup->layout()->setSpacing( 0 ); | 547 | workingHoursGroup->layout()->setSpacing( 0 ); |
548 | workingHoursGroup->layout()->setMargin( 4 ); | 548 | workingHoursGroup->layout()->setMargin( 4 ); |
549 | QHBox *workStartBox = new QHBox(workingHoursGroup); | 549 | QHBox *workStartBox = new QHBox(workingHoursGroup); |
550 | // workStartBox->setMargin( 0 ); | 550 | // workStartBox->setMargin( 0 ); |
551 | addWidTime(i18n("Daily starting hour:"), | 551 | addWidTime(i18n("Daily starting hour:"), |
552 | &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); | 552 | &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); |
553 | 553 | ||
554 | QHBox *workEndBox = new QHBox(workingHoursGroup); | 554 | QHBox *workEndBox = new QHBox(workingHoursGroup); |
555 | //workEndBox->setMargin( 0 ); | 555 | //workEndBox->setMargin( 0 ); |
556 | addWidTime(i18n("Daily ending hour:"), | 556 | addWidTime(i18n("Daily ending hour:"), |
557 | &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); | 557 | &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); |
558 | QVBox *excludeBox = new QVBox(workingHoursGroup); | 558 | QVBox *excludeBox = new QVBox(workingHoursGroup); |
559 | //excludeBox->setMargin( 0 ); | 559 | //excludeBox->setMargin( 0 ); |
560 | addWidBool(i18n("Exclude holidays"), | 560 | addWidBool(i18n("Exclude holidays"), |
561 | &(KOPrefs::instance()->mExcludeHolidays),excludeBox); | 561 | &(KOPrefs::instance()->mExcludeHolidays),excludeBox); |
562 | 562 | ||
563 | addWidBool(i18n("Exclude Saturdays"), | 563 | addWidBool(i18n("Exclude Saturdays"), |
564 | &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); | 564 | &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); |
565 | 565 | ||
566 | // KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), | 566 | // KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), |
567 | // &(KOPrefs::instance()->mMarcusBainsShowSeconds), | 567 | // &(KOPrefs::instance()->mMarcusBainsShowSeconds), |
568 | // topFrame); | 568 | // topFrame); |
569 | // topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); | 569 | // topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); |
570 | 570 | ||
571 | // topLayout->setRowStretch(6,1); | 571 | // topLayout->setRowStretch(6,1); |
572 | } | 572 | } |
573 | 573 | ||
574 | 574 | ||
575 | void KOPrefsDialog::setupViewsTab() | 575 | void KOPrefsDialog::setupViewsTab() |
576 | { | 576 | { |
577 | 577 | ||
578 | QFrame *topFrame = addPage(i18n("Views"),0,0); | 578 | QFrame *topFrame = addPage(i18n("Views"),0,0); |
579 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 579 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
580 | 580 | ||
581 | QGridLayout *topLayout = new QGridLayout(topFrame,6,1); | 581 | QGridLayout *topLayout = new QGridLayout(topFrame,6,1); |
582 | topLayout->setSpacing(spacingHint()); | 582 | topLayout->setSpacing(spacingHint()); |
583 | topLayout->setMargin(marginHint()); | 583 | topLayout->setMargin(marginHint()); |
584 | 584 | ||
585 | // QBoxLayout *dayBeginsLayout = new QHBoxLayout; | 585 | // QBoxLayout *dayBeginsLayout = new QHBoxLayout; |
586 | // topLayout->addLayout(dayBeginsLayout,0,0); | 586 | // topLayout->addLayout(dayBeginsLayout,0,0); |
587 | 587 | ||
588 | // KPrefsDialogWidTime *dayBegins = | 588 | // KPrefsDialogWidTime *dayBegins = |
589 | // addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), | 589 | // addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), |
590 | // topFrame); | 590 | // topFrame); |
591 | // dayBeginsLayout->addWidget(dayBegins->label()); | 591 | // dayBeginsLayout->addWidget(dayBegins->label()); |
592 | // dayBeginsLayout->addStretch(1); | 592 | // dayBeginsLayout->addStretch(1); |
593 | // dayBeginsLayout->addWidget(dayBegins->spinBox()); | 593 | // dayBeginsLayout->addWidget(dayBegins->spinBox()); |
594 | 594 | ||
595 | // QBoxLayout *nextDaysLayout = new QHBoxLayout; | 595 | // QBoxLayout *nextDaysLayout = new QHBoxLayout; |
596 | // topLayout->addLayout(nextDaysLayout,1,0); | 596 | // topLayout->addLayout(nextDaysLayout,1,0); |
597 | // nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); | 597 | // nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); |
598 | // mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); | 598 | // mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); |
599 | // nextDaysLayout->addStretch(1); | 599 | // nextDaysLayout->addStretch(1); |
600 | // nextDaysLayout->addWidget(mNextXDaysSpin); | 600 | // nextDaysLayout->addWidget(mNextXDaysSpin); |
601 | 601 | ||
602 | 602 | ||
603 | int ii = 0; | 603 | int ii = 0; |
604 | KPrefsDialogWidBool *dummy = | 604 | KPrefsDialogWidBool *dummy = |
605 | addWidBool(i18n("Edit item on doubleclick (if not, show)"), | 605 | addWidBool(i18n("Edit item on doubleclick (if not, show)"), |
606 | &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); | 606 | &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); |
607 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 607 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
608 | 608 | ||
609 | dummy = | 609 | dummy = |
610 | addWidBool(i18n("Show time in agenda items"), | 610 | addWidBool(i18n("Show time in agenda items"), |
611 | &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); | 611 | &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); |
612 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 612 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
613 | 613 | ||
614 | dummy = | 614 | dummy = |
615 | addWidBool(i18n("Highlight current day in agenda"), | 615 | addWidBool(i18n("Highlight current day in agenda"), |
616 | &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); | 616 | &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); |
617 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 617 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
618 | 618 | ||
619 | dummy = | 619 | dummy = |
620 | addWidBool(i18n("Use light color for highlight current day"), | 620 | addWidBool(i18n("Use light color for highlight current day"), |
621 | &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); | 621 | &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); |
622 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 622 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
623 | 623 | ||
624 | KPrefsDialogWidBool *dailyRecur = | 624 | KPrefsDialogWidBool *dailyRecur = |
625 | addWidBool(i18n("Show events that recur daily in date nav."), | 625 | addWidBool(i18n("Show events that recur daily in date nav."), |
626 | &(KOPrefs::instance()->mDailyRecur),topFrame); | 626 | &(KOPrefs::instance()->mDailyRecur),topFrame); |
627 | topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | 627 | topLayout->addWidget(dailyRecur->checkBox(),ii++,0); |
628 | 628 | ||
629 | KPrefsDialogWidBool *weeklyRecur = | 629 | KPrefsDialogWidBool *weeklyRecur = |
630 | addWidBool(i18n("Show ev. that recur weekly in date nav."), | 630 | addWidBool(i18n("Show ev. that recur weekly in date nav."), |
631 | &(KOPrefs::instance()->mWeeklyRecur),topFrame); | 631 | &(KOPrefs::instance()->mWeeklyRecur),topFrame); |
632 | topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); | 632 | topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); |
633 | if ( QApplication::desktop()->width() > 640 ) { | 633 | if ( QApplication::desktop()->width() > 640 ) { |
634 | 634 | ||
635 | KPrefsDialogWidBool *enableToolTips = | 635 | KPrefsDialogWidBool *enableToolTips = |
636 | addWidBool(i18n("Enable tooltips displaying summary of ev."), | 636 | addWidBool(i18n("Enable tooltips displaying summary of ev."), |
637 | &(KOPrefs::instance()->mEnableToolTips),topFrame); | 637 | &(KOPrefs::instance()->mEnableToolTips),topFrame); |
638 | topLayout->addWidget(enableToolTips->checkBox(),ii++,0); | 638 | topLayout->addWidget(enableToolTips->checkBox(),ii++,0); |
639 | 639 | ||
640 | } | 640 | } |
641 | 641 | ||
642 | KPrefsDialogWidBool *marcusBainsEnabled = | 642 | KPrefsDialogWidBool *marcusBainsEnabled = |
643 | addWidBool(i18n("Show Marcus Bains line"), | 643 | addWidBool(i18n("Show Marcus Bains line"), |
644 | &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); | 644 | &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); |
645 | topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); | 645 | topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); |
646 | 646 | ||
647 | 647 | ||
648 | // topLayout->addWidget(hourSizeGroup,ii++,0); | 648 | // topLayout->addWidget(hourSizeGroup,ii++,0); |
649 | // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); | 649 | // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); |
650 | //topLayout->setRowStretch(11,1); | 650 | //topLayout->setRowStretch(11,1); |
651 | 651 | ||
652 | 652 | ||
653 | 653 | ||
654 | 654 | ||
655 | 655 | ||
656 | 656 | ||
657 | topFrame = addPage(i18n("ViewChange"),0,0); | 657 | topFrame = addPage(i18n("ViewChange"),0,0); |
658 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 658 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
659 | 659 | ||
660 | topLayout = new QGridLayout(topFrame,6,1); | 660 | topLayout = new QGridLayout(topFrame,6,1); |
661 | topLayout->setSpacing(spacingHint()); | 661 | topLayout->setSpacing(spacingHint()); |
662 | topLayout->setMargin(marginHint()); | 662 | topLayout->setMargin(marginHint()); |
663 | ii = 0; | 663 | ii = 0; |
664 | 664 | ||
665 | 665 | ||
666 | dummy = | 666 | dummy = |
667 | addWidBool(i18n("Hold fullscreen on view change"), | 667 | addWidBool(i18n("Hold fullscreen on view change"), |
668 | &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); | 668 | &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); |
669 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 669 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
670 | 670 | ||
671 | dummy = | 671 | dummy = |
672 | addWidBool(i18n("Hold non-fullscreen on view change"), | 672 | addWidBool(i18n("Hold non-fullscreen on view change"), |
673 | &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); | 673 | &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); |
674 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 674 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
675 | 675 | ||
676 | 676 | ||
677 | KPrefsDialogWidBool *fullViewTodo = | 677 | KPrefsDialogWidBool *fullViewTodo = |
678 | addWidBool(i18n("Event list view uses full window"), | 678 | addWidBool(i18n("Event list view uses full window"), |
679 | &(KOPrefs::instance()->mFullViewTodo),topFrame); | 679 | &(KOPrefs::instance()->mFullViewTodo),topFrame); |
680 | topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); | 680 | topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); |
681 | 681 | ||
682 | KPrefsDialogWidBool *fullViewMonth = | 682 | KPrefsDialogWidBool *fullViewMonth = |
683 | addWidBool(i18n("Next days view uses full window"), | 683 | addWidBool(i18n("Next days view uses full window"), |
684 | &(KOPrefs::instance()->mFullViewMonth),topFrame); | 684 | &(KOPrefs::instance()->mFullViewMonth),topFrame); |
685 | topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); | 685 | topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); |
686 | 686 | ||
687 | dummy = | 687 | dummy = |
688 | addWidBool(i18n("Set agenda to DayBeginsAt on change"), | 688 | addWidBool(i18n("Set agenda to DayBeginsAt on change"), |
689 | &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); | 689 | &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); |
690 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 690 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
691 | 691 | ||
692 | dummy = | 692 | dummy = |
693 | addWidBool(i18n("Set agenda to current time on change"), | 693 | addWidBool(i18n("Set agenda to current time on change"), |
694 | &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); | 694 | &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); |
695 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 695 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
696 | 696 | ||
697 | dummy = | 697 | dummy = |
698 | addWidBool(i18n("Listview uses monthly timespan"), | 698 | addWidBool(i18n("Listview uses monthly timespan"), |
699 | &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); | 699 | &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); |
700 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 700 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
701 | dummy = | 701 | dummy = |
702 | addWidBool(i18n("Highlight selection in Time Edit"), | 702 | addWidBool(i18n("Highlight selection in Time Edit"), |
703 | &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); | 703 | &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); |
704 | topLayout->addWidget( dummy->checkBox(), ii++,0); | 704 | topLayout->addWidget( dummy->checkBox(), ii++,0); |
705 | 705 | ||
706 | 706 | ||
707 | 707 | ||
708 | 708 | ||
709 | 709 | ||
710 | topFrame = addPage(i18n("Month View"),0,0); | 710 | topFrame = addPage(i18n("Month View"),0,0); |
711 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 711 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
712 | 712 | ||
713 | topLayout = new QGridLayout(topFrame,5,1); | 713 | topLayout = new QGridLayout(topFrame,5,1); |
714 | topLayout->setSpacing(spacingHint()); | 714 | topLayout->setSpacing(spacingHint()); |
715 | topLayout->setMargin(marginHint()); | 715 | topLayout->setMargin(marginHint()); |
716 | ii = 0; | 716 | ii = 0; |
717 | QLabel *lab; | 717 | QLabel *lab; |
718 | QHBox *habo = new QHBox( topFrame ); | 718 | QHBox *habo = new QHBox( topFrame ); |
719 | if ( QApplication::desktop()->width() <= 480 ) { | 719 | if ( QApplication::desktop()->width() <= 480 ) { |
720 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); | 720 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); |
721 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | 721 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); |
722 | ii++; | 722 | ii++; |
723 | } else { | 723 | } else { |
724 | new QLabel ( i18n("Show events that recur "), habo ); | 724 | new QLabel ( i18n("Show events that recur "), habo ); |
725 | } | 725 | } |
726 | dailyRecur = | 726 | dailyRecur = |
727 | addWidBool(i18n("daily"), | 727 | addWidBool(i18n("daily"), |
728 | &(KOPrefs::instance()->mMonthDailyRecur),habo); | 728 | &(KOPrefs::instance()->mMonthDailyRecur),habo); |
729 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | 729 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); |
730 | 730 | ||
731 | weeklyRecur = | 731 | weeklyRecur = |
732 | addWidBool(i18n("weekly"), | 732 | addWidBool(i18n("weekly"), |
733 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); | 733 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); |
734 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | 734 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); |
735 | ii++; | 735 | ii++; |
736 | 736 | ||
737 | 737 | ||
738 | habo = new QHBox( topFrame ); | 738 | habo = new QHBox( topFrame ); |
739 | if ( QApplication::desktop()->width() <= 480 ) { | 739 | if ( QApplication::desktop()->width() <= 480 ) { |
740 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); | 740 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); |
741 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | 741 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); |
742 | ii++; | 742 | ii++; |
743 | 743 | ||
744 | } else { | 744 | } else { |
745 | new QLabel ( i18n("Show in every cell "), habo ); | 745 | new QLabel ( i18n("Show in every cell "), habo ); |
746 | } | 746 | } |
747 | weeklyRecur = | 747 | weeklyRecur = |
748 | addWidBool(i18n("short month"), | 748 | addWidBool(i18n("short month"), |
749 | &(KOPrefs::instance()->mMonthShowShort),habo); | 749 | &(KOPrefs::instance()->mMonthShowShort),habo); |
750 | weeklyRecur = | 750 | weeklyRecur = |
751 | addWidBool(i18n("icons"), | 751 | addWidBool(i18n("icons"), |
752 | &(KOPrefs::instance()->mMonthShowIcons),habo); | 752 | &(KOPrefs::instance()->mMonthShowIcons),habo); |
753 | 753 | ||
754 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | 754 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); |
755 | ii++; | 755 | ii++; |
756 | #ifdef DESKTOP_VERSION | 756 | #ifdef DESKTOP_VERSION |
757 | KPrefsDialogWidBool *enableMonthScroll = | 757 | KPrefsDialogWidBool *enableMonthScroll = |
758 | addWidBool(i18n("Enable scrollbars in month view cells"), | 758 | addWidBool(i18n("Enable scrollbars in month view cells"), |
759 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); | 759 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); |
760 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); | 760 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); |
761 | #endif | 761 | #endif |
762 | dummy = | 762 | dummy = |
763 | addWidBool(i18n("Week view mode uses bigger font"), | 763 | addWidBool(i18n("Week view mode uses bigger font"), |
764 | &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); | 764 | &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); |
765 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 765 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
766 | dummy = | 766 | dummy = |
767 | addWidBool(i18n("Show Sat/Sun together"), | 767 | addWidBool(i18n("Show Sat/Sun together"), |
768 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); | 768 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); |
769 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 769 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
770 | 770 | ||
771 | KPrefsDialogWidBool *coloredCategoriesInMonthView = | 771 | KPrefsDialogWidBool *coloredCategoriesInMonthView = |
772 | addWidBool(i18n("Month view uses category colors"), | 772 | addWidBool(i18n("Month view uses category colors"), |
773 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); | 773 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); |
774 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 774 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
775 | 775 | ||
776 | dummy = | 776 | dummy = |
777 | addWidBool(i18n("Categorie colors are applied to text"), | 777 | addWidBool(i18n("Categorie colors are applied to text"), |
778 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); | 778 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); |
779 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 779 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
780 | coloredCategoriesInMonthView = | 780 | coloredCategoriesInMonthView = |
781 | addWidBool(i18n("Month view uses day colors"), | 781 | addWidBool(i18n("Month view uses day colors"), |
782 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); | 782 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); |
783 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 783 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
784 | 784 | ||
785 | KPrefsDialogWidColor *holidayColor = | 785 | KPrefsDialogWidColor *holidayColor = |
786 | addWidColor(i18n("Day color odd months"), | 786 | addWidColor(i18n("Day color odd months"), |
787 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); | 787 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); |
788 | topLayout->addWidget(holidayColor->label(),ii,0); | 788 | topLayout->addWidget(holidayColor->label(),ii,0); |
789 | topLayout->addWidget(holidayColor->button(),ii++,1); | 789 | topLayout->addWidget(holidayColor->button(),ii++,1); |
790 | 790 | ||
791 | holidayColor = | 791 | holidayColor = |
792 | addWidColor(i18n("Day color even months"), | 792 | addWidColor(i18n("Day color even months"), |
793 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); | 793 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); |
794 | topLayout->addWidget(holidayColor->label(),ii,0); | 794 | topLayout->addWidget(holidayColor->label(),ii,0); |
795 | topLayout->addWidget(holidayColor->button(),ii++,1); | 795 | topLayout->addWidget(holidayColor->button(),ii++,1); |
796 | 796 | ||
797 | 797 | ||
798 | holidayColor = | 798 | holidayColor = |
799 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), | 799 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), |
800 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); | 800 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); |
801 | topLayout->addWidget(holidayColor->label(),ii,0); | 801 | topLayout->addWidget(holidayColor->label(),ii,0); |
802 | topLayout->addWidget(holidayColor->button(),ii++,1); | 802 | topLayout->addWidget(holidayColor->button(),ii++,1); |
803 | // *********************** What'sNext View | 803 | // *********************** What'sNext View |
804 | topFrame = addPage(i18n("What's Next View"),0,0); | 804 | topFrame = addPage(i18n("What's Next View"),0,0); |
805 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 805 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
806 | 806 | ||
807 | topLayout = new QGridLayout(topFrame,4,1); | 807 | topLayout = new QGridLayout(topFrame,4,1); |
808 | topLayout->setSpacing(spacingHint()); | 808 | topLayout->setSpacing(spacingHint()); |
809 | topLayout->setMargin(marginHint()); | 809 | topLayout->setMargin(marginHint()); |
810 | ii = 0; | 810 | ii = 0; |
811 | KPrefsDialogWidBool *passwdk = | 811 | KPrefsDialogWidBool *passwdk = |
812 | 812 | ||
813 | addWidBool(i18n("Show events, that are done in \nWhat's Next view"), | 813 | addWidBool(i18n("Show events, that are done in \nWhat's Next view"), |
814 | &(KOPrefs::instance()->mWNViewShowsPast),topFrame); | 814 | &(KOPrefs::instance()->mWNViewShowsPast),topFrame); |
815 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 815 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
816 | passwdk = | 816 | passwdk = |
817 | addWidBool(i18n("Show parent To-Do's in What's Next view"), | 817 | addWidBool(i18n("Show parent To-Do's in What's Next view"), |
818 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); | 818 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); |
819 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 819 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
820 | 820 | ||
821 | passwdk = | 821 | passwdk = |
822 | addWidBool(i18n("Show location in What's Next view"), | 822 | addWidBool(i18n("Show location in What's Next view"), |
823 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); | 823 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); |
824 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 824 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
825 | 825 | ||
826 | passwdk = | 826 | passwdk = |
827 | addWidBool(i18n("Show Sync Events in \nWhat's Next/Agenda view"), | 827 | addWidBool(i18n("Show Sync Events in \nWhat's Next/Agenda view"), |
828 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); | 828 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); |
829 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 829 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
830 | passwdk = | 830 | passwdk = |
831 | addWidBool(i18n("Use short date in \nWhat's Next/Event view"), | 831 | addWidBool(i18n("Use short date in \nWhat's Next/Event view"), |
832 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); | 832 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); |
833 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 833 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
834 | 834 | ||
835 | 835 | ||
836 | 836 | ||
837 | 837 | ||
838 | // *********************** Todo View | 838 | // *********************** Todo View |
839 | 839 | ||
840 | topFrame = addPage(i18n("Todo View"),0,0); | 840 | topFrame = addPage(i18n("Todo View"),0,0); |
841 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 841 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
842 | 842 | ||
843 | topLayout = new QGridLayout(topFrame,4,1); | 843 | topLayout = new QGridLayout(topFrame,4,1); |
844 | topLayout->setSpacing(spacingHint()); | 844 | topLayout->setSpacing(spacingHint()); |
845 | topLayout->setMargin(marginHint()); | 845 | topLayout->setMargin(marginHint()); |
846 | ii = 0; | 846 | ii = 0; |
847 | dummy = | 847 | dummy = |
848 | addWidBool(i18n("Hide not running Todos in To-do view"), | 848 | addWidBool(i18n("Hide not running Todos in To-do view"), |
849 | &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); | 849 | &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); |
850 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 850 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
851 | 851 | ||
852 | 852 | ||
853 | KPrefsDialogWidBool *showCompletedTodo = | 853 | KPrefsDialogWidBool *showCompletedTodo = |
854 | addWidBool(i18n("To-do view shows completed Todos"), | 854 | addWidBool(i18n("To-do view shows completed Todos"), |
855 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); | 855 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); |
856 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); | 856 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); |
857 | dummy = | 857 | dummy = |
858 | addWidBool(i18n("To-do view shows complete as 'xx %'"), | 858 | addWidBool(i18n("To-do view shows complete as 'xx %'"), |
859 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); | 859 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); |
860 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 860 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
861 | 861 | ||
862 | dummy = | 862 | dummy = |
863 | addWidBool(i18n("Small To-do view uses smaller font"), | 863 | addWidBool(i18n("Small To-do view uses smaller font"), |
864 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); | 864 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); |
865 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 865 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
866 | 866 | ||
867 | 867 | ||
868 | 868 | ||
869 | dummy = | 869 | dummy = |
870 | addWidBool(i18n("Todo view uses category colors"), | 870 | addWidBool(i18n("Todo view uses category colors"), |
871 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); | 871 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); |
872 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 872 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
873 | 873 | ||
874 | 874 | ||
875 | QWidget* wid = new QWidget( topFrame ); | 875 | QWidget* wid = new QWidget( topFrame ); |
876 | // Todo due today color | 876 | // Todo due today color |
877 | KPrefsDialogWidColor *todoDueTodayColor = | 877 | KPrefsDialogWidColor *todoDueTodayColor = |
878 | addWidColor(i18n("Todo due today color:"), | 878 | addWidColor(i18n("Todo due today color:"), |
879 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); | 879 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); |
880 | QHBoxLayout *widLayout = new QHBoxLayout(wid); | 880 | QHBoxLayout *widLayout = new QHBoxLayout(wid); |
881 | widLayout->addWidget( todoDueTodayColor->label() ); | 881 | widLayout->addWidget( todoDueTodayColor->label() ); |
882 | widLayout->addWidget( todoDueTodayColor->button() ); | 882 | widLayout->addWidget( todoDueTodayColor->button() ); |
883 | topLayout->addWidget(wid,ii++,0); | 883 | topLayout->addWidget(wid,ii++,0); |
884 | //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); | 884 | //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); |
885 | 885 | ||
886 | // Todo overdue color | 886 | // Todo overdue color |
887 | wid = new QWidget( topFrame ); | 887 | wid = new QWidget( topFrame ); |
888 | widLayout = new QHBoxLayout(wid); | 888 | widLayout = new QHBoxLayout(wid); |
889 | KPrefsDialogWidColor *todoOverdueColor = | 889 | KPrefsDialogWidColor *todoOverdueColor = |
890 | addWidColor(i18n("Todo overdue color:"), | 890 | addWidColor(i18n("Todo overdue color:"), |
891 | &(KOPrefs::instance()->mTodoOverdueColor),wid); | 891 | &(KOPrefs::instance()->mTodoOverdueColor),wid); |
892 | widLayout->addWidget(todoOverdueColor->label()); | 892 | widLayout->addWidget(todoOverdueColor->label()); |
893 | widLayout->addWidget(todoOverdueColor->button()); | 893 | widLayout->addWidget(todoOverdueColor->button()); |
894 | topLayout->addWidget(wid,ii++,0); | 894 | topLayout->addWidget(wid,ii++,0); |
895 | 895 | ||
896 | dummy = | 896 | dummy = |
897 | addWidBool(i18n("Colors are applied to text"), | 897 | addWidBool(i18n("Colors are applied to text"), |
898 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); | 898 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); |
899 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 899 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
900 | 900 | ||
901 | dummy = | 901 | dummy = |
902 | addWidBool(i18n("Allday Agenda view shows todos"), | 902 | addWidBool(i18n("Allday Agenda view shows todos"), |
903 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); | 903 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); |
904 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 904 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
905 | 905 | ||
906 | 906 | ||
907 | topFrame = addPage(i18n("View Options"),0,0); | ||
908 | |||
909 | topLayout = new QGridLayout(topFrame,4,1); | ||
910 | topLayout->setSpacing(spacingHint()); | ||
911 | topLayout->setMargin(marginHint()); | ||
912 | ii = 0; | ||
913 | lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); | ||
914 | topLayout->addWidget(lab ,ii++,0); | ||
915 | |||
916 | dummy = addWidBool(i18n("Details"), | ||
917 | &(KOPrefs::instance()->mEVshowDetails),topFrame); | ||
918 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
919 | dummy = addWidBool(i18n("Created time"), | ||
920 | &(KOPrefs::instance()->mEVshowCreated),topFrame); | ||
921 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
922 | dummy = addWidBool(i18n("Last modified time"), | ||
923 | &(KOPrefs::instance()->mEVshowChanged),topFrame); | ||
924 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
925 | |||
926 | |||
927 | lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame); | ||
928 | topLayout->addWidget(lab ,ii++,0); | ||
929 | |||
930 | dummy = addWidBool(i18n("Details"), | ||
931 | &(KOPrefs::instance()->mWTshowDetails),topFrame); | ||
932 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
933 | dummy = addWidBool(i18n("Created time"), | ||
934 | &(KOPrefs::instance()->mWTshowCreated),topFrame); | ||
935 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
936 | dummy = addWidBool(i18n("Last modified time"), | ||
937 | &(KOPrefs::instance()->mWTshowChanged),topFrame); | ||
938 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
907 | 939 | ||
908 | 940 | ||
909 | topFrame = addPage(i18n("Alarm"),0,0); | 941 | topFrame = addPage(i18n("Alarm"),0,0); |
910 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 942 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
911 | 943 | ||
912 | topLayout = new QGridLayout(topFrame,2,1); | 944 | topLayout = new QGridLayout(topFrame,2,1); |
913 | topLayout->setSpacing(spacingHint()); | 945 | topLayout->setSpacing(spacingHint()); |
914 | topLayout->setMargin(marginHint()); | 946 | topLayout->setMargin(marginHint()); |
915 | int iii = 0; | 947 | int iii = 0; |
916 | 948 | ||
917 | dummy = | 949 | dummy = |
918 | addWidBool(i18n("Use internal alarm notification"), | 950 | addWidBool(i18n("Use internal alarm notification"), |
919 | &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); | 951 | &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); |
920 | topLayout->addWidget(dummy->checkBox(),iii++,0); | 952 | topLayout->addWidget(dummy->checkBox(),iii++,0); |
921 | lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); | 953 | lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); |
922 | 954 | ||
923 | topLayout->addWidget(lab ,iii++,0); | 955 | topLayout->addWidget(lab ,iii++,0); |
924 | #ifndef DESKTOP_VERSION | 956 | #ifndef DESKTOP_VERSION |
925 | lab->setAlignment( AlignLeft|WordBreak|AlignTop); | 957 | lab->setAlignment( AlignLeft|WordBreak|AlignTop); |
926 | #else | 958 | #else |
927 | lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 959 | lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
928 | lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | 960 | lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); |
929 | #endif | 961 | #endif |
930 | 962 | ||
931 | QHBox* dummyBox = new QHBox(topFrame); | 963 | QHBox* dummyBox = new QHBox(topFrame); |
932 | new QLabel(i18n("Play beeps count:"),dummyBox); | 964 | new QLabel(i18n("Play beeps count:"),dummyBox); |
933 | mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); | 965 | mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); |
934 | topLayout->addWidget(dummyBox,iii++,0); | 966 | topLayout->addWidget(dummyBox,iii++,0); |
935 | 967 | ||
936 | dummyBox = new QHBox(topFrame); | 968 | dummyBox = new QHBox(topFrame); |
937 | new QLabel(i18n("Beeps interval in sec:"),dummyBox); | 969 | new QLabel(i18n("Beeps interval in sec:"),dummyBox); |
938 | mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); | 970 | mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); |
939 | topLayout->addWidget(dummyBox,iii++,0); | 971 | topLayout->addWidget(dummyBox,iii++,0); |
940 | 972 | ||
941 | dummyBox = new QHBox(topFrame); | 973 | dummyBox = new QHBox(topFrame); |
942 | new QLabel(i18n("Default suspend time in min:"),dummyBox); | 974 | new QLabel(i18n("Default suspend time in min:"),dummyBox); |
943 | mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); | 975 | mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); |
944 | topLayout->addWidget(dummyBox,iii++,0); | 976 | topLayout->addWidget(dummyBox,iii++,0); |
945 | 977 | ||
946 | dummyBox = new QHBox(topFrame); | 978 | dummyBox = new QHBox(topFrame); |
947 | new QLabel(i18n("Auto suspend count:"),dummyBox); | 979 | new QLabel(i18n("Auto suspend count:"),dummyBox); |
948 | mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); | 980 | mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); |
949 | topLayout->addWidget(dummyBox,iii++,0); | 981 | topLayout->addWidget(dummyBox,iii++,0); |
950 | 982 | ||
951 | 983 | ||
952 | 984 | ||
953 | 985 | ||
954 | 986 | ||
955 | 987 | ||
956 | 988 | ||
957 | QHBox* hbo = new QHBox ( topFrame ); | 989 | QHBox* hbo = new QHBox ( topFrame ); |
958 | mDefaultAlarmFile = new QLineEdit(hbo); | 990 | mDefaultAlarmFile = new QLineEdit(hbo); |
959 | QPushButton * loadTemplate = new QPushButton(hbo); | 991 | QPushButton * loadTemplate = new QPushButton(hbo); |
960 | QPixmap icon; | 992 | QPixmap icon; |
961 | if ( QApplication::desktop()->width() < 321 ) | 993 | if ( QApplication::desktop()->width() < 321 ) |
962 | icon = SmallIcon("fileimport16"); | 994 | icon = SmallIcon("fileimport16"); |
963 | else | 995 | else |
964 | icon = SmallIcon("fileimport"); | 996 | icon = SmallIcon("fileimport"); |
965 | loadTemplate->setIconSet (icon ) ; | 997 | loadTemplate->setIconSet (icon ) ; |
966 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); | 998 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); |
967 | int size = loadTemplate->sizeHint().height(); | 999 | int size = loadTemplate->sizeHint().height(); |
968 | loadTemplate->setFixedSize( size, size ); | 1000 | loadTemplate->setFixedSize( size, size ); |
969 | //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); | 1001 | //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); |
970 | // topLayout->addWidget(lab ,iii++,0); | 1002 | // topLayout->addWidget(lab ,iii++,0); |
971 | lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); | 1003 | lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); |
972 | topLayout->addWidget(lab ,iii++,0); | 1004 | topLayout->addWidget(lab ,iii++,0); |
973 | topLayout->addWidget(hbo,iii++,0); | 1005 | topLayout->addWidget(hbo,iii++,0); |
974 | // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); | 1006 | // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); |
975 | 1007 | ||
976 | // topLayout->addWidget(lab ,iii++,0); | 1008 | // topLayout->addWidget(lab ,iii++,0); |
977 | // #ifndef DESKTOP_VERSION | 1009 | // #ifndef DESKTOP_VERSION |
978 | // lab->setAlignment( AlignLeft|WordBreak|AlignTop); | 1010 | // lab->setAlignment( AlignLeft|WordBreak|AlignTop); |
979 | // #else | 1011 | // #else |
980 | // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 1012 | // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
981 | // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | 1013 | // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); |
982 | // #endif | 1014 | // #endif |
983 | 1015 | ||
984 | 1016 | ||
985 | } | 1017 | } |
986 | 1018 | ||
987 | void KOPrefsDialog::selectSoundFile() | 1019 | void KOPrefsDialog::selectSoundFile() |
988 | { | 1020 | { |
989 | QString fileName = mDefaultAlarmFile->text(); | 1021 | QString fileName = mDefaultAlarmFile->text(); |
990 | fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); | 1022 | fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); |
991 | if ( fileName.length() > 0 ) | 1023 | if ( fileName.length() > 0 ) |
992 | mDefaultAlarmFile->setText( fileName ); | 1024 | mDefaultAlarmFile->setText( fileName ); |
993 | } | 1025 | } |
994 | void KOPrefsDialog::setupFontsTab() | 1026 | void KOPrefsDialog::setupFontsTab() |
995 | { | 1027 | { |
996 | 1028 | ||
997 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); | 1029 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); |
998 | // DesktopIcon("fonts",KIcon::SizeMedium)); | 1030 | // DesktopIcon("fonts",KIcon::SizeMedium)); |
999 | 1031 | ||
1000 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); | 1032 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); |
1001 | topLayout->setSpacing(1); | 1033 | topLayout->setSpacing(1); |
1002 | topLayout->setMargin(3); | 1034 | topLayout->setMargin(3); |
1003 | KPrefsDialogWidFont * tVFont; | 1035 | KPrefsDialogWidFont * tVFont; |
1004 | int i = 0; | 1036 | int i = 0; |
1005 | KPrefsDialogWidFont *timeLabelsFont = | 1037 | KPrefsDialogWidFont *timeLabelsFont = |
1006 | addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), | 1038 | addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), |
1007 | &(KOPrefs::instance()->mDateNavigatorFont),topFrame); | 1039 | &(KOPrefs::instance()->mDateNavigatorFont),topFrame); |
1008 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 1040 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
1009 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 1041 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
1010 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 1042 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
1011 | ++i; | 1043 | ++i; |
1012 | 1044 | ||
1013 | 1045 | ||
1014 | timeLabelsFont = | 1046 | timeLabelsFont = |
1015 | addWidFont(i18n("Mon 15"),i18n("Date Labels:"), | 1047 | addWidFont(i18n("Mon 15"),i18n("Date Labels:"), |
1016 | &(KOPrefs::instance()->mTimeLabelsFont),topFrame); | 1048 | &(KOPrefs::instance()->mTimeLabelsFont),topFrame); |
1017 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 1049 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
1018 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 1050 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
1019 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 1051 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
1020 | ++i; | 1052 | ++i; |
1021 | 1053 | ||
1022 | KPrefsDialogWidFont *timeBarFont = | 1054 | KPrefsDialogWidFont *timeBarFont = |
1023 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), | 1055 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), |
1024 | &(KOPrefs::instance()->mTimeBarFont),topFrame); | 1056 | &(KOPrefs::instance()->mTimeBarFont),topFrame); |
1025 | topLayout->addWidget(timeBarFont->label(),i,0); | 1057 | topLayout->addWidget(timeBarFont->label(),i,0); |
1026 | topLayout->addWidget(timeBarFont->preview(),i,1); | 1058 | topLayout->addWidget(timeBarFont->preview(),i,1); |
1027 | topLayout->addWidget(timeBarFont->button(),i,2); | 1059 | topLayout->addWidget(timeBarFont->button(),i,2); |
1028 | ++i; | 1060 | ++i; |
1029 | 1061 | ||
1030 | 1062 | ||
1031 | KPrefsDialogWidFont *marcusBainsFont = | 1063 | KPrefsDialogWidFont *marcusBainsFont = |
1032 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), | 1064 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), |
1033 | &(KOPrefs::instance()->mMarcusBainsFont),topFrame); | 1065 | &(KOPrefs::instance()->mMarcusBainsFont),topFrame); |
1034 | topLayout->addWidget(marcusBainsFont->label(),i,0); | 1066 | topLayout->addWidget(marcusBainsFont->label(),i,0); |
1035 | topLayout->addWidget(marcusBainsFont->preview(),i,1); | 1067 | topLayout->addWidget(marcusBainsFont->preview(),i,1); |
1036 | topLayout->addWidget(marcusBainsFont->button(),i,2); | 1068 | topLayout->addWidget(marcusBainsFont->button(),i,2); |
1037 | ++i; | 1069 | ++i; |
1038 | 1070 | ||
1039 | tVFont = | 1071 | tVFont = |
1040 | addWidFont(i18n("Summary"),i18n("Event Viewer:"), | 1072 | addWidFont(i18n("Summary"),i18n("Event Viewer:"), |
1041 | &(KOPrefs::instance()->mEventViewFont),topFrame); | 1073 | &(KOPrefs::instance()->mEventViewFont),topFrame); |
1042 | topLayout->addWidget(tVFont->label(),i,0); | 1074 | topLayout->addWidget(tVFont->label(),i,0); |
1043 | topLayout->addWidget(tVFont->preview(),i,1); | 1075 | topLayout->addWidget(tVFont->preview(),i,1); |
1044 | topLayout->addWidget(tVFont->button(),i,2); | 1076 | topLayout->addWidget(tVFont->button(),i,2); |
1045 | ++i; | 1077 | ++i; |
1046 | 1078 | ||
1047 | 1079 | ||
1048 | 1080 | ||
1049 | tVFont = | 1081 | tVFont = |
1050 | addWidFont(i18n("Details"),i18n("EditorBox:"), | 1082 | addWidFont(i18n("Details"),i18n("EditorBox:"), |
1051 | &(KOPrefs::instance()->mEditBoxFont),topFrame); | 1083 | &(KOPrefs::instance()->mEditBoxFont),topFrame); |
1052 | topLayout->addWidget(tVFont->label(),i,0); | 1084 | topLayout->addWidget(tVFont->label(),i,0); |
1053 | topLayout->addWidget(tVFont->preview(),i,1); | 1085 | topLayout->addWidget(tVFont->preview(),i,1); |
1054 | topLayout->addWidget(tVFont->button(),i,2); | 1086 | topLayout->addWidget(tVFont->button(),i,2); |
1055 | ++i; | 1087 | ++i; |
1056 | 1088 | ||
1057 | 1089 | ||
1058 | 1090 | ||
1059 | topLayout->setColStretch(1,1); | 1091 | topLayout->setColStretch(1,1); |
1060 | topLayout->setRowStretch(4,1); | 1092 | topLayout->setRowStretch(4,1); |
1061 | 1093 | ||
1062 | 1094 | ||
1063 | i = 0; | 1095 | i = 0; |
1064 | topFrame = addPage(i18n("View Fonts"),0, | 1096 | topFrame = addPage(i18n("View Fonts"),0, |
1065 | DesktopIcon("fonts",KIcon::SizeMedium)); | 1097 | DesktopIcon("fonts",KIcon::SizeMedium)); |
1066 | 1098 | ||
1067 | topLayout = new QGridLayout(topFrame,7,3); | 1099 | topLayout = new QGridLayout(topFrame,7,3); |
1068 | topLayout->setSpacing(1); | 1100 | topLayout->setSpacing(1); |
1069 | topLayout->setMargin(3); | 1101 | topLayout->setMargin(3); |
1070 | 1102 | ||
1071 | tVFont = | 1103 | tVFont = |
1072 | addWidFont(i18n("Configure KO"),i18n("What's Next View:"), | 1104 | addWidFont(i18n("Configure KO"),i18n("What's Next View:"), |
1073 | &(KOPrefs::instance()->mWhatsNextFont),topFrame); | 1105 | &(KOPrefs::instance()->mWhatsNextFont),topFrame); |
1074 | topLayout->addWidget(tVFont->label(),i,0); | 1106 | topLayout->addWidget(tVFont->label(),i,0); |
1075 | topLayout->addWidget(tVFont->preview(),i,1); | 1107 | topLayout->addWidget(tVFont->preview(),i,1); |
1076 | topLayout->addWidget(tVFont->button(),i,2); | 1108 | topLayout->addWidget(tVFont->button(),i,2); |
1077 | ++i; | 1109 | ++i; |
1078 | KPrefsDialogWidFont *agendaViewFont = | 1110 | KPrefsDialogWidFont *agendaViewFont = |
1079 | addWidFont(i18n("Event text"),i18n("Agenda view:"), | 1111 | addWidFont(i18n("Event text"),i18n("Agenda view:"), |
1080 | &(KOPrefs::instance()->mAgendaViewFont),topFrame); | 1112 | &(KOPrefs::instance()->mAgendaViewFont),topFrame); |
1081 | topLayout->addWidget(agendaViewFont->label(),i,0); | 1113 | topLayout->addWidget(agendaViewFont->label(),i,0); |
1082 | topLayout->addWidget(agendaViewFont->preview(),i,1); | 1114 | topLayout->addWidget(agendaViewFont->preview(),i,1); |
1083 | topLayout->addWidget(agendaViewFont->button(),i,2); | 1115 | topLayout->addWidget(agendaViewFont->button(),i,2); |
1084 | ++i; | 1116 | ++i; |
1085 | 1117 | ||
1086 | 1118 | ||
1087 | KPrefsDialogWidFont *monthViewFont = | 1119 | KPrefsDialogWidFont *monthViewFont = |
1088 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), | 1120 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), |
1089 | i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); | 1121 | i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); |
1090 | topLayout->addWidget(monthViewFont->label(),i,0); | 1122 | topLayout->addWidget(monthViewFont->label(),i,0); |
1091 | topLayout->addWidget(monthViewFont->preview(),i,1); | 1123 | topLayout->addWidget(monthViewFont->preview(),i,1); |
1092 | topLayout->addWidget(monthViewFont->button(),i,2); | 1124 | topLayout->addWidget(monthViewFont->button(),i,2); |
1093 | ++i; | 1125 | ++i; |
1094 | 1126 | ||
1095 | 1127 | ||
1096 | KPrefsDialogWidFont *lVFont = | 1128 | KPrefsDialogWidFont *lVFont = |
1097 | addWidFont(i18n("Event"),i18n("List View:"), | 1129 | addWidFont(i18n("Event"),i18n("List View:"), |
1098 | &(KOPrefs::instance()->mListViewFont),topFrame); | 1130 | &(KOPrefs::instance()->mListViewFont),topFrame); |
1099 | topLayout->addWidget(lVFont->label(),i,0); | 1131 | topLayout->addWidget(lVFont->label(),i,0); |
1100 | topLayout->addWidget(lVFont->preview(),i,1); | 1132 | topLayout->addWidget(lVFont->preview(),i,1); |
1101 | topLayout->addWidget(lVFont->button(),i,2); | 1133 | topLayout->addWidget(lVFont->button(),i,2); |
1102 | ++i; | 1134 | ++i; |
1103 | 1135 | ||
1104 | 1136 | ||
1105 | tVFont = | 1137 | tVFont = |
1106 | addWidFont(i18n("ToDo"),i18n("ToDoView:"), | 1138 | addWidFont(i18n("ToDo"),i18n("ToDoView:"), |
1107 | &(KOPrefs::instance()->mTodoViewFont),topFrame); | 1139 | &(KOPrefs::instance()->mTodoViewFont),topFrame); |
1108 | topLayout->addWidget(tVFont->label(),i,0); | 1140 | topLayout->addWidget(tVFont->label(),i,0); |
1109 | topLayout->addWidget(tVFont->preview(),i,1); | 1141 | topLayout->addWidget(tVFont->preview(),i,1); |
1110 | topLayout->addWidget(tVFont->button(),i,2); | 1142 | topLayout->addWidget(tVFont->button(),i,2); |
1111 | ++i; | 1143 | ++i; |
1112 | 1144 | ||
1113 | 1145 | ||
1114 | tVFont = | 1146 | tVFont = |
1115 | addWidFont(i18n("Today"),i18n("JournalView:"), | 1147 | addWidFont(i18n("Today"),i18n("JournalView:"), |
1116 | &(KOPrefs::instance()->mJornalViewFont),topFrame); | 1148 | &(KOPrefs::instance()->mJornalViewFont),topFrame); |
1117 | topLayout->addWidget(tVFont->label(),i,0); | 1149 | topLayout->addWidget(tVFont->label(),i,0); |
1118 | topLayout->addWidget(tVFont->preview(),i,1); | 1150 | topLayout->addWidget(tVFont->preview(),i,1); |
1119 | topLayout->addWidget(tVFont->button(),i,2); | 1151 | topLayout->addWidget(tVFont->button(),i,2); |
1120 | ++i; | 1152 | ++i; |
1121 | 1153 | ||
1122 | 1154 | ||
1123 | 1155 | ||
1124 | 1156 | ||
1125 | topLayout->setColStretch(1,1); | 1157 | topLayout->setColStretch(1,1); |
1126 | topLayout->setRowStretch(4,1); | 1158 | topLayout->setRowStretch(4,1); |
1127 | 1159 | ||
1128 | 1160 | ||
1129 | 1161 | ||
1130 | 1162 | ||
1131 | } | 1163 | } |
1132 | 1164 | ||
1133 | void KOPrefsDialog::setupColorsTab() | 1165 | void KOPrefsDialog::setupColorsTab() |
1134 | { | 1166 | { |
1135 | QFrame *topFrame = addPage(i18n("Colors"),0,0); | 1167 | QFrame *topFrame = addPage(i18n("Colors"),0,0); |
1136 | // DesktopIcon("colorize",KIcon::SizeMedium)); | 1168 | // DesktopIcon("colorize",KIcon::SizeMedium)); |
1137 | 1169 | ||
1138 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | 1170 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); |
1139 | // topLayout->setSpacing(spacingHint()); | 1171 | // topLayout->setSpacing(spacingHint()); |
1140 | // topLayout->setMargin(marginHint()); | 1172 | // topLayout->setMargin(marginHint()); |
1141 | 1173 | ||
1142 | topLayout->setSpacing(2); | 1174 | topLayout->setSpacing(2); |
1143 | topLayout->setMargin(3); | 1175 | topLayout->setMargin(3); |
1144 | 1176 | ||
1145 | int ii = 1; | 1177 | int ii = 1; |
1146 | QGroupBox *categoryGroup ; | 1178 | QGroupBox *categoryGroup ; |
1147 | 1179 | ||
1148 | categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), | 1180 | categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), |
1149 | topFrame); | 1181 | topFrame); |
1150 | topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); | 1182 | topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); |
1151 | 1183 | ||
1152 | mCategoryCombo = new QComboBox(categoryGroup); | 1184 | mCategoryCombo = new QComboBox(categoryGroup); |
1153 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); | 1185 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); |
1154 | connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); | 1186 | connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); |
1155 | 1187 | ||
1156 | mCategoryButton = new KColorButton(categoryGroup); | 1188 | mCategoryButton = new KColorButton(categoryGroup); |
1157 | connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); | 1189 | connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); |
1158 | updateCategoryColor(); | 1190 | updateCategoryColor(); |
1159 | 1191 | ||
1160 | 1192 | ||
1161 | // Holiday Color | 1193 | // Holiday Color |
1162 | 1194 | ||
1163 | KPrefsDialogWidColor *holidayColor = | 1195 | KPrefsDialogWidColor *holidayColor = |
1164 | addWidColor(i18n("Holiday color:"), | 1196 | addWidColor(i18n("Holiday color:"), |
1165 | &(KOPrefs::instance()->mHolidayColor),topFrame); | 1197 | &(KOPrefs::instance()->mHolidayColor),topFrame); |
1166 | topLayout->addWidget(holidayColor->label(),ii,0); | 1198 | topLayout->addWidget(holidayColor->label(),ii,0); |
1167 | topLayout->addWidget(holidayColor->button(),ii++,1); | 1199 | topLayout->addWidget(holidayColor->button(),ii++,1); |
1168 | 1200 | ||
1169 | // Highlight Color | 1201 | // Highlight Color |
1170 | KPrefsDialogWidColor *highlightColor = | 1202 | KPrefsDialogWidColor *highlightColor = |
1171 | addWidColor(i18n("Highlight color:"), | 1203 | addWidColor(i18n("Highlight color:"), |
1172 | &(KOPrefs::instance()->mHighlightColor),topFrame); | 1204 | &(KOPrefs::instance()->mHighlightColor),topFrame); |
1173 | topLayout->addWidget(highlightColor->label(),ii,0); | 1205 | topLayout->addWidget(highlightColor->label(),ii,0); |
1174 | topLayout->addWidget(highlightColor->button(),ii++,1); | 1206 | topLayout->addWidget(highlightColor->button(),ii++,1); |
1175 | 1207 | ||
1176 | // Event color | 1208 | // Event color |
1177 | KPrefsDialogWidColor *eventColor = | 1209 | KPrefsDialogWidColor *eventColor = |
1178 | addWidColor(i18n("Default event color:"), | 1210 | addWidColor(i18n("Default event color:"), |
1179 | &(KOPrefs::instance()->mEventColor),topFrame); | 1211 | &(KOPrefs::instance()->mEventColor),topFrame); |
1180 | topLayout->addWidget(eventColor->label(),ii,0); | 1212 | topLayout->addWidget(eventColor->label(),ii,0); |
1181 | topLayout->addWidget(eventColor->button(),ii++,1); | 1213 | topLayout->addWidget(eventColor->button(),ii++,1); |
1182 | eventColor = | 1214 | eventColor = |
1183 | addWidColor(i18n("Default todo done color:"), | 1215 | addWidColor(i18n("Default todo done color:"), |
1184 | &(KOPrefs::instance()->mTodoDoneColor),topFrame); | 1216 | &(KOPrefs::instance()->mTodoDoneColor),topFrame); |
1185 | topLayout->addWidget(eventColor->label(),ii,0); | 1217 | topLayout->addWidget(eventColor->label(),ii,0); |
1186 | topLayout->addWidget(eventColor->button(),ii++,1); | 1218 | topLayout->addWidget(eventColor->button(),ii++,1); |
1187 | 1219 | ||
1188 | 1220 | ||
1189 | // agenda view background color | 1221 | // agenda view background color |
1190 | KPrefsDialogWidColor *agendaBgColor = | 1222 | KPrefsDialogWidColor *agendaBgColor = |
1191 | addWidColor(i18n("Agenda view background color:"), | 1223 | addWidColor(i18n("Agenda view background color:"), |
1192 | &(KOPrefs::instance()->mAgendaBgColor),topFrame); | 1224 | &(KOPrefs::instance()->mAgendaBgColor),topFrame); |
1193 | topLayout->addWidget(agendaBgColor->label(),ii,0); | 1225 | topLayout->addWidget(agendaBgColor->label(),ii,0); |
1194 | topLayout->addWidget(agendaBgColor->button(),ii++,1); | 1226 | topLayout->addWidget(agendaBgColor->button(),ii++,1); |
1195 | 1227 | ||
1196 | // working hours color | 1228 | // working hours color |
1197 | KPrefsDialogWidColor *workingHoursColor = | 1229 | KPrefsDialogWidColor *workingHoursColor = |
1198 | addWidColor(i18n("Working hours color:"), | 1230 | addWidColor(i18n("Working hours color:"), |
1199 | &(KOPrefs::instance()->mWorkingHoursColor),topFrame); | 1231 | &(KOPrefs::instance()->mWorkingHoursColor),topFrame); |
1200 | topLayout->addWidget(workingHoursColor->label(),ii,0); | 1232 | topLayout->addWidget(workingHoursColor->label(),ii,0); |
1201 | topLayout->addWidget(workingHoursColor->button(),ii++,1); | 1233 | topLayout->addWidget(workingHoursColor->button(),ii++,1); |
1202 | 1234 | ||
1203 | KPrefsDialogWidBool *sb = | 1235 | KPrefsDialogWidBool *sb = |
1204 | addWidBool(i18n("Use colors for application:"), | 1236 | addWidBool(i18n("Use colors for application:"), |
1205 | &(KOPrefs::instance()->mUseAppColors),topFrame); | 1237 | &(KOPrefs::instance()->mUseAppColors),topFrame); |
1206 | topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); | 1238 | topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); |
1207 | 1239 | ||
1208 | ii++; | 1240 | ii++; |
1209 | KPrefsDialogWidColor * workingHoursColor1 = | 1241 | KPrefsDialogWidColor * workingHoursColor1 = |
1210 | addWidColor(i18n("Buttons, menus, etc.:"), | 1242 | addWidColor(i18n("Buttons, menus, etc.:"), |
1211 | &(KOPrefs::instance()->mAppColor1),topFrame); | 1243 | &(KOPrefs::instance()->mAppColor1),topFrame); |
1212 | topLayout->addWidget(workingHoursColor1->label(),ii,0); | 1244 | topLayout->addWidget(workingHoursColor1->label(),ii,0); |
1213 | topLayout->addWidget(workingHoursColor1->button(),ii++,1); | 1245 | topLayout->addWidget(workingHoursColor1->button(),ii++,1); |
1214 | 1246 | ||
1215 | KPrefsDialogWidColor * workingHoursColor2 = | 1247 | KPrefsDialogWidColor * workingHoursColor2 = |
1216 | addWidColor(i18n("Frames, labels, etc.:"), | 1248 | addWidColor(i18n("Frames, labels, etc.:"), |
1217 | &(KOPrefs::instance()->mAppColor2),topFrame); | 1249 | &(KOPrefs::instance()->mAppColor2),topFrame); |
1218 | topLayout->addWidget(workingHoursColor2->label(),ii,0); | 1250 | topLayout->addWidget(workingHoursColor2->label(),ii,0); |
1219 | topLayout->addWidget(workingHoursColor2->button(),ii++,1); | 1251 | topLayout->addWidget(workingHoursColor2->button(),ii++,1); |
1220 | 1252 | ||
1221 | 1253 | ||
1222 | 1254 | ||
1223 | } | 1255 | } |
1224 | 1256 | ||
1225 | void KOPrefsDialog::setCategoryColor() | 1257 | void KOPrefsDialog::setCategoryColor() |
1226 | { | 1258 | { |
1227 | mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); | 1259 | mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); |
1228 | } | 1260 | } |
1229 | 1261 | ||
1230 | void KOPrefsDialog::updateCategoryColor() | 1262 | void KOPrefsDialog::updateCategoryColor() |
1231 | { | 1263 | { |
1232 | QString cat = mCategoryCombo->currentText(); | 1264 | QString cat = mCategoryCombo->currentText(); |
1233 | QColor *color = mCategoryDict.find(cat); | 1265 | QColor *color = mCategoryDict.find(cat); |
1234 | if (!color) { | 1266 | if (!color) { |
1235 | color = KOPrefs::instance()->categoryColor(cat); | 1267 | color = KOPrefs::instance()->categoryColor(cat); |
1236 | } | 1268 | } |
1237 | if (color) { | 1269 | if (color) { |
1238 | mCategoryButton->setColor(*color); | 1270 | mCategoryButton->setColor(*color); |
1239 | } | 1271 | } |
1240 | } | 1272 | } |
1241 | 1273 | ||
1242 | void KOPrefsDialog::setupPrinterTab() | 1274 | void KOPrefsDialog::setupPrinterTab() |
1243 | { | 1275 | { |
1244 | mPrinterTab = addPage(i18n("Printing"),0, | 1276 | mPrinterTab = addPage(i18n("Printing"),0, |
1245 | DesktopIcon("fileprint",KIcon::SizeMedium)); | 1277 | DesktopIcon("fileprint",KIcon::SizeMedium)); |
1246 | 1278 | ||
1247 | QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); | 1279 | QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); |
1248 | topLayout->setSpacing(spacingHint()); | 1280 | topLayout->setSpacing(spacingHint()); |
1249 | topLayout->setMargin(marginHint()); | 1281 | topLayout->setMargin(marginHint()); |
1250 | 1282 | ||
1251 | topLayout->setRowStretch(4,1); | 1283 | topLayout->setRowStretch(4,1); |
1252 | } | 1284 | } |
1253 | 1285 | ||
1254 | void KOPrefsDialog::setupGroupSchedulingTab() | 1286 | void KOPrefsDialog::setupGroupSchedulingTab() |
1255 | { | 1287 | { |
1256 | #if 0 | 1288 | #if 0 |
1257 | QFrame *topFrame = addPage(i18n("Group Scheduling"),0, | 1289 | QFrame *topFrame = addPage(i18n("Group Scheduling"),0, |
1258 | DesktopIcon("personal",KIcon::SizeMedium)); | 1290 | DesktopIcon("personal",KIcon::SizeMedium)); |
1259 | 1291 | ||
1260 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 1292 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
1261 | topLayout->setSpacing(spacingHint()); | 1293 | topLayout->setSpacing(spacingHint()); |
1262 | topLayout->setMargin(marginHint()); | 1294 | topLayout->setMargin(marginHint()); |
1263 | 1295 | ||
1264 | #if 0 | 1296 | #if 0 |
1265 | KPrefsDialogWidRadios *schedulerGroup = | 1297 | KPrefsDialogWidRadios *schedulerGroup = |
1266 | addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), | 1298 | addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), |
1267 | topFrame); | 1299 | topFrame); |
1268 | schedulerGroup->addRadio("Dummy"); // Only for debugging | 1300 | schedulerGroup->addRadio("Dummy"); // Only for debugging |
1269 | schedulerGroup->addRadio(i18n("Mail client")); | 1301 | schedulerGroup->addRadio(i18n("Mail client")); |
1270 | 1302 | ||
1271 | topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); | 1303 | topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); |
1272 | #endif | 1304 | #endif |
1273 | 1305 | ||
1274 | KPrefsDialogWidRadios *sendGroup = | 1306 | KPrefsDialogWidRadios *sendGroup = |
1275 | addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), | 1307 | addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), |
1276 | topFrame); | 1308 | topFrame); |
1277 | sendGroup->addRadio(i18n("Send to outbox")); | 1309 | sendGroup->addRadio(i18n("Send to outbox")); |
1278 | sendGroup->addRadio(i18n("Send directly")); | 1310 | sendGroup->addRadio(i18n("Send directly")); |
1279 | 1311 | ||
1280 | topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); | 1312 | topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); |
1281 | 1313 | ||
1282 | topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); | 1314 | topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); |
1283 | mAMails = new QListView(topFrame); | 1315 | mAMails = new QListView(topFrame); |
1284 | mAMails->addColumn(i18n("Email"),300); | 1316 | mAMails->addColumn(i18n("Email"),300); |
1285 | topLayout->addMultiCellWidget(mAMails,3,3,0,1); | 1317 | topLayout->addMultiCellWidget(mAMails,3,3,0,1); |
1286 | 1318 | ||
1287 | topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); | 1319 | topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); |
1288 | aEmailsEdit = new QLineEdit(topFrame); | 1320 | aEmailsEdit = new QLineEdit(topFrame); |
1289 | aEmailsEdit->setEnabled(false); | 1321 | aEmailsEdit->setEnabled(false); |
1290 | topLayout->addWidget(aEmailsEdit,4,1); | 1322 | topLayout->addWidget(aEmailsEdit,4,1); |
1291 | 1323 | ||
1292 | QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); | 1324 | QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); |
1293 | topLayout->addWidget(add,5,0); | 1325 | topLayout->addWidget(add,5,0); |
1294 | QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); | 1326 | QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); |
1295 | topLayout->addWidget(del,5,1); | 1327 | topLayout->addWidget(del,5,1); |
1296 | 1328 | ||
1297 | //topLayout->setRowStretch(2,1); | 1329 | //topLayout->setRowStretch(2,1); |
1298 | connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); | 1330 | connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); |
1299 | connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); | 1331 | connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); |
1300 | connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); | 1332 | connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); |
1301 | connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); | 1333 | connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); |
1302 | #endif | 1334 | #endif |
1303 | } | 1335 | } |
1304 | 1336 | ||
1305 | void KOPrefsDialog::setupGroupAutomationTab() | 1337 | void KOPrefsDialog::setupGroupAutomationTab() |
1306 | { | 1338 | { |
1307 | return; | 1339 | return; |
1308 | QFrame *topFrame = addPage(i18n("Group Automation"),0, | 1340 | QFrame *topFrame = addPage(i18n("Group Automation"),0, |
1309 | DesktopIcon("personal",KIcon::SizeMedium)); | 1341 | DesktopIcon("personal",KIcon::SizeMedium)); |
1310 | 1342 | ||
1311 | QGridLayout *topLayout = new QGridLayout(topFrame,5,1); | 1343 | QGridLayout *topLayout = new QGridLayout(topFrame,5,1); |
1312 | topLayout->setSpacing(spacingHint()); | 1344 | topLayout->setSpacing(spacingHint()); |
1313 | topLayout->setMargin(marginHint()); | 1345 | topLayout->setMargin(marginHint()); |
1314 | 1346 | ||
1315 | KPrefsDialogWidRadios *autoRefreshGroup = | 1347 | KPrefsDialogWidRadios *autoRefreshGroup = |
1316 | addWidRadios(i18n("Auto Send Refresh"), | 1348 | addWidRadios(i18n("Auto Send Refresh"), |
1317 | &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); | 1349 | &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); |
1318 | autoRefreshGroup->addRadio(i18n("Never")); | 1350 | autoRefreshGroup->addRadio(i18n("Never")); |
1319 | autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); | 1351 | autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); |
1320 | //autoRefreshGroup->addRadio(i18n("selected emails")); | 1352 | //autoRefreshGroup->addRadio(i18n("selected emails")); |
1321 | topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); | 1353 | topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); |
1322 | 1354 | ||
1323 | KPrefsDialogWidRadios *autoInsertGroup = | 1355 | KPrefsDialogWidRadios *autoInsertGroup = |
1324 | addWidRadios(i18n("Auto Insert IMIP Replies"), | 1356 | addWidRadios(i18n("Auto Insert IMIP Replies"), |
1325 | &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); | 1357 | &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); |
1326 | autoInsertGroup->addRadio(i18n("Never")); | 1358 | autoInsertGroup->addRadio(i18n("Never")); |
1327 | autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); | 1359 | autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); |
1328 | //autoInsertGroup->addRadio(i18n("selected emails")); | 1360 | //autoInsertGroup->addRadio(i18n("selected emails")); |
1329 | topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); | 1361 | topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); |
1330 | 1362 | ||
1331 | KPrefsDialogWidRadios *autoRequestGroup = | 1363 | KPrefsDialogWidRadios *autoRequestGroup = |
1332 | addWidRadios(i18n("Auto Insert IMIP Requests"), | 1364 | addWidRadios(i18n("Auto Insert IMIP Requests"), |
1333 | &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); | 1365 | &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); |
1334 | autoRequestGroup->addRadio(i18n("Never")); | 1366 | autoRequestGroup->addRadio(i18n("Never")); |
1335 | autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); | 1367 | autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); |
1336 | //autoInsertGroup->addRadio(i18n("selected emails")); | 1368 | //autoInsertGroup->addRadio(i18n("selected emails")); |
1337 | topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); | 1369 | topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); |
1338 | 1370 | ||
1339 | KPrefsDialogWidRadios *autoFreeBusyGroup = | 1371 | KPrefsDialogWidRadios *autoFreeBusyGroup = |
1340 | addWidRadios(i18n("Auto Send FreeBusy Information"), | 1372 | addWidRadios(i18n("Auto Send FreeBusy Information"), |
1341 | &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); | 1373 | &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); |
1342 | autoFreeBusyGroup->addRadio(i18n("Never")); | 1374 | autoFreeBusyGroup->addRadio(i18n("Never")); |
1343 | autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); | 1375 | autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); |
1344 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); | 1376 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); |
1345 | topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); | 1377 | topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); |
1346 | 1378 | ||
1347 | KPrefsDialogWidRadios *autoFreeBusyReplyGroup = | 1379 | KPrefsDialogWidRadios *autoFreeBusyReplyGroup = |
1348 | addWidRadios(i18n("Auto Save FreeBusy Replies"), | 1380 | addWidRadios(i18n("Auto Save FreeBusy Replies"), |
1349 | &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); | 1381 | &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); |
1350 | autoFreeBusyReplyGroup->addRadio(i18n("Never")); | 1382 | autoFreeBusyReplyGroup->addRadio(i18n("Never")); |
1351 | autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); | 1383 | autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); |
1352 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); | 1384 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); |
1353 | topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); | 1385 | topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); |
1354 | } | 1386 | } |
1355 | 1387 | ||
1356 | void KOPrefsDialog::showPrinterTab() | 1388 | void KOPrefsDialog::showPrinterTab() |
1357 | { | 1389 | { |
1358 | showPage(pageIndex(mPrinterTab)); | 1390 | showPage(pageIndex(mPrinterTab)); |
1359 | } | 1391 | } |
1360 | 1392 | ||
1361 | 1393 | ||
1362 | void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, | 1394 | void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, |
1363 | const QStringList *tags) | 1395 | const QStringList *tags) |
1364 | { | 1396 | { |
1365 | if (tags) { | 1397 | if (tags) { |
1366 | int i = tags->findIndex(text); | 1398 | int i = tags->findIndex(text); |
1367 | if (i > 0) combo->setCurrentItem(i); | 1399 | if (i > 0) combo->setCurrentItem(i); |
1368 | } else { | 1400 | } else { |
1369 | for(int i=0;i<combo->count();++i) { | 1401 | for(int i=0;i<combo->count();++i) { |
1370 | if (combo->text(i) == text) { | 1402 | if (combo->text(i) == text) { |
1371 | combo->setCurrentItem(i); | 1403 | combo->setCurrentItem(i); |
1372 | break; | 1404 | break; |
1373 | } | 1405 | } |
1374 | } | 1406 | } |
1375 | } | 1407 | } |
1376 | } | 1408 | } |
1377 | 1409 | ||
1378 | void KOPrefsDialog::usrReadConfig() | 1410 | void KOPrefsDialog::usrReadConfig() |
1379 | { | 1411 | { |
1380 | kdelibcfg->readConfig(); | 1412 | kdelibcfg->readConfig(); |
1381 | mNameEdit->setText(KOPrefs::instance()->fullName()); | 1413 | mNameEdit->setText(KOPrefs::instance()->fullName()); |
1382 | mEmailEdit->setText(KOPrefs::instance()->email()); | 1414 | mEmailEdit->setText(KOPrefs::instance()->email()); |
1383 | 1415 | ||
1384 | mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); | 1416 | mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); |
1385 | // QDate current ( 2001, 1,1); | 1417 | // QDate current ( 2001, 1,1); |
1386 | //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); | 1418 | //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); |
1387 | //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); | 1419 | //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); |
1388 | //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); | 1420 | //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); |
1389 | //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); | 1421 | //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); |
1390 | mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); | 1422 | mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); |
1391 | mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); | 1423 | mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); |
1392 | mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); | 1424 | mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); |
1393 | // if (KOPrefs::instance()->mAllDaySize > 47 ) | 1425 | // if (KOPrefs::instance()->mAllDaySize > 47 ) |
1394 | // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; | 1426 | // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; |
1395 | //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); | 1427 | //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); |
1396 | 1428 | ||
1397 | mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); | 1429 | mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); |
1398 | mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); | 1430 | mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); |
1399 | mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); | 1431 | mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); |
1400 | // mAMails->clear(); | 1432 | // mAMails->clear(); |
1401 | // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); | 1433 | // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); |
1402 | // it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { | 1434 | // it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { |
1403 | // QListViewItem *item = new QListViewItem(mAMails); | 1435 | // QListViewItem *item = new QListViewItem(mAMails); |
1404 | // item->setText(0,*it); | 1436 | // item->setText(0,*it); |
1405 | // mAMails->insertItem(item); | 1437 | // mAMails->insertItem(item); |
1406 | // } | 1438 | // } |
1407 | 1439 | ||
1408 | // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); | 1440 | // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); |
1409 | //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); | 1441 | //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); |
1410 | //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); | 1442 | //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); |
1411 | //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); | 1443 | //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); |
1412 | 1444 | ||
1413 | //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); | 1445 | //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); |
1414 | mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); | 1446 | mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); |
1415 | //QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 1447 | //QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
1416 | //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); | 1448 | //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); |
1417 | //dummy = KOPrefs::instance()->mUserDateFormatShort; | 1449 | //dummy = KOPrefs::instance()->mUserDateFormatShort; |
1418 | //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); | 1450 | //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); |
1419 | updateCategories(); | 1451 | updateCategories(); |
1420 | mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); | 1452 | mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); |
1421 | mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); | 1453 | mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); |
1422 | mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); | 1454 | mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); |
1423 | mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); | 1455 | mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); |
1424 | } | 1456 | } |
1425 | 1457 | ||
1426 | 1458 | ||
1427 | void KOPrefsDialog::usrWriteConfig() | 1459 | void KOPrefsDialog::usrWriteConfig() |
1428 | { | 1460 | { |
1429 | 1461 | ||
1430 | kdelibcfg->writeConfig(); | 1462 | kdelibcfg->writeConfig(); |
1431 | // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); | 1463 | // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); |
1432 | //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); | 1464 | //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); |
1433 | //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); | 1465 | //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); |
1434 | //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); | 1466 | //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); |
1435 | //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); | 1467 | //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); |
1436 | KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); | 1468 | KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); |
1437 | 1469 | ||
1438 | //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); | 1470 | //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); |
1439 | //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); | 1471 | //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); |
1440 | KOPrefs::instance()->setFullName(mNameEdit->text()); | 1472 | KOPrefs::instance()->setFullName(mNameEdit->text()); |
1441 | KOPrefs::instance()->setEmail(mEmailEdit->text()); | 1473 | KOPrefs::instance()->setEmail(mEmailEdit->text()); |
1442 | 1474 | ||
1443 | KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); | 1475 | KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); |
1444 | 1476 | ||
1445 | // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); | 1477 | // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); |
1446 | //QDate date; | 1478 | //QDate date; |
1447 | //date = mStartDateSavingEdit->date(); | 1479 | //date = mStartDateSavingEdit->date(); |
1448 | //int sub = 0; | 1480 | //int sub = 0; |
1449 | //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | 1481 | //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) |
1450 | // sub = 1; | 1482 | // sub = 1; |
1451 | // KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; | 1483 | // KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; |
1452 | // date = mEndDateSavingEdit->date(); | 1484 | // date = mEndDateSavingEdit->date(); |
1453 | // if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | 1485 | // if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) |
1454 | // sub = 1; | 1486 | // sub = 1; |
1455 | // else | 1487 | // else |
1456 | // sub = 0; | 1488 | // sub = 0; |
1457 | // KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; | 1489 | // KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; |
1458 | // // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); | 1490 | // // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); |
1459 | 1491 | ||
1460 | KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); | 1492 | KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); |
1461 | KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); | 1493 | KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); |
1462 | KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); | 1494 | KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); |
1463 | 1495 | ||
1464 | //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); | 1496 | //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); |
1465 | 1497 | ||
1466 | QDictIterator<QColor> it(mCategoryDict); | 1498 | QDictIterator<QColor> it(mCategoryDict); |
1467 | while (it.current()) { | 1499 | while (it.current()) { |
1468 | KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); | 1500 | KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); |
1469 | ++it; | 1501 | ++it; |
1470 | } | 1502 | } |
1471 | 1503 | ||
1472 | KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); | 1504 | KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); |
1473 | KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); | 1505 | KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); |
1474 | KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); | 1506 | KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); |
1475 | 1507 | ||
1476 | KOPrefs::instance()->mAdditionalMails.clear(); | 1508 | KOPrefs::instance()->mAdditionalMails.clear(); |
1477 | // QListViewItem *item; | 1509 | // QListViewItem *item; |
1478 | // item = mAMails->firstChild(); | 1510 | // item = mAMails->firstChild(); |
1479 | // while (item) | 1511 | // while (item) |
1480 | // { | 1512 | // { |
1481 | // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); | 1513 | // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); |
1482 | // item = item->nextSibling(); | 1514 | // item = item->nextSibling(); |
1483 | // } | 1515 | // } |
1484 | KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); | 1516 | KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); |
1485 | KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; | 1517 | KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; |
1486 | KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; | 1518 | KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; |
1487 | KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; | 1519 | KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; |
1488 | 1520 | ||
1489 | } | 1521 | } |
1490 | 1522 | ||
1491 | void KOPrefsDialog::updateCategories() | 1523 | void KOPrefsDialog::updateCategories() |
1492 | { | 1524 | { |
1493 | mCategoryCombo->clear(); | 1525 | mCategoryCombo->clear(); |
1494 | mCategoryDict.clear(); | 1526 | mCategoryDict.clear(); |
1495 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); | 1527 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); |
1496 | updateCategoryColor(); | 1528 | updateCategoryColor(); |
1497 | } | 1529 | } |
1498 | 1530 | ||
1499 | void KOPrefsDialog::warningGroupScheduling() | 1531 | void KOPrefsDialog::warningGroupScheduling() |
1500 | { | 1532 | { |
1501 | warningExperimental(mEnableGroupScheduling->checkBox()->isChecked()); | 1533 | warningExperimental(mEnableGroupScheduling->checkBox()->isChecked()); |
1502 | } | 1534 | } |
1503 | 1535 | ||
1504 | void KOPrefsDialog::warningProjectView() | 1536 | void KOPrefsDialog::warningProjectView() |
1505 | { | 1537 | { |
1506 | warningExperimental(mEnableProjectView->checkBox()->isChecked()); | 1538 | warningExperimental(mEnableProjectView->checkBox()->isChecked()); |
1507 | } | 1539 | } |
1508 | 1540 | ||
1509 | void KOPrefsDialog::warningExperimental(bool on) | 1541 | void KOPrefsDialog::warningExperimental(bool on) |
1510 | { | 1542 | { |
1511 | if (on) { | 1543 | if (on) { |
1512 | KMessageBox::information(this,i18n("This is an experimental feature. " | 1544 | KMessageBox::information(this,i18n("This is an experimental feature. " |
1513 | "It may not work, it may do nothing useful and it may cause data loss. " | 1545 | "It may not work, it may do nothing useful and it may cause data loss. " |
1514 | "Use with care.\n" | 1546 | "Use with care.\n" |
1515 | "You have to restart KOrganizer for this setting to take effect.")); | 1547 | "You have to restart KOrganizer for this setting to take effect.")); |
1516 | } else { | 1548 | } else { |
1517 | KMessageBox::information(this, | 1549 | KMessageBox::information(this, |
1518 | i18n("You have to restart KOrganizer for this setting to take effect.")); | 1550 | i18n("You have to restart KOrganizer for this setting to take effect.")); |
1519 | } | 1551 | } |
1520 | } | 1552 | } |
1521 | 1553 | ||
1522 | void KOPrefsDialog::toggleEmailSettings(bool on) | 1554 | void KOPrefsDialog::toggleEmailSettings(bool on) |
1523 | { | 1555 | { |
1524 | if (on) { | 1556 | if (on) { |
1525 | mEmailEdit->setEnabled(false); | 1557 | mEmailEdit->setEnabled(false); |
1526 | mNameEdit->setEnabled(false); | 1558 | mNameEdit->setEnabled(false); |
1527 | mEmailLabel->setEnabled(false); | 1559 | mEmailLabel->setEnabled(false); |
1528 | mNameLabel->setEnabled(false); | 1560 | mNameLabel->setEnabled(false); |
1529 | 1561 | ||
1530 | KEMailSettings settings; | 1562 | KEMailSettings settings; |
1531 | mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); | 1563 | mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); |
1532 | mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); | 1564 | mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); |
1533 | } else { | 1565 | } else { |
1534 | mEmailEdit->setEnabled(true); | 1566 | mEmailEdit->setEnabled(true); |
1535 | mNameEdit->setEnabled(true); | 1567 | mNameEdit->setEnabled(true); |
1536 | mEmailLabel->setEnabled(true); | 1568 | mEmailLabel->setEnabled(true); |
1537 | mNameLabel->setEnabled(true); | 1569 | mNameLabel->setEnabled(true); |
1538 | } | 1570 | } |
1539 | } | 1571 | } |
1540 | 1572 | ||
1541 | void KOPrefsDialog::addItem() | 1573 | void KOPrefsDialog::addItem() |
1542 | { | 1574 | { |
1543 | // aEmailsEdit->setEnabled(true); | 1575 | // aEmailsEdit->setEnabled(true); |
1544 | // QListViewItem *item = new QListViewItem(mAMails); | 1576 | // QListViewItem *item = new QListViewItem(mAMails); |
1545 | // mAMails->insertItem(item); | 1577 | // mAMails->insertItem(item); |
1546 | // mAMails->setSelected(item,true); | 1578 | // mAMails->setSelected(item,true); |
1547 | // aEmailsEdit->setText(i18n("(EmptyEmail)")); | 1579 | // aEmailsEdit->setText(i18n("(EmptyEmail)")); |
1548 | } | 1580 | } |
1549 | 1581 | ||
1550 | void KOPrefsDialog::removeItem() | 1582 | void KOPrefsDialog::removeItem() |
1551 | { | 1583 | { |
1552 | // QListViewItem *item; | 1584 | // QListViewItem *item; |
1553 | // item = mAMails->selectedItem(); | 1585 | // item = mAMails->selectedItem(); |
1554 | // if (!item) return; | 1586 | // if (!item) return; |
1555 | // mAMails->takeItem(item); | 1587 | // mAMails->takeItem(item); |
1556 | // item = mAMails->selectedItem(); | 1588 | // item = mAMails->selectedItem(); |
1557 | // if (!item) { | 1589 | // if (!item) { |
1558 | // aEmailsEdit->setText(""); | 1590 | // aEmailsEdit->setText(""); |
1559 | // aEmailsEdit->setEnabled(false); | 1591 | // aEmailsEdit->setEnabled(false); |
1560 | // } | 1592 | // } |
1561 | // if (mAMails->childCount() == 0) { | 1593 | // if (mAMails->childCount() == 0) { |
1562 | // aEmailsEdit->setEnabled(false); | 1594 | // aEmailsEdit->setEnabled(false); |
1563 | // } | 1595 | // } |
1564 | } | 1596 | } |
1565 | 1597 | ||
1566 | void KOPrefsDialog::updateItem() | 1598 | void KOPrefsDialog::updateItem() |
1567 | { | 1599 | { |
1568 | // QListViewItem *item; | 1600 | // QListViewItem *item; |
1569 | // item = mAMails->selectedItem(); | 1601 | // item = mAMails->selectedItem(); |
1570 | // if (!item) return; | 1602 | // if (!item) return; |
1571 | // item->setText(0,aEmailsEdit->text()); | 1603 | // item->setText(0,aEmailsEdit->text()); |
1572 | } | 1604 | } |
1573 | 1605 | ||
1574 | void KOPrefsDialog::updateInput() | 1606 | void KOPrefsDialog::updateInput() |
1575 | { | 1607 | { |
1576 | // QListViewItem *item; | 1608 | // QListViewItem *item; |
1577 | // item = mAMails->selectedItem(); | 1609 | // item = mAMails->selectedItem(); |
1578 | // if (!item) return; | 1610 | // if (!item) return; |
1579 | // aEmailsEdit->setEnabled(true); | 1611 | // aEmailsEdit->setEnabled(true); |
1580 | // aEmailsEdit->setText(item->text(0)); | 1612 | // aEmailsEdit->setText(item->text(0)); |
1581 | } | 1613 | } |
1582 | void KOPrefsDialog::updateTimezoneOffset( int index ) | 1614 | void KOPrefsDialog::updateTimezoneOffset( int index ) |
1583 | { | 1615 | { |
1584 | /* | 1616 | /* |
1585 | qDebug("updateTimezoneOffset %d ", index); | 1617 | qDebug("updateTimezoneOffset %d ", index); |
1586 | if ( index < 24 ) { | 1618 | if ( index < 24 ) { |
1587 | mTimezoneOffsetSpin->setEnabled ( false ); | 1619 | mTimezoneOffsetSpin->setEnabled ( false ); |
1588 | mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); | 1620 | mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); |
1589 | 1621 | ||
1590 | 1622 | ||
1591 | } else { | 1623 | } else { |
1592 | if ( index == 24 ) { | 1624 | if ( index == 24 ) { |
1593 | mTimezoneOffsetSpin->setEnabled ( true ); | 1625 | mTimezoneOffsetSpin->setEnabled ( true ); |
1594 | mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); | 1626 | mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); |
1595 | 1627 | ||
1596 | } else { | 1628 | } else { |
1597 | mTimezoneOffsetSpin->setEnabled ( false ); | 1629 | mTimezoneOffsetSpin->setEnabled ( false ); |
1598 | mTimezoneOffsetSpin->setValue( 0 ); | 1630 | mTimezoneOffsetSpin->setValue( 0 ); |
1599 | } | 1631 | } |
1600 | } | 1632 | } |
1601 | */ | 1633 | */ |
1602 | } | 1634 | } |
1603 | 1635 | ||
1604 | void KOPrefsDialog::setupTimeZoneTab() | 1636 | void KOPrefsDialog::setupTimeZoneTab() |
1605 | { | 1637 | { |
1606 | #if 0 | 1638 | #if 0 |
1607 | QFrame *topFrame = addPage(i18n("Time Zone"),0,0); | 1639 | QFrame *topFrame = addPage(i18n("Time Zone"),0,0); |
1608 | // DesktopIcon("clock",KIcon::SizeMedium)); | 1640 | // DesktopIcon("clock",KIcon::SizeMedium)); |
1609 | 1641 | ||
1610 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | 1642 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); |
1611 | topLayout->setSpacing(spacingHint()); | 1643 | topLayout->setSpacing(spacingHint()); |
1612 | topLayout->setMargin(marginHint()); | 1644 | topLayout->setMargin(marginHint()); |
1613 | 1645 | ||
1614 | QHBox *timeZoneBox = new QHBox( topFrame ); | 1646 | QHBox *timeZoneBox = new QHBox( topFrame ); |
1615 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); | 1647 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); |
1616 | 1648 | ||
1617 | new QLabel( i18n("Timezone:"), timeZoneBox ); | 1649 | new QLabel( i18n("Timezone:"), timeZoneBox ); |
1618 | mTimeZoneCombo = new QComboBox( timeZoneBox ); | 1650 | mTimeZoneCombo = new QComboBox( timeZoneBox ); |
1619 | if ( QApplication::desktop()->width() < 300 ) { | 1651 | if ( QApplication::desktop()->width() < 300 ) { |
1620 | mTimeZoneCombo->setMaximumWidth(150); | 1652 | mTimeZoneCombo->setMaximumWidth(150); |
1621 | } | 1653 | } |
1622 | 1654 | ||
1623 | QStringList list; | 1655 | QStringList list; |
1624 | list = KGlobal::locale()->timeZoneList(); | 1656 | list = KGlobal::locale()->timeZoneList(); |
1625 | mTimeZoneCombo->insertStringList(list); | 1657 | mTimeZoneCombo->insertStringList(list); |
1626 | 1658 | ||
1627 | // find the currently set time zone and select it | 1659 | // find the currently set time zone and select it |
1628 | QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; | 1660 | QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; |
1629 | int nCurrentlySet = 11; | 1661 | int nCurrentlySet = 11; |
1630 | for (int i = 0; i < mTimeZoneCombo->count(); i++) | 1662 | for (int i = 0; i < mTimeZoneCombo->count(); i++) |
1631 | { | 1663 | { |
1632 | if (mTimeZoneCombo->text(i) == sCurrentlySet) | 1664 | if (mTimeZoneCombo->text(i) == sCurrentlySet) |
1633 | { | 1665 | { |
1634 | nCurrentlySet = i; | 1666 | nCurrentlySet = i; |
1635 | break; | 1667 | break; |
1636 | } | 1668 | } |
1637 | } | 1669 | } |
1638 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); | 1670 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); |
1639 | int iii = 1; | 1671 | int iii = 1; |
1640 | KPrefsDialogWidBool *sb = | 1672 | KPrefsDialogWidBool *sb = |
1641 | addWidBool(i18n("Timezone has daylight saving"), | 1673 | addWidBool(i18n("Timezone has daylight saving"), |
1642 | &(KOPrefs::instance()->mUseDaylightsaving),topFrame); | 1674 | &(KOPrefs::instance()->mUseDaylightsaving),topFrame); |
1643 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 1675 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
1644 | ++iii; | 1676 | ++iii; |
1645 | QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); | 1677 | QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); |
1646 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 1678 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
1647 | ++iii; | 1679 | ++iii; |
1648 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); | 1680 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); |
1649 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 1681 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
1650 | ++iii; | 1682 | ++iii; |
1651 | lab = new QLabel( i18n("Daylight start:"), topFrame ); | 1683 | lab = new QLabel( i18n("Daylight start:"), topFrame ); |
1652 | topLayout->addWidget(lab, iii,0); | 1684 | topLayout->addWidget(lab, iii,0); |
1653 | mStartDateSavingEdit = new KDateEdit(topFrame); | 1685 | mStartDateSavingEdit = new KDateEdit(topFrame); |
1654 | topLayout->addWidget(mStartDateSavingEdit, iii,1); | 1686 | topLayout->addWidget(mStartDateSavingEdit, iii,1); |
1655 | ++iii; | 1687 | ++iii; |
1656 | 1688 | ||
1657 | lab = new QLabel( i18n("Daylight end:"), topFrame ); | 1689 | lab = new QLabel( i18n("Daylight end:"), topFrame ); |
1658 | topLayout->addWidget(lab, iii,0); | 1690 | topLayout->addWidget(lab, iii,0); |
1659 | mEndDateSavingEdit = new KDateEdit(topFrame); | 1691 | mEndDateSavingEdit = new KDateEdit(topFrame); |
1660 | topLayout->addWidget(mEndDateSavingEdit, iii,1); | 1692 | topLayout->addWidget(mEndDateSavingEdit, iii,1); |
1661 | ++iii; | 1693 | ++iii; |
1662 | QDate current ( 2001, 1,1); | 1694 | QDate current ( 2001, 1,1); |
1663 | mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); | 1695 | mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); |
1664 | mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); | 1696 | mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); |
1665 | #endif | 1697 | #endif |
1666 | 1698 | ||
1667 | } | 1699 | } |
1668 | 1700 | ||
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 3011458..3483e95 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -1,1315 +1,1318 @@ | |||
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 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qheader.h> | 25 | #include <qheader.h> |
26 | #include <qcursor.h> | 26 | #include <qcursor.h> |
27 | #include <qwhatsthis.h> | 27 | #include <qwhatsthis.h> |
28 | 28 | ||
29 | #include <qvbox.h> | 29 | #include <qvbox.h> |
30 | #include <kdebug.h> | 30 | #include <kdebug.h> |
31 | #include "koprefs.h" | 31 | #include "koprefs.h" |
32 | #include <klocale.h> | 32 | #include <klocale.h> |
33 | #include <kglobal.h> | 33 | #include <kglobal.h> |
34 | #include <kiconloader.h> | 34 | #include <kiconloader.h> |
35 | #include <kmessagebox.h> | 35 | #include <kmessagebox.h> |
36 | 36 | ||
37 | #include <libkcal/icaldrag.h> | 37 | #include <libkcal/icaldrag.h> |
38 | #include <libkcal/vcaldrag.h> | 38 | #include <libkcal/vcaldrag.h> |
39 | #include <libkcal/calfilter.h> | 39 | #include <libkcal/calfilter.h> |
40 | #include <libkcal/dndfactory.h> | 40 | #include <libkcal/dndfactory.h> |
41 | #include <libkcal/calendarresources.h> | 41 | #include <libkcal/calendarresources.h> |
42 | #include <libkcal/resourcecalendar.h> | 42 | #include <libkcal/resourcecalendar.h> |
43 | #include <kresources/resourceselectdialog.h> | 43 | #include <kresources/resourceselectdialog.h> |
44 | #include <libkcal/kincidenceformatter.h> | 44 | #include <libkcal/kincidenceformatter.h> |
45 | #ifndef DESKTOP_VERSION | 45 | #ifndef DESKTOP_VERSION |
46 | #include <qpe/qpeapplication.h> | 46 | #include <qpe/qpeapplication.h> |
47 | #else | 47 | #else |
48 | #include <qapplication.h> | 48 | #include <qapplication.h> |
49 | #endif | 49 | #endif |
50 | #ifndef KORG_NOPRINTER | 50 | #ifndef KORG_NOPRINTER |
51 | #include "calprinter.h" | 51 | #include "calprinter.h" |
52 | #endif | 52 | #endif |
53 | #include "docprefs.h" | 53 | #include "docprefs.h" |
54 | 54 | ||
55 | #include "kotodoview.h" | 55 | #include "kotodoview.h" |
56 | using namespace KOrg; | 56 | using namespace KOrg; |
57 | 57 | ||
58 | 58 | ||
59 | class KOTodoViewWhatsThis :public QWhatsThis | 59 | class KOTodoViewWhatsThis :public QWhatsThis |
60 | { | 60 | { |
61 | public: | 61 | public: |
62 | KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; | 62 | KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; |
63 | 63 | ||
64 | protected: | 64 | protected: |
65 | virtual QString text( const QPoint& p) | 65 | virtual QString text( const QPoint& p) |
66 | { | 66 | { |
67 | return _view->getWhatsThisText(p) ; | 67 | return _view->getWhatsThisText(p) ; |
68 | } | 68 | } |
69 | private: | 69 | private: |
70 | QWidget* _wid; | 70 | QWidget* _wid; |
71 | KOTodoView * _view; | 71 | KOTodoView * _view; |
72 | }; | 72 | }; |
73 | 73 | ||
74 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, | 74 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, |
75 | const char *name) : | 75 | const char *name) : |
76 | KListView(parent,name) | 76 | KListView(parent,name) |
77 | { | 77 | { |
78 | mName = QString ( name ); | 78 | mName = QString ( name ); |
79 | mCalendar = calendar; | 79 | mCalendar = calendar; |
80 | #ifndef DESKTOP_VERSION | 80 | #ifndef DESKTOP_VERSION |
81 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 81 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
82 | #endif | 82 | #endif |
83 | mOldCurrent = 0; | 83 | mOldCurrent = 0; |
84 | mMousePressed = false; | 84 | mMousePressed = false; |
85 | 85 | ||
86 | setAcceptDrops(true); | 86 | setAcceptDrops(true); |
87 | viewport()->setAcceptDrops(true); | 87 | viewport()->setAcceptDrops(true); |
88 | int size = 16; | 88 | int size = 16; |
89 | if (qApp->desktop()->width() < 300 ) | 89 | if (qApp->desktop()->width() < 300 ) |
90 | size = 12; | 90 | size = 12; |
91 | setTreeStepSize( size + 6 ); | 91 | setTreeStepSize( size + 6 ); |
92 | 92 | ||
93 | } | 93 | } |
94 | 94 | ||
95 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) | 95 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) |
96 | { | 96 | { |
97 | #ifndef KORG_NODND | 97 | #ifndef KORG_NODND |
98 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; | 98 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; |
99 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 99 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
100 | !QTextDrag::canDecode( e ) ) { | 100 | !QTextDrag::canDecode( e ) ) { |
101 | e->ignore(); | 101 | e->ignore(); |
102 | return; | 102 | return; |
103 | } | 103 | } |
104 | 104 | ||
105 | mOldCurrent = currentItem(); | 105 | mOldCurrent = currentItem(); |
106 | #endif | 106 | #endif |
107 | } | 107 | } |
108 | 108 | ||
109 | 109 | ||
110 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) | 110 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) |
111 | { | 111 | { |
112 | #ifndef KORG_NODND | 112 | #ifndef KORG_NODND |
113 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; | 113 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; |
114 | 114 | ||
115 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 115 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
116 | !QTextDrag::canDecode( e ) ) { | 116 | !QTextDrag::canDecode( e ) ) { |
117 | e->ignore(); | 117 | e->ignore(); |
118 | return; | 118 | return; |
119 | } | 119 | } |
120 | 120 | ||
121 | e->accept(); | 121 | e->accept(); |
122 | #endif | 122 | #endif |
123 | } | 123 | } |
124 | 124 | ||
125 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) | 125 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) |
126 | { | 126 | { |
127 | #ifndef KORG_NODND | 127 | #ifndef KORG_NODND |
128 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; | 128 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; |
129 | 129 | ||
130 | setCurrentItem(mOldCurrent); | 130 | setCurrentItem(mOldCurrent); |
131 | setSelected(mOldCurrent,true); | 131 | setSelected(mOldCurrent,true); |
132 | #endif | 132 | #endif |
133 | } | 133 | } |
134 | 134 | ||
135 | void KOTodoListView::contentsDropEvent(QDropEvent *e) | 135 | void KOTodoListView::contentsDropEvent(QDropEvent *e) |
136 | { | 136 | { |
137 | #ifndef KORG_NODND | 137 | #ifndef KORG_NODND |
138 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; | 138 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; |
139 | 139 | ||
140 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 140 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
141 | !QTextDrag::canDecode( e ) ) { | 141 | !QTextDrag::canDecode( e ) ) { |
142 | e->ignore(); | 142 | e->ignore(); |
143 | return; | 143 | return; |
144 | } | 144 | } |
145 | 145 | ||
146 | DndFactory factory( mCalendar ); | 146 | DndFactory factory( mCalendar ); |
147 | Todo *todo = factory.createDropTodo(e); | 147 | Todo *todo = factory.createDropTodo(e); |
148 | 148 | ||
149 | if (todo) { | 149 | if (todo) { |
150 | e->acceptAction(); | 150 | e->acceptAction(); |
151 | 151 | ||
152 | KOTodoViewItem *destination = | 152 | KOTodoViewItem *destination = |
153 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); | 153 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); |
154 | Todo *destinationEvent = 0; | 154 | Todo *destinationEvent = 0; |
155 | if (destination) destinationEvent = destination->todo(); | 155 | if (destination) destinationEvent = destination->todo(); |
156 | 156 | ||
157 | Todo *existingTodo = mCalendar->todo(todo->uid()); | 157 | Todo *existingTodo = mCalendar->todo(todo->uid()); |
158 | 158 | ||
159 | if(existingTodo) { | 159 | if(existingTodo) { |
160 | Incidence *to = destinationEvent; | 160 | Incidence *to = destinationEvent; |
161 | while(to) { | 161 | while(to) { |
162 | if (to->uid() == todo->uid()) { | 162 | if (to->uid() == todo->uid()) { |
163 | KMessageBox::sorry(this, | 163 | KMessageBox::sorry(this, |
164 | i18n("Cannot move To-Do to itself\nor a child of itself"), | 164 | i18n("Cannot move To-Do to itself\nor a child of itself"), |
165 | i18n("Drop To-Do")); | 165 | i18n("Drop To-Do")); |
166 | delete todo; | 166 | delete todo; |
167 | return; | 167 | return; |
168 | } | 168 | } |
169 | to = to->relatedTo(); | 169 | to = to->relatedTo(); |
170 | } | 170 | } |
171 | internalDrop = true; | 171 | internalDrop = true; |
172 | if ( destinationEvent ) | 172 | if ( destinationEvent ) |
173 | reparentTodoSignal( destinationEvent, existingTodo ); | 173 | reparentTodoSignal( destinationEvent, existingTodo ); |
174 | else | 174 | else |
175 | unparentTodoSignal(existingTodo); | 175 | unparentTodoSignal(existingTodo); |
176 | delete todo; | 176 | delete todo; |
177 | } else { | 177 | } else { |
178 | mCalendar->addTodo(todo); | 178 | mCalendar->addTodo(todo); |
179 | emit todoDropped(todo, KOGlobals::EVENTADDED); | 179 | emit todoDropped(todo, KOGlobals::EVENTADDED); |
180 | if ( destinationEvent ) | 180 | if ( destinationEvent ) |
181 | reparentTodoSignal( destinationEvent, todo ); | 181 | reparentTodoSignal( destinationEvent, todo ); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | else { | 184 | else { |
185 | QString text; | 185 | QString text; |
186 | if (QTextDrag::decode(e,text)) { | 186 | if (QTextDrag::decode(e,text)) { |
187 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); | 187 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); |
188 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); | 188 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); |
189 | qDebug("Dropped : " + text); | 189 | qDebug("Dropped : " + text); |
190 | QStringList emails = QStringList::split(",",text); | 190 | QStringList emails = QStringList::split(",",text); |
191 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 191 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
192 | int pos = (*it).find("<"); | 192 | int pos = (*it).find("<"); |
193 | QString name = (*it).left(pos); | 193 | QString name = (*it).left(pos); |
194 | QString email = (*it).mid(pos); | 194 | QString email = (*it).mid(pos); |
195 | if (!email.isEmpty() && todoi) { | 195 | if (!email.isEmpty() && todoi) { |
196 | todoi->todo()->addAttendee(new Attendee(name,email)); | 196 | todoi->todo()->addAttendee(new Attendee(name,email)); |
197 | } | 197 | } |
198 | } | 198 | } |
199 | } | 199 | } |
200 | else { | 200 | else { |
201 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); | 201 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); |
202 | e->ignore(); | 202 | e->ignore(); |
203 | } | 203 | } |
204 | } | 204 | } |
205 | #endif | 205 | #endif |
206 | } | 206 | } |
207 | 207 | ||
208 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | 208 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) |
209 | { | 209 | { |
210 | #ifndef KORG_NODND | 210 | #ifndef KORG_NODND |
211 | QPoint p(contentsToViewport(e->pos())); | 211 | QPoint p(contentsToViewport(e->pos())); |
212 | QListViewItem *i = itemAt(p); | 212 | QListViewItem *i = itemAt(p); |
213 | mMousePressed = false; | 213 | mMousePressed = false; |
214 | if (i) { | 214 | if (i) { |
215 | // if the user clicked into the root decoration of the item, don't | 215 | // if the user clicked into the root decoration of the item, don't |
216 | // try to start a drag! | 216 | // try to start a drag! |
217 | if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + | 217 | if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + |
218 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + | 218 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + |
219 | itemMargin() || | 219 | itemMargin() || |
220 | p.x() < header()->sectionPos(header()->mapToIndex(0))) { | 220 | p.x() < header()->sectionPos(header()->mapToIndex(0))) { |
221 | if (e->button()==Qt::LeftButton) { | 221 | if (e->button()==Qt::LeftButton) { |
222 | mPressPos = e->pos(); | 222 | mPressPos = e->pos(); |
223 | mMousePressed = true; | 223 | mMousePressed = true; |
224 | } | 224 | } |
225 | } | 225 | } |
226 | } | 226 | } |
227 | #endif | 227 | #endif |
228 | QListView::contentsMousePressEvent(e); | 228 | QListView::contentsMousePressEvent(e); |
229 | } | 229 | } |
230 | void KOTodoListView::paintEvent(QPaintEvent* e) | 230 | void KOTodoListView::paintEvent(QPaintEvent* e) |
231 | { | 231 | { |
232 | emit paintNeeded(); | 232 | emit paintNeeded(); |
233 | QListView::paintEvent( e); | 233 | QListView::paintEvent( e); |
234 | } | 234 | } |
235 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) | 235 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) |
236 | { | 236 | { |
237 | 237 | ||
238 | #ifndef KORG_NODND | 238 | #ifndef KORG_NODND |
239 | //QListView::contentsMouseMoveEvent(e); | 239 | //QListView::contentsMouseMoveEvent(e); |
240 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > | 240 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > |
241 | QApplication::startDragDistance()*3) { | 241 | QApplication::startDragDistance()*3) { |
242 | mMousePressed = false; | 242 | mMousePressed = false; |
243 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); | 243 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); |
244 | if (item) { | 244 | if (item) { |
245 | DndFactory factory( mCalendar ); | 245 | DndFactory factory( mCalendar ); |
246 | ICalDrag *vd = factory.createDrag( | 246 | ICalDrag *vd = factory.createDrag( |
247 | ((KOTodoViewItem *)item)->todo(),viewport()); | 247 | ((KOTodoViewItem *)item)->todo(),viewport()); |
248 | internalDrop = false; | 248 | internalDrop = false; |
249 | // we cannot do any senseful here, because the DnD is still broken in Qt | 249 | // we cannot do any senseful here, because the DnD is still broken in Qt |
250 | if (vd->drag()) { | 250 | if (vd->drag()) { |
251 | if ( !internalDrop ) { | 251 | if ( !internalDrop ) { |
252 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); | 252 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); |
253 | qDebug("Dnd: External move: Delete drag source "); | 253 | qDebug("Dnd: External move: Delete drag source "); |
254 | } else | 254 | } else |
255 | qDebug("Dnd: Internal move "); | 255 | qDebug("Dnd: Internal move "); |
256 | 256 | ||
257 | } else { | 257 | } else { |
258 | if ( !internalDrop ) { | 258 | if ( !internalDrop ) { |
259 | qDebug("Dnd: External Copy"); | 259 | qDebug("Dnd: External Copy"); |
260 | } else | 260 | } else |
261 | qDebug("DnD: Internal copy: Copy pending"); | 261 | qDebug("DnD: Internal copy: Copy pending"); |
262 | } | 262 | } |
263 | } | 263 | } |
264 | } | 264 | } |
265 | #endif | 265 | #endif |
266 | } | 266 | } |
267 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | 267 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) |
268 | { | 268 | { |
269 | 269 | ||
270 | QListViewItem* cn; | 270 | QListViewItem* cn; |
271 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { | 271 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { |
272 | cn = currentItem(); | 272 | cn = currentItem(); |
273 | if ( cn ) { | 273 | if ( cn ) { |
274 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 274 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
275 | if ( ci ){ | 275 | if ( ci ){ |
276 | if ( e->state() == ShiftButton ) | 276 | if ( e->state() == ShiftButton ) |
277 | ci->setOn( false ); | 277 | ci->setOn( false ); |
278 | else | 278 | else |
279 | ci->setOn( true ); | 279 | ci->setOn( true ); |
280 | cn = cn->itemBelow(); | 280 | cn = cn->itemBelow(); |
281 | if ( cn ) { | 281 | if ( cn ) { |
282 | setCurrentItem ( cn ); | 282 | setCurrentItem ( cn ); |
283 | ensureItemVisible ( cn ); | 283 | ensureItemVisible ( cn ); |
284 | } | 284 | } |
285 | 285 | ||
286 | } | 286 | } |
287 | } | 287 | } |
288 | 288 | ||
289 | return; | 289 | return; |
290 | } | 290 | } |
291 | 291 | ||
292 | // qDebug("KOTodoListView::keyPressEvent "); | 292 | // qDebug("KOTodoListView::keyPressEvent "); |
293 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 293 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
294 | switch ( e->key() ) { | 294 | switch ( e->key() ) { |
295 | case Qt::Key_Down: | 295 | case Qt::Key_Down: |
296 | case Qt::Key_Up: | 296 | case Qt::Key_Up: |
297 | QListView::keyPressEvent ( e ); | 297 | QListView::keyPressEvent ( e ); |
298 | break; | 298 | break; |
299 | case Qt::Key_Left: | 299 | case Qt::Key_Left: |
300 | case Qt::Key_Right: | 300 | case Qt::Key_Right: |
301 | QListView::keyPressEvent ( e ); | 301 | QListView::keyPressEvent ( e ); |
302 | e->accept(); | 302 | e->accept(); |
303 | return; | 303 | return; |
304 | break; | 304 | break; |
305 | default: | 305 | default: |
306 | e->ignore(); | 306 | e->ignore(); |
307 | break; | 307 | break; |
308 | } | 308 | } |
309 | return; | 309 | return; |
310 | } | 310 | } |
311 | e->ignore(); | 311 | e->ignore(); |
312 | } | 312 | } |
313 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) | 313 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) |
314 | { | 314 | { |
315 | QListView::contentsMouseReleaseEvent(e); | 315 | QListView::contentsMouseReleaseEvent(e); |
316 | mMousePressed = false; | 316 | mMousePressed = false; |
317 | } | 317 | } |
318 | 318 | ||
319 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 319 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
320 | { | 320 | { |
321 | if (!e) return; | 321 | if (!e) return; |
322 | 322 | ||
323 | QPoint vp = contentsToViewport(e->pos()); | 323 | QPoint vp = contentsToViewport(e->pos()); |
324 | 324 | ||
325 | QListViewItem *item = itemAt(vp); | 325 | QListViewItem *item = itemAt(vp); |
326 | 326 | ||
327 | emit double_Clicked(item); | 327 | emit double_Clicked(item); |
328 | if (!item) return; | 328 | if (!item) return; |
329 | 329 | ||
330 | emit doubleClicked(item,vp,0); | 330 | emit doubleClicked(item,vp,0); |
331 | } | 331 | } |
332 | 332 | ||
333 | ///////////////////////////////////////////////////////////////////////////// | 333 | ///////////////////////////////////////////////////////////////////////////// |
334 | 334 | ||
335 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 335 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
336 | QLineEdit(parent) | 336 | QLineEdit(parent) |
337 | { | 337 | { |
338 | setText(i18n("Click to add a new Todo")); | 338 | setText(i18n("Click to add a new Todo")); |
339 | } | 339 | } |
340 | 340 | ||
341 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 341 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
342 | { | 342 | { |
343 | if ( text()==i18n("Click to add a new Todo") ) | 343 | if ( text()==i18n("Click to add a new Todo") ) |
344 | setText(""); | 344 | setText(""); |
345 | QLineEdit::focusInEvent(ev); | 345 | QLineEdit::focusInEvent(ev); |
346 | } | 346 | } |
347 | 347 | ||
348 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 348 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
349 | { | 349 | { |
350 | setText(i18n("Click to add a new Todo")); | 350 | setText(i18n("Click to add a new Todo")); |
351 | QLineEdit::focusOutEvent(ev); | 351 | QLineEdit::focusOutEvent(ev); |
352 | } | 352 | } |
353 | 353 | ||
354 | ///////////////////////////////////////////////////////////////////////////// | 354 | ///////////////////////////////////////////////////////////////////////////// |
355 | 355 | ||
356 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 356 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
357 | KOrg::BaseView(calendar,parent,name) | 357 | KOrg::BaseView(calendar,parent,name) |
358 | { | 358 | { |
359 | mPendingUpdateBeforeRepaint = false; | 359 | mPendingUpdateBeforeRepaint = false; |
360 | isFlatDisplay = false; | 360 | isFlatDisplay = false; |
361 | mNavigator = 0; | 361 | mNavigator = 0; |
362 | QBoxLayout *topLayout = new QVBoxLayout(this); | 362 | QBoxLayout *topLayout = new QVBoxLayout(this); |
363 | mName = QString ( name ); | 363 | mName = QString ( name ); |
364 | mBlockUpdate = false; | 364 | mBlockUpdate = false; |
365 | mQuickAdd = new KOQuickTodo(this); | 365 | mQuickAdd = new KOQuickTodo(this); |
366 | topLayout->addWidget(mQuickAdd); | 366 | topLayout->addWidget(mQuickAdd); |
367 | 367 | ||
368 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); | 368 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); |
369 | 369 | ||
370 | mTodoListView = new KOTodoListView(calendar,this, name ); | 370 | mTodoListView = new KOTodoListView(calendar,this, name ); |
371 | topLayout->addWidget(mTodoListView); | 371 | topLayout->addWidget(mTodoListView); |
372 | //mTodoListView->header()->setMaximumHeight(30); | 372 | //mTodoListView->header()->setMaximumHeight(30); |
373 | mTodoListView->setRootIsDecorated(true); | 373 | mTodoListView->setRootIsDecorated(true); |
374 | mTodoListView->setAllColumnsShowFocus(true); | 374 | mTodoListView->setAllColumnsShowFocus(true); |
375 | 375 | ||
376 | mTodoListView->setShowSortIndicator(true); | 376 | mTodoListView->setShowSortIndicator(true); |
377 | 377 | ||
378 | mTodoListView->addColumn(i18n("Todo")); | 378 | mTodoListView->addColumn(i18n("Todo")); |
379 | mTodoListView->addColumn(i18n("Prio")); | 379 | mTodoListView->addColumn(i18n("Prio")); |
380 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 380 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
381 | mTodoListView->addColumn(i18n("Complete")); | 381 | mTodoListView->addColumn(i18n("Complete")); |
382 | mTodoListView->setColumnAlignment(2,AlignCenter); | 382 | mTodoListView->setColumnAlignment(2,AlignCenter); |
383 | 383 | ||
384 | mTodoListView->addColumn(i18n("Due Date")); | 384 | mTodoListView->addColumn(i18n("Due Date")); |
385 | mTodoListView->setColumnAlignment(3,AlignLeft); | 385 | mTodoListView->setColumnAlignment(3,AlignLeft); |
386 | mTodoListView->addColumn(i18n("Due Time")); | 386 | mTodoListView->addColumn(i18n("Due Time")); |
387 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 387 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
388 | 388 | ||
389 | mTodoListView->addColumn(i18n("Start Date")); | 389 | mTodoListView->addColumn(i18n("Start Date")); |
390 | mTodoListView->setColumnAlignment(5,AlignLeft); | 390 | mTodoListView->setColumnAlignment(5,AlignLeft); |
391 | mTodoListView->addColumn(i18n("Start Time")); | 391 | mTodoListView->addColumn(i18n("Start Time")); |
392 | mTodoListView->setColumnAlignment(6,AlignHCenter); | 392 | mTodoListView->setColumnAlignment(6,AlignHCenter); |
393 | 393 | ||
394 | mTodoListView->addColumn(i18n("Cancelled")); | 394 | mTodoListView->addColumn(i18n("Cancelled")); |
395 | mTodoListView->addColumn(i18n("Categories")); | 395 | mTodoListView->addColumn(i18n("Categories")); |
396 | #if 0 | 396 | #if 0 |
397 | mTodoListView->addColumn(i18n("Sort Id")); | 397 | mTodoListView->addColumn(i18n("Sort Id")); |
398 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 398 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
399 | #endif | 399 | #endif |
400 | 400 | ||
401 | mTodoListView->setMinimumHeight( 60 ); | 401 | mTodoListView->setMinimumHeight( 60 ); |
402 | mTodoListView->setItemsRenameable( true ); | 402 | mTodoListView->setItemsRenameable( true ); |
403 | mTodoListView->setRenameable( 0 ); | 403 | mTodoListView->setRenameable( 0 ); |
404 | mTodoListView->setColumnWidth( 0, 120 ); | 404 | mTodoListView->setColumnWidth( 0, 120 ); |
405 | mTodoListView->setColumnWidthMode(0, QListView::Manual); | 405 | mTodoListView->setColumnWidthMode(0, QListView::Manual); |
406 | mTodoListView->setColumnWidthMode(1, QListView::Manual); | 406 | mTodoListView->setColumnWidthMode(1, QListView::Manual); |
407 | mTodoListView->setColumnWidthMode(2, QListView::Manual); | 407 | mTodoListView->setColumnWidthMode(2, QListView::Manual); |
408 | mTodoListView->setColumnWidthMode(3, QListView::Manual); | 408 | mTodoListView->setColumnWidthMode(3, QListView::Manual); |
409 | mTodoListView->setColumnWidthMode(4, QListView::Manual); | 409 | mTodoListView->setColumnWidthMode(4, QListView::Manual); |
410 | mTodoListView->setColumnWidthMode(5, QListView::Manual); | 410 | mTodoListView->setColumnWidthMode(5, QListView::Manual); |
411 | mTodoListView->setColumnWidthMode(6, QListView::Manual); | 411 | mTodoListView->setColumnWidthMode(6, QListView::Manual); |
412 | mTodoListView->setColumnWidthMode(7, QListView::Manual); | 412 | mTodoListView->setColumnWidthMode(7, QListView::Manual); |
413 | mTodoListView->setColumnWidthMode(8, QListView::Manual); | 413 | mTodoListView->setColumnWidthMode(8, QListView::Manual); |
414 | 414 | ||
415 | 415 | ||
416 | new KOTodoViewWhatsThis(mTodoListView->viewport(),this); | 416 | new KOTodoViewWhatsThis(mTodoListView->viewport(),this); |
417 | 417 | ||
418 | mPriorityPopupMenu = new QPopupMenu(this); | 418 | mPriorityPopupMenu = new QPopupMenu(this); |
419 | for (int i = 1; i <= 5; i++) { | 419 | for (int i = 1; i <= 5; i++) { |
420 | QString label = QString ("%1").arg (i); | 420 | QString label = QString ("%1").arg (i); |
421 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 421 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
422 | } | 422 | } |
423 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 423 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
424 | 424 | ||
425 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 425 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
426 | for (int i = 0; i <= 100; i+=20) { | 426 | for (int i = 0; i <= 100; i+=20) { |
427 | QString label = QString ("%1 %").arg (i); | 427 | QString label = QString ("%1 %").arg (i); |
428 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 428 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
429 | } | 429 | } |
430 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 430 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
431 | 431 | ||
432 | 432 | ||
433 | 433 | ||
434 | mItemPopupMenu = new QPopupMenu(this); | 434 | mItemPopupMenu = new QPopupMenu(this); |
435 | mItemPopupMenu->insertItem(i18n("Show..."), this, | 435 | mItemPopupMenu->insertItem(i18n("Show..."), this, |
436 | SLOT (showTodo())); | 436 | SLOT (showTodo())); |
437 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 437 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
438 | SLOT (editTodo())); | 438 | SLOT (editTodo())); |
439 | mItemPopupMenu->insertItem( i18n("Delete"), this, | 439 | mItemPopupMenu->insertItem( i18n("Delete"), this, |
440 | SLOT (deleteTodo())); | 440 | SLOT (deleteTodo())); |
441 | mItemPopupMenu->insertItem( i18n("Clone..."), this, | 441 | mItemPopupMenu->insertItem( i18n("Clone..."), this, |
442 | SLOT (cloneTodo())); | 442 | SLOT (cloneTodo())); |
443 | mItemPopupMenu->insertItem( i18n("Move..."), this, | 443 | mItemPopupMenu->insertItem( i18n("Move..."), this, |
444 | SLOT (moveTodo())); | 444 | SLOT (moveTodo())); |
445 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 445 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |
446 | SLOT (beamTodo())); | 446 | SLOT (beamTodo())); |
447 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 447 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
448 | SLOT (cancelTodo())); | 448 | SLOT (cancelTodo())); |
449 | mItemPopupMenu->insertSeparator(); | 449 | mItemPopupMenu->insertSeparator(); |
450 | 450 | ||
451 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, | 451 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, |
452 | SLOT (newTodo())); | 452 | SLOT (newTodo())); |
453 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, | 453 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, |
454 | SLOT (newSubTodo())); | 454 | SLOT (newSubTodo())); |
455 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 455 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
456 | SLOT (unparentTodo()),0,21); | 456 | SLOT (unparentTodo()),0,21); |
457 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, | 457 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, |
458 | SLOT (reparentTodo()),0,22); | 458 | SLOT (reparentTodo()),0,22); |
459 | mItemPopupMenu->insertSeparator(); | 459 | mItemPopupMenu->insertSeparator(); |
460 | #if 0 | 460 | #if 0 |
461 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), | 461 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), |
462 | this, SLOT( purgeCompleted() ) ); | 462 | this, SLOT( purgeCompleted() ) ); |
463 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 463 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
464 | this, SLOT( toggleCompleted() ),0, 33 ); | 464 | this, SLOT( toggleCompleted() ),0, 33 ); |
465 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 465 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
466 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 466 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
467 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 467 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
468 | this, SLOT( toggleRunning() ),0, 35 ); | 468 | this, SLOT( toggleRunning() ),0, 35 ); |
469 | 469 | ||
470 | #endif | 470 | #endif |
471 | mPopupMenu = new QPopupMenu(this); | 471 | mPopupMenu = new QPopupMenu(this); |
472 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 472 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
473 | SLOT (newTodo()),0,1); | 473 | SLOT (newTodo()),0,1); |
474 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), | 474 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), |
475 | this, SLOT(purgeCompleted()),0,2); | 475 | this, SLOT(purgeCompleted()),0,2); |
476 | mPopupMenu->insertItem(i18n("Show Completed"), | 476 | mPopupMenu->insertItem(i18n("Show Completed"), |
477 | this, SLOT( toggleCompleted() ),0,3 ); | 477 | this, SLOT( toggleCompleted() ),0,3 ); |
478 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 478 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
479 | this, SLOT( toggleQuickTodo() ),0,4 ); | 479 | this, SLOT( toggleQuickTodo() ),0,4 ); |
480 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 480 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
481 | this, SLOT( toggleRunning() ),0,5 ); | 481 | this, SLOT( toggleRunning() ),0,5 ); |
482 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), | 482 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), |
483 | this, SLOT( setAllOpen() ),0,6 ); | 483 | this, SLOT( setAllOpen() ),0,6 ); |
484 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), | 484 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), |
485 | this, SLOT( setAllClose() ),0,7 ); | 485 | this, SLOT( setAllClose() ),0,7 ); |
486 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), | 486 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), |
487 | this, SLOT( setAllFlat() ),0,8 ); | 487 | this, SLOT( setAllFlat() ),0,8 ); |
488 | mDocPrefs = new DocPrefs( name ); | 488 | mDocPrefs = new DocPrefs( name ); |
489 | 489 | ||
490 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); | 490 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); |
491 | mPopupMenu->setCheckable( true ); | 491 | mPopupMenu->setCheckable( true ); |
492 | mItemPopupMenu->setCheckable( true ); | 492 | mItemPopupMenu->setCheckable( true ); |
493 | 493 | ||
494 | 494 | ||
495 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 495 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
496 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 496 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
497 | 497 | ||
498 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 498 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
499 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 499 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
500 | 500 | ||
501 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 501 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
502 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 502 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
503 | 503 | ||
504 | 504 | ||
505 | // Double clicking conflicts with opening/closing the subtree | 505 | // Double clicking conflicts with opening/closing the subtree |
506 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 506 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), |
507 | SLOT( editItem( QListViewItem *) ) ); | 507 | SLOT( editItem( QListViewItem *) ) ); |
508 | /* | 508 | /* |
509 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 509 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
510 | const QPoint &,int ) ), | 510 | const QPoint &,int ) ), |
511 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 511 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
512 | */ | 512 | */ |
513 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, | 513 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, |
514 | const QPoint &,int ) ), | 514 | const QPoint &,int ) ), |
515 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 515 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
516 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 516 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), |
517 | SLOT( itemClicked( QListViewItem * ) ) ); | 517 | SLOT( itemClicked( QListViewItem * ) ) ); |
518 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 518 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), |
519 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 519 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); |
520 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 520 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
521 | SLOT( updateView() ) ); | 521 | SLOT( updateView() ) ); |
522 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 522 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
523 | SLOT( todoModified(Todo *, int) ) ); | 523 | SLOT( todoModified(Todo *, int) ) ); |
524 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 524 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), |
525 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 525 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
526 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 526 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
527 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 527 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
528 | connect( mTodoListView, SIGNAL( paintNeeded() ), | 528 | connect( mTodoListView, SIGNAL( paintNeeded() ), |
529 | SLOT( paintNeeded()) ); | 529 | SLOT( paintNeeded()) ); |
530 | 530 | ||
531 | #if 0 | 531 | #if 0 |
532 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 532 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
533 | SLOT(selectionChanged(QListViewItem *))); | 533 | SLOT(selectionChanged(QListViewItem *))); |
534 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 534 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), |
535 | SLOT(selectionChanged(QListViewItem *))); | 535 | SLOT(selectionChanged(QListViewItem *))); |
536 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 536 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), |
537 | SLOT(selectionChanged(QListViewItem *))); | 537 | SLOT(selectionChanged(QListViewItem *))); |
538 | #endif | 538 | #endif |
539 | 539 | ||
540 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); | 540 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); |
541 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); | 541 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); |
542 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); | 542 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); |
543 | 543 | ||
544 | connect( mTodoListView, SIGNAL(selectionChanged() ), | 544 | connect( mTodoListView, SIGNAL(selectionChanged() ), |
545 | SLOT( processSelectionChange() ) ); | 545 | SLOT( processSelectionChange() ) ); |
546 | connect( mQuickAdd, SIGNAL( returnPressed () ), | 546 | connect( mQuickAdd, SIGNAL( returnPressed () ), |
547 | SLOT( addQuickTodo() ) ); | 547 | SLOT( addQuickTodo() ) ); |
548 | 548 | ||
549 | } | 549 | } |
550 | 550 | ||
551 | KOTodoView::~KOTodoView() | 551 | KOTodoView::~KOTodoView() |
552 | { | 552 | { |
553 | delete mDocPrefs; | 553 | delete mDocPrefs; |
554 | } | 554 | } |
555 | QString KOTodoView::getWhatsThisText(QPoint p) | 555 | QString KOTodoView::getWhatsThisText(QPoint p) |
556 | { | 556 | { |
557 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); | 557 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); |
558 | if ( item ) | 558 | if ( item ) |
559 | return KIncidenceFormatter::instance()->getFormattedText( item->todo() ); | 559 | return KIncidenceFormatter::instance()->getFormattedText( item->todo(), |
560 | KOPrefs::instance()->mWTshowDetails, | ||
561 | KOPrefs::instance()->mWTshowCreated, | ||
562 | KOPrefs::instance()->mWTshowChanged); | ||
560 | return i18n("That is the todo view" ); | 563 | return i18n("That is the todo view" ); |
561 | 564 | ||
562 | } | 565 | } |
563 | 566 | ||
564 | void KOTodoView::jumpToDate () | 567 | void KOTodoView::jumpToDate () |
565 | { | 568 | { |
566 | // if (mActiveItem) { | 569 | // if (mActiveItem) { |
567 | // mActiveItem->todo()); | 570 | // mActiveItem->todo()); |
568 | // if ( mActiveItem->todo()->hasDueDate() ) | 571 | // if ( mActiveItem->todo()->hasDueDate() ) |
569 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); | 572 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); |
570 | } | 573 | } |
571 | void KOTodoView::paintNeeded() | 574 | void KOTodoView::paintNeeded() |
572 | { | 575 | { |
573 | if ( mPendingUpdateBeforeRepaint ) { | 576 | if ( mPendingUpdateBeforeRepaint ) { |
574 | updateView(); | 577 | updateView(); |
575 | mPendingUpdateBeforeRepaint = false; | 578 | mPendingUpdateBeforeRepaint = false; |
576 | } | 579 | } |
577 | } | 580 | } |
578 | void KOTodoView::paintEvent(QPaintEvent * pevent) | 581 | void KOTodoView::paintEvent(QPaintEvent * pevent) |
579 | { | 582 | { |
580 | if ( mPendingUpdateBeforeRepaint ) { | 583 | if ( mPendingUpdateBeforeRepaint ) { |
581 | updateView(); | 584 | updateView(); |
582 | mPendingUpdateBeforeRepaint = false; | 585 | mPendingUpdateBeforeRepaint = false; |
583 | } | 586 | } |
584 | KOrg::BaseView::paintEvent( pevent); | 587 | KOrg::BaseView::paintEvent( pevent); |
585 | } | 588 | } |
586 | 589 | ||
587 | void KOTodoView::updateView() | 590 | void KOTodoView::updateView() |
588 | { | 591 | { |
589 | pendingSubtodo = 0; | 592 | pendingSubtodo = 0; |
590 | if ( mBlockUpdate ) { | 593 | if ( mBlockUpdate ) { |
591 | return; | 594 | return; |
592 | } | 595 | } |
593 | if ( !isVisible() ) { | 596 | if ( !isVisible() ) { |
594 | mPendingUpdateBeforeRepaint = true; | 597 | mPendingUpdateBeforeRepaint = true; |
595 | return; | 598 | return; |
596 | } | 599 | } |
597 | //qDebug("KOTodoView::updateView() %x", this); | 600 | //qDebug("KOTodoView::updateView() %x", this); |
598 | if ( isFlatDisplay ) { | 601 | if ( isFlatDisplay ) { |
599 | displayAllFlat(); | 602 | displayAllFlat(); |
600 | return; | 603 | return; |
601 | } | 604 | } |
602 | //qDebug("update "); | 605 | //qDebug("update "); |
603 | // kdDebug() << "KOTodoView::updateView()" << endl; | 606 | // kdDebug() << "KOTodoView::updateView()" << endl; |
604 | QFont fo = KOPrefs::instance()->mTodoViewFont; | 607 | QFont fo = KOPrefs::instance()->mTodoViewFont; |
605 | mTodoListView->clear(); | 608 | mTodoListView->clear(); |
606 | if ( mName == "todolistsmall" ) { | 609 | if ( mName == "todolistsmall" ) { |
607 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { | 610 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { |
608 | int ps = fo.pointSize() -2; | 611 | int ps = fo.pointSize() -2; |
609 | if ( ps > 12 ) | 612 | if ( ps > 12 ) |
610 | ps -= 2; | 613 | ps -= 2; |
611 | fo.setPointSize( ps ); | 614 | fo.setPointSize( ps ); |
612 | } | 615 | } |
613 | } | 616 | } |
614 | 617 | ||
615 | mTodoListView->setFont( fo ); | 618 | mTodoListView->setFont( fo ); |
616 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); | 619 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); |
617 | //mTodoListView->header()->setMaximumHeight(fm.height()); | 620 | //mTodoListView->header()->setMaximumHeight(fm.height()); |
618 | QPtrList<Todo> todoList = calendar()->todos(); | 621 | QPtrList<Todo> todoList = calendar()->todos(); |
619 | 622 | ||
620 | /* | 623 | /* |
621 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; | 624 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; |
622 | Event *t; | 625 | Event *t; |
623 | for(t = todoList.first(); t; t = todoList.next()) { | 626 | for(t = todoList.first(); t; t = todoList.next()) { |
624 | kdDebug() << " " << t->getSummary() << endl; | 627 | kdDebug() << " " << t->getSummary() << endl; |
625 | 628 | ||
626 | if (t->getRelatedTo()) { | 629 | if (t->getRelatedTo()) { |
627 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; | 630 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; |
628 | } | 631 | } |
629 | 632 | ||
630 | QPtrList<Event> l = t->getRelations(); | 633 | QPtrList<Event> l = t->getRelations(); |
631 | Event *c; | 634 | Event *c; |
632 | for(c=l.first();c;c=l.next()) { | 635 | for(c=l.first();c;c=l.next()) { |
633 | kdDebug() << " - relation: " << c->getSummary() << endl; | 636 | kdDebug() << " - relation: " << c->getSummary() << endl; |
634 | } | 637 | } |
635 | } | 638 | } |
636 | */ | 639 | */ |
637 | 640 | ||
638 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a | 641 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a |
639 | // specific order of events. That means that we have to generate parent items | 642 | // specific order of events. That means that we have to generate parent items |
640 | // recursively for proper hierarchical display of Todos. | 643 | // recursively for proper hierarchical display of Todos. |
641 | mTodoMap.clear(); | 644 | mTodoMap.clear(); |
642 | Todo *todo; | 645 | Todo *todo; |
643 | todo = todoList.first();// todo; todo = todoList.next()) { | 646 | todo = todoList.first();// todo; todo = todoList.next()) { |
644 | while ( todo ) { | 647 | while ( todo ) { |
645 | bool next = true; | 648 | bool next = true; |
646 | // qDebug("todo %s ", todo->summary().latin1()); | 649 | // qDebug("todo %s ", todo->summary().latin1()); |
647 | Incidence *incidence = todo->relatedTo(); | 650 | Incidence *incidence = todo->relatedTo(); |
648 | while ( incidence ) { | 651 | while ( incidence ) { |
649 | if ( incidence->type() == "Todo") { | 652 | if ( incidence->type() == "Todo") { |
650 | //qDebug("related %s ",incidence->summary().latin1() ); | 653 | //qDebug("related %s ",incidence->summary().latin1() ); |
651 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { | 654 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { |
652 | //qDebug("related not found "); | 655 | //qDebug("related not found "); |
653 | todoList.remove( ); | 656 | todoList.remove( ); |
654 | todo = todoList.current(); | 657 | todo = todoList.current(); |
655 | next = false; | 658 | next = false; |
656 | incidence = 0; | 659 | incidence = 0; |
657 | 660 | ||
658 | } else { | 661 | } else { |
659 | //qDebug("related found "); | 662 | //qDebug("related found "); |
660 | incidence = incidence->relatedTo(); | 663 | incidence = incidence->relatedTo(); |
661 | } | 664 | } |
662 | } else | 665 | } else |
663 | incidence = 0; | 666 | incidence = 0; |
664 | } | 667 | } |
665 | if ( next ) | 668 | if ( next ) |
666 | todo = todoList.next(); | 669 | todo = todoList.next(); |
667 | } | 670 | } |
668 | // qDebug("again .... "); | 671 | // qDebug("again .... "); |
669 | // for(todo = todoList.first(); todo; todo = todoList.next()) { | 672 | // for(todo = todoList.first(); todo; todo = todoList.next()) { |
670 | 673 | ||
671 | // qDebug("yytodo %s ", todo->summary().latin1()); | 674 | // qDebug("yytodo %s ", todo->summary().latin1()); |
672 | // } | 675 | // } |
673 | //qDebug("for "); | 676 | //qDebug("for "); |
674 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 677 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
675 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) | 678 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) |
676 | { | 679 | { |
677 | insertTodoItem(todo); | 680 | insertTodoItem(todo); |
678 | } | 681 | } |
679 | } | 682 | } |
680 | //qDebug("for end "); | 683 | //qDebug("for end "); |
681 | // Restore opened/closed state | 684 | // Restore opened/closed state |
682 | mTodoListView->blockSignals( true ); | 685 | mTodoListView->blockSignals( true ); |
683 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); | 686 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); |
684 | mTodoListView->blockSignals( false ); | 687 | mTodoListView->blockSignals( false ); |
685 | mTodoListView->setFocus(); | 688 | mTodoListView->setFocus(); |
686 | processSelectionChange(); | 689 | processSelectionChange(); |
687 | } | 690 | } |
688 | 691 | ||
689 | bool KOTodoView::checkTodo( Todo * todo ) | 692 | bool KOTodoView::checkTodo( Todo * todo ) |
690 | { | 693 | { |
691 | 694 | ||
692 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) | 695 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) |
693 | return false; | 696 | return false; |
694 | if ( !todo->isCompleted() ) { | 697 | if ( !todo->isCompleted() ) { |
695 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) | 698 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) |
696 | return true; | 699 | return true; |
697 | } | 700 | } |
698 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { | 701 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { |
699 | if ( todo->hasStartDate() ) | 702 | if ( todo->hasStartDate() ) |
700 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) | 703 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) |
701 | return false; | 704 | return false; |
702 | if ( todo->hasDueDate() ) | 705 | if ( todo->hasDueDate() ) |
703 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) | 706 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) |
704 | return false; | 707 | return false; |
705 | } | 708 | } |
706 | return true; | 709 | return true; |
707 | } | 710 | } |
708 | 711 | ||
709 | void KOTodoView::restoreItemState( QListViewItem *item ) | 712 | void KOTodoView::restoreItemState( QListViewItem *item ) |
710 | { | 713 | { |
711 | pendingSubtodo = 0; | 714 | pendingSubtodo = 0; |
712 | while( item ) { | 715 | while( item ) { |
713 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 716 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
714 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); | 717 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); |
715 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); | 718 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); |
716 | item = item->nextSibling(); | 719 | item = item->nextSibling(); |
717 | } | 720 | } |
718 | } | 721 | } |
719 | 722 | ||
720 | 723 | ||
721 | QMap<Todo *,KOTodoViewItem *>::ConstIterator | 724 | QMap<Todo *,KOTodoViewItem *>::ConstIterator |
722 | KOTodoView::insertTodoItem(Todo *todo) | 725 | KOTodoView::insertTodoItem(Todo *todo) |
723 | { | 726 | { |
724 | 727 | ||
725 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; | 728 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; |
726 | // TODO: Check, if dynmaic cast is necessary | 729 | // TODO: Check, if dynmaic cast is necessary |
727 | 730 | ||
728 | pendingSubtodo = 0; | 731 | pendingSubtodo = 0; |
729 | Incidence *incidence = todo->relatedTo(); | 732 | Incidence *incidence = todo->relatedTo(); |
730 | if (incidence && incidence->type() == "Todo") { | 733 | if (incidence && incidence->type() == "Todo") { |
731 | Todo *relatedTodo = static_cast<Todo *>(incidence); | 734 | Todo *relatedTodo = static_cast<Todo *>(incidence); |
732 | 735 | ||
733 | // kdDebug() << " has Related" << endl; | 736 | // kdDebug() << " has Related" << endl; |
734 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 737 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
735 | itemIterator = mTodoMap.find(relatedTodo); | 738 | itemIterator = mTodoMap.find(relatedTodo); |
736 | if (itemIterator == mTodoMap.end()) { | 739 | if (itemIterator == mTodoMap.end()) { |
737 | // kdDebug() << " related not yet in list" << endl; | 740 | // kdDebug() << " related not yet in list" << endl; |
738 | itemIterator = insertTodoItem (relatedTodo); | 741 | itemIterator = insertTodoItem (relatedTodo); |
739 | } | 742 | } |
740 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem | 743 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem |
741 | // and one into the map. Sure finding is more easy but why? -zecke | 744 | // and one into the map. Sure finding is more easy but why? -zecke |
742 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); | 745 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); |
743 | return mTodoMap.insert(todo,todoItem); | 746 | return mTodoMap.insert(todo,todoItem); |
744 | } else { | 747 | } else { |
745 | // kdDebug() << " no Related" << endl; | 748 | // kdDebug() << " no Related" << endl; |
746 | // see above -zecke | 749 | // see above -zecke |
747 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 750 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
748 | return mTodoMap.insert(todo,todoItem); | 751 | return mTodoMap.insert(todo,todoItem); |
749 | } | 752 | } |
750 | } | 753 | } |
751 | 754 | ||
752 | 755 | ||
753 | void KOTodoView::updateConfig() | 756 | void KOTodoView::updateConfig() |
754 | { | 757 | { |
755 | updateView(); | 758 | updateView(); |
756 | mTodoListView->repaintContents(); | 759 | mTodoListView->repaintContents(); |
757 | } | 760 | } |
758 | 761 | ||
759 | QPtrList<Incidence> KOTodoView::selectedIncidences() | 762 | QPtrList<Incidence> KOTodoView::selectedIncidences() |
760 | { | 763 | { |
761 | QPtrList<Incidence> selected; | 764 | QPtrList<Incidence> selected; |
762 | 765 | ||
763 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 766 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
764 | // if (!item) item = mActiveItem; | 767 | // if (!item) item = mActiveItem; |
765 | if (item) selected.append(item->todo()); | 768 | if (item) selected.append(item->todo()); |
766 | 769 | ||
767 | return selected; | 770 | return selected; |
768 | } | 771 | } |
769 | 772 | ||
770 | QPtrList<Todo> KOTodoView::selectedTodos() | 773 | QPtrList<Todo> KOTodoView::selectedTodos() |
771 | { | 774 | { |
772 | QPtrList<Todo> selected; | 775 | QPtrList<Todo> selected; |
773 | 776 | ||
774 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 777 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
775 | // if (!item) item = mActiveItem; | 778 | // if (!item) item = mActiveItem; |
776 | if (item) selected.append(item->todo()); | 779 | if (item) selected.append(item->todo()); |
777 | 780 | ||
778 | return selected; | 781 | return selected; |
779 | } | 782 | } |
780 | 783 | ||
781 | void KOTodoView::changeEventDisplay(Event *, int) | 784 | void KOTodoView::changeEventDisplay(Event *, int) |
782 | { | 785 | { |
783 | updateView(); | 786 | updateView(); |
784 | } | 787 | } |
785 | 788 | ||
786 | void KOTodoView::showDates(const QDate &, const QDate &) | 789 | void KOTodoView::showDates(const QDate &, const QDate &) |
787 | { | 790 | { |
788 | } | 791 | } |
789 | 792 | ||
790 | void KOTodoView::showEvents(QPtrList<Event>) | 793 | void KOTodoView::showEvents(QPtrList<Event>) |
791 | { | 794 | { |
792 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; | 795 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; |
793 | } | 796 | } |
794 | 797 | ||
795 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 798 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
796 | const QDate &td) | 799 | const QDate &td) |
797 | { | 800 | { |
798 | #ifndef KORG_NOPRINTER | 801 | #ifndef KORG_NOPRINTER |
799 | calPrinter->preview(CalPrinter::Todolist, fd, td); | 802 | calPrinter->preview(CalPrinter::Todolist, fd, td); |
800 | #endif | 803 | #endif |
801 | } | 804 | } |
802 | 805 | ||
803 | void KOTodoView::editItem(QListViewItem *item ) | 806 | void KOTodoView::editItem(QListViewItem *item ) |
804 | { | 807 | { |
805 | // qDebug("editItem(QListViewItem *item ) "); | 808 | // qDebug("editItem(QListViewItem *item ) "); |
806 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); | 809 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); |
807 | } | 810 | } |
808 | 811 | ||
809 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) | 812 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) |
810 | { | 813 | { |
811 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); | 814 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); |
812 | } | 815 | } |
813 | 816 | ||
814 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) | 817 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) |
815 | { | 818 | { |
816 | pendingSubtodo = 0; | 819 | pendingSubtodo = 0; |
817 | mActiveItem = (KOTodoViewItem *)item; | 820 | mActiveItem = (KOTodoViewItem *)item; |
818 | if (item) { | 821 | if (item) { |
819 | switch (column){ | 822 | switch (column){ |
820 | case 1: | 823 | case 1: |
821 | mPriorityPopupMenu->popup(QCursor::pos ()); break; | 824 | mPriorityPopupMenu->popup(QCursor::pos ()); break; |
822 | case 2: | 825 | case 2: |
823 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; | 826 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; |
824 | case 3: | 827 | case 3: |
825 | moveTodo(); | 828 | moveTodo(); |
826 | break; | 829 | break; |
827 | case 8: | 830 | case 8: |
828 | getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; | 831 | getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; |
829 | default: | 832 | default: |
830 | mItemPopupMenu->popup(QCursor::pos()); | 833 | mItemPopupMenu->popup(QCursor::pos()); |
831 | } | 834 | } |
832 | } else mPopupMenu->popup(QCursor::pos()); | 835 | } else mPopupMenu->popup(QCursor::pos()); |
833 | } | 836 | } |
834 | void KOTodoView::newTodo() | 837 | void KOTodoView::newTodo() |
835 | { | 838 | { |
836 | emit newTodoSignal(); | 839 | emit newTodoSignal(); |
837 | } | 840 | } |
838 | 841 | ||
839 | void KOTodoView::newSubTodo() | 842 | void KOTodoView::newSubTodo() |
840 | { | 843 | { |
841 | if (mActiveItem) { | 844 | if (mActiveItem) { |
842 | emit newSubTodoSignal(mActiveItem->todo()); | 845 | emit newSubTodoSignal(mActiveItem->todo()); |
843 | } | 846 | } |
844 | } | 847 | } |
845 | void KOTodoView::unparentTodo() | 848 | void KOTodoView::unparentTodo() |
846 | { | 849 | { |
847 | if (mActiveItem) { | 850 | if (mActiveItem) { |
848 | emit unparentTodoSignal(mActiveItem->todo()); | 851 | emit unparentTodoSignal(mActiveItem->todo()); |
849 | } | 852 | } |
850 | } | 853 | } |
851 | 854 | ||
852 | void KOTodoView::reparentTodo() | 855 | void KOTodoView::reparentTodo() |
853 | { | 856 | { |
854 | if (mActiveItem) { | 857 | if (mActiveItem) { |
855 | qDebug("KOTodoView::reparentTodo() "); | 858 | qDebug("KOTodoView::reparentTodo() "); |
856 | topLevelWidget()->setCaption(i18n("Click on new parent item")); | 859 | topLevelWidget()->setCaption(i18n("Click on new parent item")); |
857 | pendingSubtodo = mActiveItem; | 860 | pendingSubtodo = mActiveItem; |
858 | } | 861 | } |
859 | } | 862 | } |
860 | void KOTodoView::editTodo() | 863 | void KOTodoView::editTodo() |
861 | { | 864 | { |
862 | if (mActiveItem) { | 865 | if (mActiveItem) { |
863 | emit editTodoSignal(mActiveItem->todo()); | 866 | emit editTodoSignal(mActiveItem->todo()); |
864 | } | 867 | } |
865 | } | 868 | } |
866 | void KOTodoView::cloneTodo() | 869 | void KOTodoView::cloneTodo() |
867 | { | 870 | { |
868 | if (mActiveItem) { | 871 | if (mActiveItem) { |
869 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); | 872 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); |
870 | } | 873 | } |
871 | } | 874 | } |
872 | void KOTodoView::cancelTodo() | 875 | void KOTodoView::cancelTodo() |
873 | { | 876 | { |
874 | if (mActiveItem) { | 877 | if (mActiveItem) { |
875 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); | 878 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); |
876 | } | 879 | } |
877 | } | 880 | } |
878 | void KOTodoView::moveTodo() | 881 | void KOTodoView::moveTodo() |
879 | { | 882 | { |
880 | if (mActiveItem) { | 883 | if (mActiveItem) { |
881 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); | 884 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); |
882 | } | 885 | } |
883 | } | 886 | } |
884 | void KOTodoView::beamTodo() | 887 | void KOTodoView::beamTodo() |
885 | { | 888 | { |
886 | if (mActiveItem) { | 889 | if (mActiveItem) { |
887 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); | 890 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); |
888 | } | 891 | } |
889 | } | 892 | } |
890 | 893 | ||
891 | 894 | ||
892 | void KOTodoView::showTodo() | 895 | void KOTodoView::showTodo() |
893 | { | 896 | { |
894 | if (mActiveItem) { | 897 | if (mActiveItem) { |
895 | emit showTodoSignal(mActiveItem->todo()); | 898 | emit showTodoSignal(mActiveItem->todo()); |
896 | } | 899 | } |
897 | } | 900 | } |
898 | 901 | ||
899 | void KOTodoView::deleteTodo() | 902 | void KOTodoView::deleteTodo() |
900 | { | 903 | { |
901 | if (mActiveItem) { | 904 | if (mActiveItem) { |
902 | emit deleteTodoSignal(mActiveItem->todo()); | 905 | emit deleteTodoSignal(mActiveItem->todo()); |
903 | } | 906 | } |
904 | } | 907 | } |
905 | 908 | ||
906 | void KOTodoView::setNewPriority(int index) | 909 | void KOTodoView::setNewPriority(int index) |
907 | { | 910 | { |
908 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 911 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
909 | mActiveItem->todo()->setPriority(mPriority[index]); | 912 | mActiveItem->todo()->setPriority(mPriority[index]); |
910 | mActiveItem->construct(); | 913 | mActiveItem->construct(); |
911 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); | 914 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); |
912 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 915 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
913 | } | 916 | } |
914 | } | 917 | } |
915 | 918 | ||
916 | void KOTodoView::setNewPercentage(int index) | 919 | void KOTodoView::setNewPercentage(int index) |
917 | { | 920 | { |
918 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 921 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
919 | 922 | ||
920 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { | 923 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { |
921 | mActiveItem->setOn( true ); | 924 | mActiveItem->setOn( true ); |
922 | return; | 925 | return; |
923 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { | 926 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { |
924 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); | 927 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); |
925 | if ( par && par->isOn() ) | 928 | if ( par && par->isOn() ) |
926 | par->setOn( false ); | 929 | par->setOn( false ); |
927 | } | 930 | } |
928 | if (mPercentage[index] == 100) { | 931 | if (mPercentage[index] == 100) { |
929 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); | 932 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); |
930 | } else { | 933 | } else { |
931 | mActiveItem->todo()->setCompleted(false); | 934 | mActiveItem->todo()->setCompleted(false); |
932 | } | 935 | } |
933 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); | 936 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); |
934 | mActiveItem->construct(); | 937 | mActiveItem->construct(); |
935 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); | 938 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); |
936 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 939 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
937 | } | 940 | } |
938 | } | 941 | } |
939 | 942 | ||
940 | 943 | ||
941 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) | 944 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) |
942 | { | 945 | { |
943 | QPopupMenu* tempMenu = new QPopupMenu (this); | 946 | QPopupMenu* tempMenu = new QPopupMenu (this); |
944 | QStringList checkedCategories = todoItem->todo()->categories (); | 947 | QStringList checkedCategories = todoItem->todo()->categories (); |
945 | 948 | ||
946 | tempMenu->setCheckable (true); | 949 | tempMenu->setCheckable (true); |
947 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 950 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
948 | it != KOPrefs::instance()->mCustomCategories.end (); | 951 | it != KOPrefs::instance()->mCustomCategories.end (); |
949 | ++it) { | 952 | ++it) { |
950 | int index = tempMenu->insertItem (*it); | 953 | int index = tempMenu->insertItem (*it); |
951 | mCategory[index] = *it; | 954 | mCategory[index] = *it; |
952 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); | 955 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); |
953 | } | 956 | } |
954 | 957 | ||
955 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | 958 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); |
956 | return tempMenu; | 959 | return tempMenu; |
957 | 960 | ||
958 | 961 | ||
959 | } | 962 | } |
960 | void KOTodoView::changedCategories(int index) | 963 | void KOTodoView::changedCategories(int index) |
961 | { | 964 | { |
962 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 965 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
963 | QStringList categories = mActiveItem->todo()->categories (); | 966 | QStringList categories = mActiveItem->todo()->categories (); |
964 | QString colcat = categories.first(); | 967 | QString colcat = categories.first(); |
965 | if (categories.find (mCategory[index]) != categories.end ()) | 968 | if (categories.find (mCategory[index]) != categories.end ()) |
966 | categories.remove (mCategory[index]); | 969 | categories.remove (mCategory[index]); |
967 | else | 970 | else |
968 | categories.insert (categories.end(), mCategory[index]); | 971 | categories.insert (categories.end(), mCategory[index]); |
969 | categories.sort (); | 972 | categories.sort (); |
970 | if ( !colcat.isEmpty() ) { | 973 | if ( !colcat.isEmpty() ) { |
971 | if ( categories.find ( colcat ) != categories.end () ) { | 974 | if ( categories.find ( colcat ) != categories.end () ) { |
972 | categories.remove( colcat ); | 975 | categories.remove( colcat ); |
973 | categories.prepend( colcat ); | 976 | categories.prepend( colcat ); |
974 | } | 977 | } |
975 | } | 978 | } |
976 | mActiveItem->todo()->setCategories (categories); | 979 | mActiveItem->todo()->setCategories (categories); |
977 | mActiveItem->construct(); | 980 | mActiveItem->construct(); |
978 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 981 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
979 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); | 982 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); |
980 | } | 983 | } |
981 | } | 984 | } |
982 | void KOTodoView::itemDoubleClicked(QListViewItem *item) | 985 | void KOTodoView::itemDoubleClicked(QListViewItem *item) |
983 | { | 986 | { |
984 | if ( pendingSubtodo != 0 ) { | 987 | if ( pendingSubtodo != 0 ) { |
985 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 988 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
986 | } | 989 | } |
987 | pendingSubtodo = 0; | 990 | pendingSubtodo = 0; |
988 | if (!item) { | 991 | if (!item) { |
989 | newTodo(); | 992 | newTodo(); |
990 | return; | 993 | return; |
991 | } | 994 | } |
992 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 995 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
993 | editItem( item ); | 996 | editItem( item ); |
994 | else | 997 | else |
995 | showItem( item , QPoint(), 0 ); | 998 | showItem( item , QPoint(), 0 ); |
996 | } | 999 | } |
997 | void KOTodoView::itemClicked(QListViewItem *item) | 1000 | void KOTodoView::itemClicked(QListViewItem *item) |
998 | { | 1001 | { |
999 | 1002 | ||
1000 | if (!item) { | 1003 | if (!item) { |
1001 | if ( pendingSubtodo != 0 ) { | 1004 | if ( pendingSubtodo != 0 ) { |
1002 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1005 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1003 | } | 1006 | } |
1004 | pendingSubtodo = 0; | 1007 | pendingSubtodo = 0; |
1005 | return; | 1008 | return; |
1006 | } | 1009 | } |
1007 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1010 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1008 | if ( pendingSubtodo != 0 ) { | 1011 | if ( pendingSubtodo != 0 ) { |
1009 | bool allowReparent = true; | 1012 | bool allowReparent = true; |
1010 | QListViewItem *par = item; | 1013 | QListViewItem *par = item; |
1011 | while ( par ) { | 1014 | while ( par ) { |
1012 | if ( par == pendingSubtodo ) { | 1015 | if ( par == pendingSubtodo ) { |
1013 | allowReparent = false; | 1016 | allowReparent = false; |
1014 | break; | 1017 | break; |
1015 | } | 1018 | } |
1016 | par = par->parent(); | 1019 | par = par->parent(); |
1017 | } | 1020 | } |
1018 | if ( !allowReparent ) { | 1021 | if ( !allowReparent ) { |
1019 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); | 1022 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); |
1020 | qDebug("Recursive reparenting not possible "); | 1023 | qDebug("Recursive reparenting not possible "); |
1021 | pendingSubtodo = 0; | 1024 | pendingSubtodo = 0; |
1022 | } else { | 1025 | } else { |
1023 | Todo* newParent = todoItem->todo(); | 1026 | Todo* newParent = todoItem->todo(); |
1024 | Todo* newSub = pendingSubtodo->todo(); | 1027 | Todo* newSub = pendingSubtodo->todo(); |
1025 | pendingSubtodo = 0; | 1028 | pendingSubtodo = 0; |
1026 | emit reparentTodoSignal( newParent,newSub ); | 1029 | emit reparentTodoSignal( newParent,newSub ); |
1027 | return; | 1030 | return; |
1028 | } | 1031 | } |
1029 | } | 1032 | } |
1030 | #if 0 | 1033 | #if 0 |
1031 | // handled by the item itself | 1034 | // handled by the item itself |
1032 | bool completed = todoItem->todo()->isCompleted(); // Completed or not? | 1035 | bool completed = todoItem->todo()->isCompleted(); // Completed or not? |
1033 | qDebug("com %d ",completed ); | 1036 | qDebug("com %d ",completed ); |
1034 | qDebug("itemclicked "); | 1037 | qDebug("itemclicked "); |
1035 | if (todoItem->isOn()) { | 1038 | if (todoItem->isOn()) { |
1036 | qDebug("on "); | 1039 | qDebug("on "); |
1037 | if (!completed) { | 1040 | if (!completed) { |
1038 | qDebug("set true "); | 1041 | qDebug("set true "); |
1039 | todoItem->todo()->setCompleted(QDateTime::currentDateTime()); | 1042 | todoItem->todo()->setCompleted(QDateTime::currentDateTime()); |
1040 | } | 1043 | } |
1041 | } else { | 1044 | } else { |
1042 | qDebug("not on "); | 1045 | qDebug("not on "); |
1043 | if (completed) { | 1046 | if (completed) { |
1044 | qDebug("set false "); | 1047 | qDebug("set false "); |
1045 | todoItem->todo()->setCompleted(false); | 1048 | todoItem->todo()->setCompleted(false); |
1046 | } | 1049 | } |
1047 | } | 1050 | } |
1048 | #endif | 1051 | #endif |
1049 | } | 1052 | } |
1050 | 1053 | ||
1051 | void KOTodoView::setDocumentId( const QString &id ) | 1054 | void KOTodoView::setDocumentId( const QString &id ) |
1052 | { | 1055 | { |
1053 | kdDebug() << "KOTodoView::setDocumentId()" << endl; | 1056 | kdDebug() << "KOTodoView::setDocumentId()" << endl; |
1054 | 1057 | ||
1055 | mDocPrefs->setDoc( id ); | 1058 | mDocPrefs->setDoc( id ); |
1056 | } | 1059 | } |
1057 | 1060 | ||
1058 | void KOTodoView::itemStateChanged( QListViewItem *item ) | 1061 | void KOTodoView::itemStateChanged( QListViewItem *item ) |
1059 | { | 1062 | { |
1060 | if (!item) return; | 1063 | if (!item) return; |
1061 | 1064 | ||
1062 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1065 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1063 | 1066 | ||
1064 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; | 1067 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; |
1065 | 1068 | ||
1066 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); | 1069 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); |
1067 | } | 1070 | } |
1068 | 1071 | ||
1069 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const | 1072 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const |
1070 | { | 1073 | { |
1071 | mTodoListView->saveLayout(config,group); | 1074 | mTodoListView->saveLayout(config,group); |
1072 | } | 1075 | } |
1073 | 1076 | ||
1074 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) | 1077 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) |
1075 | { | 1078 | { |
1076 | mTodoListView->restoreLayout(config,group); | 1079 | mTodoListView->restoreLayout(config,group); |
1077 | } | 1080 | } |
1078 | 1081 | ||
1079 | void KOTodoView::processSelectionChange() | 1082 | void KOTodoView::processSelectionChange() |
1080 | { | 1083 | { |
1081 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; | 1084 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; |
1082 | 1085 | ||
1083 | KOTodoViewItem *item = | 1086 | KOTodoViewItem *item = |
1084 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); | 1087 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); |
1085 | 1088 | ||
1086 | if ( !item ) { | 1089 | if ( !item ) { |
1087 | emit incidenceSelected( 0 ); | 1090 | emit incidenceSelected( 0 ); |
1088 | } else { | 1091 | } else { |
1089 | emit incidenceSelected( item->todo() ); | 1092 | emit incidenceSelected( item->todo() ); |
1090 | } | 1093 | } |
1091 | } | 1094 | } |
1092 | 1095 | ||
1093 | void KOTodoView::modified(bool b) | 1096 | void KOTodoView::modified(bool b) |
1094 | { | 1097 | { |
1095 | emit isModified(b); | 1098 | emit isModified(b); |
1096 | } | 1099 | } |
1097 | void KOTodoView::setTodoModified( Todo* todo ) | 1100 | void KOTodoView::setTodoModified( Todo* todo ) |
1098 | { | 1101 | { |
1099 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); | 1102 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); |
1100 | } | 1103 | } |
1101 | void KOTodoView::clearSelection() | 1104 | void KOTodoView::clearSelection() |
1102 | { | 1105 | { |
1103 | mTodoListView->selectAll( false ); | 1106 | mTodoListView->selectAll( false ); |
1104 | } | 1107 | } |
1105 | void KOTodoView::setAllOpen() | 1108 | void KOTodoView::setAllOpen() |
1106 | { | 1109 | { |
1107 | if ( isFlatDisplay ) { | 1110 | if ( isFlatDisplay ) { |
1108 | isFlatDisplay = false; | 1111 | isFlatDisplay = false; |
1109 | mPopupMenu->setItemChecked( 8,false ); | 1112 | mPopupMenu->setItemChecked( 8,false ); |
1110 | updateView(); | 1113 | updateView(); |
1111 | } | 1114 | } |
1112 | setOpen(mTodoListView->firstChild(), true); | 1115 | setOpen(mTodoListView->firstChild(), true); |
1113 | } | 1116 | } |
1114 | void KOTodoView::setAllClose() | 1117 | void KOTodoView::setAllClose() |
1115 | { | 1118 | { |
1116 | if ( isFlatDisplay ) { | 1119 | if ( isFlatDisplay ) { |
1117 | isFlatDisplay = false; | 1120 | isFlatDisplay = false; |
1118 | mPopupMenu->setItemChecked( 8,false ); | 1121 | mPopupMenu->setItemChecked( 8,false ); |
1119 | updateView(); | 1122 | updateView(); |
1120 | } | 1123 | } |
1121 | setOpen(mTodoListView->firstChild(), false); | 1124 | setOpen(mTodoListView->firstChild(), false); |
1122 | } | 1125 | } |
1123 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) | 1126 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) |
1124 | { | 1127 | { |
1125 | 1128 | ||
1126 | while ( item ) { | 1129 | while ( item ) { |
1127 | setOpen( item->firstChild(), setOpenI ); | 1130 | setOpen( item->firstChild(), setOpenI ); |
1128 | item->setOpen( setOpenI ); | 1131 | item->setOpen( setOpenI ); |
1129 | item = item->nextSibling(); | 1132 | item = item->nextSibling(); |
1130 | } | 1133 | } |
1131 | } | 1134 | } |
1132 | 1135 | ||
1133 | void KOTodoView::displayAllFlat() | 1136 | void KOTodoView::displayAllFlat() |
1134 | { | 1137 | { |
1135 | pendingSubtodo = 0; | 1138 | pendingSubtodo = 0; |
1136 | if ( mBlockUpdate ) { | 1139 | if ( mBlockUpdate ) { |
1137 | return; | 1140 | return; |
1138 | } | 1141 | } |
1139 | mPopupMenu->setItemChecked( 8,true ); | 1142 | mPopupMenu->setItemChecked( 8,true ); |
1140 | isFlatDisplay = true; | 1143 | isFlatDisplay = true; |
1141 | QPtrList<Todo> todoList = calendar()->todos(); | 1144 | QPtrList<Todo> todoList = calendar()->todos(); |
1142 | mTodoMap.clear(); | 1145 | mTodoMap.clear(); |
1143 | mTodoListView->clear(); | 1146 | mTodoListView->clear(); |
1144 | Todo *todo; | 1147 | Todo *todo; |
1145 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 1148 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
1146 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 1149 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
1147 | mTodoMap.insert(todo,todoItem); | 1150 | mTodoMap.insert(todo,todoItem); |
1148 | } | 1151 | } |
1149 | mTodoListView->setFocus(); | 1152 | mTodoListView->setFocus(); |
1150 | processSelectionChange(); | 1153 | processSelectionChange(); |
1151 | } | 1154 | } |
1152 | 1155 | ||
1153 | void KOTodoView::setAllFlat() | 1156 | void KOTodoView::setAllFlat() |
1154 | { | 1157 | { |
1155 | if ( isFlatDisplay ) { | 1158 | if ( isFlatDisplay ) { |
1156 | isFlatDisplay = false; | 1159 | isFlatDisplay = false; |
1157 | mPopupMenu->setItemChecked( 8,false ); | 1160 | mPopupMenu->setItemChecked( 8,false ); |
1158 | updateView(); | 1161 | updateView(); |
1159 | return; | 1162 | return; |
1160 | } | 1163 | } |
1161 | displayAllFlat(); | 1164 | displayAllFlat(); |
1162 | } | 1165 | } |
1163 | 1166 | ||
1164 | void KOTodoView::purgeCompleted() | 1167 | void KOTodoView::purgeCompleted() |
1165 | { | 1168 | { |
1166 | emit purgeCompletedSignal(); | 1169 | emit purgeCompletedSignal(); |
1167 | } | 1170 | } |
1168 | void KOTodoView::toggleQuickTodo() | 1171 | void KOTodoView::toggleQuickTodo() |
1169 | { | 1172 | { |
1170 | if ( mQuickAdd->isVisible() ) { | 1173 | if ( mQuickAdd->isVisible() ) { |
1171 | mQuickAdd->hide(); | 1174 | mQuickAdd->hide(); |
1172 | KOPrefs::instance()->mEnableQuickTodo = false; | 1175 | KOPrefs::instance()->mEnableQuickTodo = false; |
1173 | } | 1176 | } |
1174 | else { | 1177 | else { |
1175 | mQuickAdd->show(); | 1178 | mQuickAdd->show(); |
1176 | KOPrefs::instance()->mEnableQuickTodo = true; | 1179 | KOPrefs::instance()->mEnableQuickTodo = true; |
1177 | } | 1180 | } |
1178 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 1181 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
1179 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 1182 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
1180 | } | 1183 | } |
1181 | 1184 | ||
1182 | void KOTodoView::toggleRunning() | 1185 | void KOTodoView::toggleRunning() |
1183 | { | 1186 | { |
1184 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; | 1187 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; |
1185 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 1188 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
1186 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 1189 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
1187 | updateView(); | 1190 | updateView(); |
1188 | } | 1191 | } |
1189 | 1192 | ||
1190 | void KOTodoView::toggleCompleted() | 1193 | void KOTodoView::toggleCompleted() |
1191 | { | 1194 | { |
1192 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; | 1195 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; |
1193 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 1196 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
1194 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 1197 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
1195 | updateView(); | 1198 | updateView(); |
1196 | } | 1199 | } |
1197 | 1200 | ||
1198 | void KOTodoView::addQuickTodo() | 1201 | void KOTodoView::addQuickTodo() |
1199 | { | 1202 | { |
1200 | Todo *todo = new Todo(); | 1203 | Todo *todo = new Todo(); |
1201 | todo->setSummary(mQuickAdd->text()); | 1204 | todo->setSummary(mQuickAdd->text()); |
1202 | todo->setOrganizer(KOPrefs::instance()->email()); | 1205 | todo->setOrganizer(KOPrefs::instance()->email()); |
1203 | CalFilter * cf = mCalendar->filter(); | 1206 | CalFilter * cf = mCalendar->filter(); |
1204 | if ( cf ) { | 1207 | if ( cf ) { |
1205 | if ( cf->isEnabled()&& cf->showCategories()) { | 1208 | if ( cf->isEnabled()&& cf->showCategories()) { |
1206 | todo->setCategories(cf->categoryList()); | 1209 | todo->setCategories(cf->categoryList()); |
1207 | } | 1210 | } |
1208 | if ( cf->isEnabled() ) | 1211 | if ( cf->isEnabled() ) |
1209 | todo->setSecrecy( cf->getSecrecy()); | 1212 | todo->setSecrecy( cf->getSecrecy()); |
1210 | } | 1213 | } |
1211 | mCalendar->addTodo(todo); | 1214 | mCalendar->addTodo(todo); |
1212 | mQuickAdd->setText(""); | 1215 | mQuickAdd->setText(""); |
1213 | todoModified (todo, KOGlobals::EVENTADDED ); | 1216 | todoModified (todo, KOGlobals::EVENTADDED ); |
1214 | updateView(); | 1217 | updateView(); |
1215 | } | 1218 | } |
1216 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) | 1219 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) |
1217 | { | 1220 | { |
1218 | // e->ignore(); | 1221 | // e->ignore(); |
1219 | //return; | 1222 | //return; |
1220 | //qDebug("KOTodoView::keyPressEvent "); | 1223 | //qDebug("KOTodoView::keyPressEvent "); |
1221 | switch ( e->key() ) { | 1224 | switch ( e->key() ) { |
1222 | case Qt::Key_Down: | 1225 | case Qt::Key_Down: |
1223 | case Qt::Key_Up: | 1226 | case Qt::Key_Up: |
1224 | QWidget::keyPressEvent ( e ); | 1227 | QWidget::keyPressEvent ( e ); |
1225 | break; | 1228 | break; |
1226 | 1229 | ||
1227 | case Qt::Key_Q: | 1230 | case Qt::Key_Q: |
1228 | toggleQuickTodo(); | 1231 | toggleQuickTodo(); |
1229 | break; | 1232 | break; |
1230 | case Qt::Key_U: | 1233 | case Qt::Key_U: |
1231 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1234 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1232 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1235 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1233 | unparentTodo(); | 1236 | unparentTodo(); |
1234 | e->accept(); | 1237 | e->accept(); |
1235 | } else | 1238 | } else |
1236 | e->ignore(); | 1239 | e->ignore(); |
1237 | break; | 1240 | break; |
1238 | case Qt::Key_S: | 1241 | case Qt::Key_S: |
1239 | if ( e->state() == Qt::ControlButton ) { | 1242 | if ( e->state() == Qt::ControlButton ) { |
1240 | e->ignore(); | 1243 | e->ignore(); |
1241 | break; | 1244 | break; |
1242 | } | 1245 | } |
1243 | if ( e->state() == Qt::ShiftButton ) { | 1246 | if ( e->state() == Qt::ShiftButton ) { |
1244 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1247 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1245 | reparentTodo(); | 1248 | reparentTodo(); |
1246 | e->accept(); | 1249 | e->accept(); |
1247 | } else | 1250 | } else |
1248 | e->ignore(); | 1251 | e->ignore(); |
1249 | break; | 1252 | break; |
1250 | case Qt::Key_P: | 1253 | case Qt::Key_P: |
1251 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1254 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1252 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1255 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1253 | if ( pendingSubtodo ) | 1256 | if ( pendingSubtodo ) |
1254 | itemClicked(mActiveItem); | 1257 | itemClicked(mActiveItem); |
1255 | e->accept(); | 1258 | e->accept(); |
1256 | } else | 1259 | } else |
1257 | e->ignore(); | 1260 | e->ignore(); |
1258 | break; | 1261 | break; |
1259 | case Qt::Key_Escape: | 1262 | case Qt::Key_Escape: |
1260 | if ( pendingSubtodo ) { | 1263 | if ( pendingSubtodo ) { |
1261 | itemClicked(0); | 1264 | itemClicked(0); |
1262 | e->accept(); | 1265 | e->accept(); |
1263 | } else | 1266 | } else |
1264 | e->ignore(); | 1267 | e->ignore(); |
1265 | break; | 1268 | break; |
1266 | default: | 1269 | default: |
1267 | e->ignore(); | 1270 | e->ignore(); |
1268 | } | 1271 | } |
1269 | 1272 | ||
1270 | if ( true ) { | 1273 | if ( true ) { |
1271 | if ( e->key() == Qt::Key_I ) { | 1274 | if ( e->key() == Qt::Key_I ) { |
1272 | KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); | 1275 | KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); |
1273 | if ( cn ) { | 1276 | if ( cn ) { |
1274 | mActiveItem = cn; | 1277 | mActiveItem = cn; |
1275 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 1278 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
1276 | if ( ci ){ | 1279 | if ( ci ){ |
1277 | showTodo(); | 1280 | showTodo(); |
1278 | cn = (KOTodoViewItem*)cn->itemBelow(); | 1281 | cn = (KOTodoViewItem*)cn->itemBelow(); |
1279 | if ( cn ) { | 1282 | if ( cn ) { |
1280 | mTodoListView->setCurrentItem ( cn ); | 1283 | mTodoListView->setCurrentItem ( cn ); |
1281 | mTodoListView->ensureItemVisible ( cn ); | 1284 | mTodoListView->ensureItemVisible ( cn ); |
1282 | } | 1285 | } |
1283 | 1286 | ||
1284 | } | 1287 | } |
1285 | } | 1288 | } |
1286 | e->accept(); | 1289 | e->accept(); |
1287 | 1290 | ||
1288 | } | 1291 | } |
1289 | 1292 | ||
1290 | } | 1293 | } |
1291 | 1294 | ||
1292 | } | 1295 | } |
1293 | void KOTodoView::updateTodo( Todo * t, int type ) | 1296 | void KOTodoView::updateTodo( Todo * t, int type ) |
1294 | { | 1297 | { |
1295 | if ( mBlockUpdate) | 1298 | if ( mBlockUpdate) |
1296 | return; | 1299 | return; |
1297 | 1300 | ||
1298 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 1301 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
1299 | itemIterator = mTodoMap.find(t); | 1302 | itemIterator = mTodoMap.find(t); |
1300 | if (itemIterator != mTodoMap.end()) { | 1303 | if (itemIterator != mTodoMap.end()) { |
1301 | (*itemIterator)->construct(); | 1304 | (*itemIterator)->construct(); |
1302 | } else { | 1305 | } else { |
1303 | if ( type == KOGlobals::EVENTADDED ) { | 1306 | if ( type == KOGlobals::EVENTADDED ) { |
1304 | insertTodoItem( t ); | 1307 | insertTodoItem( t ); |
1305 | } | 1308 | } |
1306 | } | 1309 | } |
1307 | 1310 | ||
1308 | } | 1311 | } |
1309 | 1312 | ||
1310 | void KOTodoView::todoModified(Todo * t , int p ) | 1313 | void KOTodoView::todoModified(Todo * t , int p ) |
1311 | { | 1314 | { |
1312 | mBlockUpdate = true; | 1315 | mBlockUpdate = true; |
1313 | emit todoModifiedSignal ( t, p ); | 1316 | emit todoModifiedSignal ( t, p ); |
1314 | mBlockUpdate = false; | 1317 | mBlockUpdate = false; |
1315 | } | 1318 | } |