-rw-r--r-- | korganizer/koagenda.cpp | 5 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 1 | ||||
-rw-r--r-- | korganizer/koprefs.h | 2 | ||||
-rw-r--r-- | korganizer/koprefsdialog.cpp | 16 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 9 |
5 files changed, 23 insertions, 10 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 18c506e..114ed75 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -1,914 +1,915 @@ | |||
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 | Marcus Bains line. | 5 | Marcus Bains line. |
6 | Copyright (c) 2001 Ali Rahimi | 6 | Copyright (c) 2001 Ali Rahimi |
7 | 7 | ||
8 | This program is free software; you can redistribute it and/or modify | 8 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | 9 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2 of the License, or | 10 | the Free Software Foundation; either version 2 of the License, or |
11 | (at your option) any later version. | 11 | (at your option) any later version. |
12 | 12 | ||
13 | This program is distributed in the hope that it will be useful, | 13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. | 16 | GNU General Public License for more details. |
17 | 17 | ||
18 | You should have received a copy of the GNU General Public License | 18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | 19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 | 21 | ||
22 | As a special exception, permission is given to link this program | 22 | As a special exception, permission is given to link this program |
23 | with any edition of Qt, and distribute the resulting executable, | 23 | with any edition of Qt, and distribute the resulting executable, |
24 | without including the source code for Qt in the source distribution. | 24 | without including the source code for Qt in the source distribution. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #ifndef _WIN32_ | 27 | #ifndef _WIN32_ |
28 | #define protected public | 28 | #define protected public |
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #undef protected | 30 | #undef protected |
31 | #endif | 31 | #endif |
32 | #include <qintdict.h> | 32 | #include <qintdict.h> |
33 | #include <qdatetime.h> | 33 | #include <qdatetime.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | #include <qpopupmenu.h> | 35 | #include <qpopupmenu.h> |
36 | #include <qcursor.h> | 36 | #include <qcursor.h> |
37 | #include <qpainter.h> | 37 | #include <qpainter.h> |
38 | 38 | ||
39 | #include <kdebug.h> | 39 | #include <kdebug.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kiconloader.h> | 41 | #include <kiconloader.h> |
42 | #include <kglobal.h> | 42 | #include <kglobal.h> |
43 | 43 | ||
44 | #include "koagendaitem.h" | 44 | #include "koagendaitem.h" |
45 | #include "koprefs.h" | 45 | #include "koprefs.h" |
46 | #include "koglobals.h" | 46 | #include "koglobals.h" |
47 | 47 | ||
48 | #include "koagenda.h" | 48 | #include "koagenda.h" |
49 | 49 | ||
50 | #include <libkcal/event.h> | 50 | #include <libkcal/event.h> |
51 | #include <libkcal/todo.h> | 51 | #include <libkcal/todo.h> |
52 | 52 | ||
53 | #ifndef DESKTOP_VERSION | 53 | #ifndef DESKTOP_VERSION |
54 | #include <qpe/qpeapplication.h> | 54 | #include <qpe/qpeapplication.h> |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | //extern bool globalFlagBlockPainting; | 57 | //extern bool globalFlagBlockPainting; |
58 | extern int globalFlagBlockAgenda; | 58 | extern int globalFlagBlockAgenda; |
59 | extern int globalFlagBlockAgendaItemPaint; | 59 | extern int globalFlagBlockAgendaItemPaint; |
60 | extern int globalFlagBlockAgendaItemUpdate; | 60 | extern int globalFlagBlockAgendaItemUpdate; |
61 | extern int globalFlagBlockStartup; | 61 | extern int globalFlagBlockStartup; |
62 | 62 | ||
63 | //////////////////////////////////////////////////////////////////////////// | 63 | //////////////////////////////////////////////////////////////////////////// |
64 | MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) | 64 | MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) |
65 | : QFrame(_agenda->viewport(),name), agenda(_agenda) | 65 | : QFrame(_agenda->viewport(),name), agenda(_agenda) |
66 | { | 66 | { |
67 | setLineWidth(0); | 67 | setLineWidth(0); |
68 | setMargin(0); | 68 | setMargin(0); |
69 | setBackgroundColor(Qt::red); | 69 | setBackgroundColor(Qt::red); |
70 | minutes = new QTimer(this); | 70 | minutes = new QTimer(this); |
71 | connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); | 71 | connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); |
72 | minutes->start(0, true); | 72 | minutes->start(0, true); |
73 | mTimeBox = new QLabel(this); | 73 | mTimeBox = new QLabel(this); |
74 | mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); | 74 | mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); |
75 | QPalette pal = mTimeBox->palette(); | 75 | QPalette pal = mTimeBox->palette(); |
76 | pal.setColor(QColorGroup::Foreground, Qt::red); | 76 | pal.setColor(QColorGroup::Foreground, Qt::red); |
77 | mTimeBox->setPalette(pal); | 77 | mTimeBox->setPalette(pal); |
78 | //mTimeBox->setAutoMask(true); | 78 | //mTimeBox->setAutoMask(true); |
79 | 79 | ||
80 | agenda->addChild(mTimeBox); | 80 | agenda->addChild(mTimeBox); |
81 | 81 | ||
82 | oldToday = -1; | 82 | oldToday = -1; |
83 | } | 83 | } |
84 | 84 | ||
85 | MarcusBains::~MarcusBains() | 85 | MarcusBains::~MarcusBains() |
86 | { | 86 | { |
87 | delete minutes; | 87 | delete minutes; |
88 | } | 88 | } |
89 | 89 | ||
90 | int MarcusBains::todayColumn() | 90 | int MarcusBains::todayColumn() |
91 | { | 91 | { |
92 | QDate currentDate = QDate::currentDate(); | 92 | QDate currentDate = QDate::currentDate(); |
93 | 93 | ||
94 | DateList dateList = agenda->dateList(); | 94 | DateList dateList = agenda->dateList(); |
95 | DateList::ConstIterator it; | 95 | DateList::ConstIterator it; |
96 | int col = 0; | 96 | int col = 0; |
97 | for(it = dateList.begin(); it != dateList.end(); ++it) { | 97 | for(it = dateList.begin(); it != dateList.end(); ++it) { |
98 | if((*it) == currentDate) | 98 | if((*it) == currentDate) |
99 | return KOGlobals::self()->reverseLayout() ? | 99 | return KOGlobals::self()->reverseLayout() ? |
100 | agenda->columns() - 1 - col : col; | 100 | agenda->columns() - 1 - col : col; |
101 | ++col; | 101 | ++col; |
102 | } | 102 | } |
103 | 103 | ||
104 | return -1; | 104 | return -1; |
105 | } | 105 | } |
106 | void MarcusBains::updateLoc() | 106 | void MarcusBains::updateLoc() |
107 | { | 107 | { |
108 | updateLocation(); | 108 | updateLocation(); |
109 | } | 109 | } |
110 | void MarcusBains::updateLocation(bool recalculate) | 110 | void MarcusBains::updateLocation(bool recalculate) |
111 | { | 111 | { |
112 | 112 | ||
113 | QTime tim = QTime::currentTime(); | 113 | QTime tim = QTime::currentTime(); |
114 | //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1()); | 114 | //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1()); |
115 | if((tim.hour() == 0) && (oldTime.hour()==23)) | 115 | if((tim.hour() == 0) && (oldTime.hour()==23)) |
116 | recalculate = true; | 116 | recalculate = true; |
117 | 117 | ||
118 | int mins = tim.hour()*60 + tim.minute(); | 118 | int mins = tim.hour()*60 + tim.minute(); |
119 | int minutesPerCell = 24 * 60 / agenda->rows(); | 119 | int minutesPerCell = 24 * 60 / agenda->rows(); |
120 | int y = mins*agenda->gridSpacingY()/minutesPerCell; | 120 | int y = mins*agenda->gridSpacingY()/minutesPerCell; |
121 | int today = recalculate ? todayColumn() : oldToday; | 121 | int today = recalculate ? todayColumn() : oldToday; |
122 | int x = agenda->gridSpacingX()*today; | 122 | int x = agenda->gridSpacingX()*today; |
123 | bool disabled = !(KOPrefs::instance()->mMarcusBainsEnabled); | 123 | bool disabled = !(KOPrefs::instance()->mMarcusBainsEnabled); |
124 | 124 | ||
125 | oldTime = tim; | 125 | oldTime = tim; |
126 | oldToday = today; | 126 | oldToday = today; |
127 | 127 | ||
128 | if(disabled || (today<0)) { | 128 | if(disabled || (today<0)) { |
129 | hide(); mTimeBox->hide(); | 129 | hide(); mTimeBox->hide(); |
130 | return; | 130 | return; |
131 | } else { | 131 | } else { |
132 | show(); mTimeBox->show(); | 132 | show(); mTimeBox->show(); |
133 | } | 133 | } |
134 | 134 | ||
135 | if(recalculate) | 135 | if(recalculate) |
136 | setFixedSize(agenda->gridSpacingX(),1); | 136 | setFixedSize(agenda->gridSpacingX(),1); |
137 | agenda->moveChild(this, x, y); | 137 | agenda->moveChild(this, x, y); |
138 | raise(); | 138 | raise(); |
139 | 139 | ||
140 | if(recalculate) | 140 | if(recalculate) |
141 | //mTimeBox->setFont(QFont("helvetica",10)); | 141 | //mTimeBox->setFont(QFont("helvetica",10)); |
142 | mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); | 142 | mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); |
143 | 143 | ||
144 | mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); | 144 | mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); |
145 | mTimeBox->adjustSize(); | 145 | mTimeBox->adjustSize(); |
146 | // the -2 below is there because there is a bug in this program | 146 | // the -2 below is there because there is a bug in this program |
147 | // somewhere, where the last column of this widget is a few pixels | 147 | // somewhere, where the last column of this widget is a few pixels |
148 | // narrower than the other columns. | 148 | // narrower than the other columns. |
149 | int offs = (today==agenda->columns()-1) ? -4 : 0; | 149 | int offs = (today==agenda->columns()-1) ? -4 : 0; |
150 | agenda->moveChild(mTimeBox, | 150 | agenda->moveChild(mTimeBox, |
151 | x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, | 151 | x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, |
152 | y-mTimeBox->height()); | 152 | y-mTimeBox->height()); |
153 | 153 | ||
154 | mTimeBox->raise(); | 154 | mTimeBox->raise(); |
155 | //mTimeBox->setAutoMask(true); | 155 | //mTimeBox->setAutoMask(true); |
156 | minutes->start(5000,true); | 156 | minutes->start(5000,true); |
157 | } | 157 | } |
158 | 158 | ||
159 | 159 | ||
160 | //////////////////////////////////////////////////////////////////////////// | 160 | //////////////////////////////////////////////////////////////////////////// |
161 | 161 | ||
162 | 162 | ||
163 | /* | 163 | /* |
164 | Create an agenda widget with rows rows and columns columns. | 164 | Create an agenda widget with rows rows and columns columns. |
165 | */ | 165 | */ |
166 | KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, | 166 | KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, |
167 | const char *name,WFlags f) : | 167 | const char *name,WFlags f) : |
168 | QScrollView(parent,name,f) | 168 | QScrollView(parent,name,f) |
169 | { | 169 | { |
170 | 170 | ||
171 | mAllAgendaPopup = 0; | 171 | mAllAgendaPopup = 0; |
172 | mColumns = columns; | 172 | mColumns = columns; |
173 | mRows = rows; | 173 | mRows = rows; |
174 | mGridSpacingY = rowSize; | 174 | mGridSpacingY = rowSize; |
175 | mAllDayMode = false; | 175 | mAllDayMode = false; |
176 | #ifndef DESKTOP_VERSION | 176 | #ifndef DESKTOP_VERSION |
177 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 177 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
178 | #endif | 178 | #endif |
179 | mHolidayMask = 0; | 179 | mHolidayMask = 0; |
180 | init(); | 180 | init(); |
181 | } | 181 | } |
182 | 182 | ||
183 | /* | 183 | /* |
184 | Create an agenda widget with columns columns and one row. This is used for | 184 | Create an agenda widget with columns columns and one row. This is used for |
185 | all-day events. | 185 | all-day events. |
186 | */ | 186 | */ |
187 | KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : | 187 | KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : |
188 | QScrollView(parent,name,f) | 188 | QScrollView(parent,name,f) |
189 | { | 189 | { |
190 | mAllAgendaPopup = 0; | 190 | mAllAgendaPopup = 0; |
191 | blockResize = false; | 191 | blockResize = false; |
192 | mColumns = columns; | 192 | mColumns = columns; |
193 | mRows = 1; | 193 | mRows = 1; |
194 | //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); | 194 | //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); |
195 | mGridSpacingY = KOPrefs::instance()->mAllDaySize; | 195 | mGridSpacingY = KOPrefs::instance()->mAllDaySize; |
196 | mAllDayMode = true; | 196 | mAllDayMode = true; |
197 | #ifndef DESKTOP_VERSION | 197 | #ifndef DESKTOP_VERSION |
198 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 198 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
199 | #endif | 199 | #endif |
200 | mHolidayMask = 0; | 200 | mHolidayMask = 0; |
201 | init(); | 201 | init(); |
202 | } | 202 | } |
203 | 203 | ||
204 | 204 | ||
205 | KOAgenda::~KOAgenda() | 205 | KOAgenda::~KOAgenda() |
206 | { | 206 | { |
207 | if(mMarcusBains) delete mMarcusBains; | 207 | if(mMarcusBains) delete mMarcusBains; |
208 | 208 | ||
209 | } | 209 | } |
210 | 210 | ||
211 | Incidence *KOAgenda::selectedIncidence() const | 211 | Incidence *KOAgenda::selectedIncidence() const |
212 | { | 212 | { |
213 | return (mSelectedItem ? mSelectedItem->incidence() : 0); | 213 | return (mSelectedItem ? mSelectedItem->incidence() : 0); |
214 | } | 214 | } |
215 | 215 | ||
216 | 216 | ||
217 | QDate KOAgenda::selectedIncidenceDate() const | 217 | QDate KOAgenda::selectedIncidenceDate() const |
218 | { | 218 | { |
219 | return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); | 219 | return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); |
220 | } | 220 | } |
221 | 221 | ||
222 | 222 | ||
223 | void KOAgenda::init() | 223 | void KOAgenda::init() |
224 | { | 224 | { |
225 | mPopupTimer = new QTimer(this); | 225 | mPopupTimer = new QTimer(this); |
226 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); | 226 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); |
227 | 227 | ||
228 | mNewItemPopup = new QPopupMenu( this ); | 228 | mNewItemPopup = new QPopupMenu( this ); |
229 | connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); | 229 | connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); |
230 | QString pathString = ""; | 230 | QString pathString = ""; |
231 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { | 231 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { |
232 | if ( QApplication::desktop()->width() < 480 ) | 232 | if ( QApplication::desktop()->width() < 480 ) |
233 | pathString += "icons16/"; | 233 | pathString += "icons16/"; |
234 | } else | 234 | } else |
235 | pathString += "iconsmini/"; | 235 | pathString += "iconsmini/"; |
236 | 236 | ||
237 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); | 237 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); |
238 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 ); | 238 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 ); |
239 | mNewItemPopup->insertSeparator ( ); | 239 | mNewItemPopup->insertSeparator ( ); |
240 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); | 240 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); |
241 | mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 ); | 241 | mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 ); |
242 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 ); | 242 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 ); |
243 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 ); | 243 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 ); |
244 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("This month"),6 ); | 244 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("This month"),6 ); |
245 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); | 245 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); |
246 | #ifndef _WIN32_ | 246 | #ifndef _WIN32_ |
247 | int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase | 247 | int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase |
248 | viewport()->setWFlags ( wflags); | 248 | viewport()->setWFlags ( wflags); |
249 | #endif | 249 | #endif |
250 | mGridSpacingX = 80; | 250 | mGridSpacingX = 80; |
251 | mResizeBorderWidth = 8; | 251 | mResizeBorderWidth = 8; |
252 | mScrollBorderWidth = 8; | 252 | mScrollBorderWidth = 8; |
253 | mScrollDelay = 30; | 253 | mScrollDelay = 30; |
254 | mScrollOffset = 10; | 254 | mScrollOffset = 10; |
255 | mPaintPixmap.resize( 20,20); | 255 | mPaintPixmap.resize( 20,20); |
256 | //enableClipper(true); | 256 | //enableClipper(true); |
257 | 257 | ||
258 | // Grab key strokes for keyboard navigation of agenda. Seems to have no | 258 | // Grab key strokes for keyboard navigation of agenda. Seems to have no |
259 | // effect. Has to be fixed. | 259 | // effect. Has to be fixed. |
260 | setFocusPolicy(WheelFocus); | 260 | setFocusPolicy(WheelFocus); |
261 | 261 | ||
262 | connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp())); | 262 | connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp())); |
263 | connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown())); | 263 | connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown())); |
264 | connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); | 264 | connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); |
265 | 265 | ||
266 | mStartCellX = 0; | 266 | mStartCellX = 0; |
267 | mStartCellY = 0; | 267 | mStartCellY = 0; |
268 | mCurrentCellX = 0; | 268 | mCurrentCellX = 0; |
269 | mCurrentCellY = 0; | 269 | mCurrentCellY = 0; |
270 | 270 | ||
271 | mSelectionCellX = 0; | 271 | mSelectionCellX = 0; |
272 | mSelectionYTop = 0; | 272 | mSelectionYTop = 0; |
273 | mSelectionHeight = 0; | 273 | mSelectionHeight = 0; |
274 | 274 | ||
275 | mOldLowerScrollValue = -1; | 275 | mOldLowerScrollValue = -1; |
276 | mOldUpperScrollValue = -1; | 276 | mOldUpperScrollValue = -1; |
277 | 277 | ||
278 | mClickedItem = 0; | 278 | mClickedItem = 0; |
279 | 279 | ||
280 | mActionItem = 0; | 280 | mActionItem = 0; |
281 | mActionType = NOP; | 281 | mActionType = NOP; |
282 | mItemMoved = false; | 282 | mItemMoved = false; |
283 | 283 | ||
284 | mSelectedItem = 0; | 284 | mSelectedItem = 0; |
285 | 285 | ||
286 | // mItems.setAutoDelete(true); | 286 | // mItems.setAutoDelete(true); |
287 | 287 | ||
288 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 288 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
289 | 289 | ||
290 | viewport()->update(); | 290 | viewport()->update(); |
291 | 291 | ||
292 | setMinimumSize(30, 1); | 292 | setMinimumSize(30, 1); |
293 | // setMaximumHeight(mGridSpacingY * mRows + 5); | 293 | // setMaximumHeight(mGridSpacingY * mRows + 5); |
294 | 294 | ||
295 | // Disable horizontal scrollbar. This is a hack. The geometry should be | 295 | // Disable horizontal scrollbar. This is a hack. The geometry should be |
296 | // controlled in a way that the contents horizontally always fits. Then it is | 296 | // controlled in a way that the contents horizontally always fits. Then it is |
297 | // not necessary to turn off the scrollbar. | 297 | // not necessary to turn off the scrollbar. |
298 | setHScrollBarMode(AlwaysOff); | 298 | setHScrollBarMode(AlwaysOff); |
299 | if ( ! mAllDayMode ) | 299 | if ( ! mAllDayMode ) |
300 | setVScrollBarMode(AlwaysOn); | 300 | setVScrollBarMode(AlwaysOn); |
301 | else | 301 | else |
302 | setVScrollBarMode(AlwaysOff); | 302 | setVScrollBarMode(AlwaysOff); |
303 | 303 | ||
304 | setStartHour(KOPrefs::instance()->mDayBegins); | 304 | setStartHour(KOPrefs::instance()->mDayBegins); |
305 | 305 | ||
306 | calculateWorkingHours(); | 306 | calculateWorkingHours(); |
307 | 307 | ||
308 | connect(verticalScrollBar(),SIGNAL(valueChanged(int)), | 308 | connect(verticalScrollBar(),SIGNAL(valueChanged(int)), |
309 | SLOT(checkScrollBoundaries(int))); | 309 | SLOT(checkScrollBoundaries(int))); |
310 | 310 | ||
311 | // Create the Marcus Bains line. | 311 | // Create the Marcus Bains line. |
312 | if(mAllDayMode) | 312 | if(mAllDayMode) |
313 | mMarcusBains = 0; | 313 | mMarcusBains = 0; |
314 | else { | 314 | else { |
315 | mMarcusBains = new MarcusBains(this); | 315 | mMarcusBains = new MarcusBains(this); |
316 | addChild(mMarcusBains); | 316 | addChild(mMarcusBains); |
317 | } | 317 | } |
318 | mPopupKind = 0; | 318 | mPopupKind = 0; |
319 | mPopupItem = 0; | 319 | mPopupItem = 0; |
320 | } | 320 | } |
321 | 321 | ||
322 | void KOAgenda::clear() | 322 | void KOAgenda::clear() |
323 | { | 323 | { |
324 | KOAgendaItem *item; | 324 | KOAgendaItem *item; |
325 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 325 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
326 | mUnusedItems.append( item ); | 326 | mUnusedItems.append( item ); |
327 | //item->hide(); | 327 | //item->hide(); |
328 | } | 328 | } |
329 | mItems.clear(); | 329 | mItems.clear(); |
330 | mSelectedItem = 0; | 330 | mSelectedItem = 0; |
331 | clearSelection(); | 331 | clearSelection(); |
332 | } | 332 | } |
333 | 333 | ||
334 | void KOAgenda::clearSelection() | 334 | void KOAgenda::clearSelection() |
335 | { | 335 | { |
336 | mSelectionCellX = 0; | 336 | mSelectionCellX = 0; |
337 | mSelectionYTop = 0; | 337 | mSelectionYTop = 0; |
338 | mSelectionHeight = 0; | 338 | mSelectionHeight = 0; |
339 | } | 339 | } |
340 | 340 | ||
341 | void KOAgenda::marcus_bains() | 341 | void KOAgenda::marcus_bains() |
342 | { | 342 | { |
343 | if(mMarcusBains) mMarcusBains->updateLocation(true); | 343 | if(mMarcusBains) mMarcusBains->updateLocation(true); |
344 | } | 344 | } |
345 | 345 | ||
346 | 346 | ||
347 | void KOAgenda::changeColumns(int columns) | 347 | void KOAgenda::changeColumns(int columns) |
348 | { | 348 | { |
349 | if (columns == 0) { | 349 | if (columns == 0) { |
350 | qDebug("KOAgenda::changeColumns() called with argument 0 "); | 350 | qDebug("KOAgenda::changeColumns() called with argument 0 "); |
351 | return; | 351 | return; |
352 | } | 352 | } |
353 | clear(); | 353 | clear(); |
354 | mColumns = columns; | 354 | mColumns = columns; |
355 | computeSizes(); | 355 | computeSizes(); |
356 | } | 356 | } |
357 | 357 | ||
358 | /* | 358 | /* |
359 | This is the eventFilter function, which gets all events from the KOAgendaItems | 359 | This is the eventFilter function, which gets all events from the KOAgendaItems |
360 | contained in the agenda. It has to handle moving and resizing for all items. | 360 | contained in the agenda. It has to handle moving and resizing for all items. |
361 | */ | 361 | */ |
362 | bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) | 362 | bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) |
363 | { | 363 | { |
364 | // kdDebug() << "KOAgenda::eventFilter" << endl; | 364 | // kdDebug() << "KOAgenda::eventFilter" << endl; |
365 | switch(event->type()) { | 365 | switch(event->type()) { |
366 | case QEvent::MouseButtonPress: | 366 | case QEvent::MouseButtonPress: |
367 | case QEvent::MouseButtonDblClick: | 367 | case QEvent::MouseButtonDblClick: |
368 | case QEvent::MouseButtonRelease: | 368 | case QEvent::MouseButtonRelease: |
369 | case QEvent::MouseMove: | 369 | case QEvent::MouseMove: |
370 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); | 370 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); |
371 | 371 | ||
372 | case (QEvent::Leave): | 372 | case (QEvent::Leave): |
373 | if (!mActionItem) | 373 | if (!mActionItem) |
374 | setCursor(arrowCursor); | 374 | setCursor(arrowCursor); |
375 | return true; | 375 | return true; |
376 | 376 | ||
377 | default: | 377 | default: |
378 | return QScrollView::eventFilter(object,event); | 378 | return QScrollView::eventFilter(object,event); |
379 | } | 379 | } |
380 | } | 380 | } |
381 | void KOAgenda::popupMenu() | 381 | void KOAgenda::popupMenu() |
382 | { | 382 | { |
383 | mPopupTimer->stop(); | 383 | mPopupTimer->stop(); |
384 | if ( mPopupKind == 1 ) { | 384 | if ( mPopupKind == 1 ) { |
385 | if (mActionItem ) { | 385 | if (mActionItem ) { |
386 | endItemAction(); | 386 | endItemAction(); |
387 | } | 387 | } |
388 | mLeftMouseDown = false; // no more leftMouse computation | 388 | mLeftMouseDown = false; // no more leftMouse computation |
389 | if (mPopupItem) { | 389 | if (mPopupItem) { |
390 | //mClickedItem = mPopupItem; | 390 | //mClickedItem = mPopupItem; |
391 | selectItem(mPopupItem); | 391 | selectItem(mPopupItem); |
392 | if ( mAllAgendaPopup ) | 392 | if ( mAllAgendaPopup && KOPrefs::instance()->mBlockPopupMenu ) |
393 | mAllAgendaPopup->installEventFilter( this ); | 393 | mAllAgendaPopup->installEventFilter( this ); |
394 | emit showIncidencePopupSignal(mPopupItem->incidence()); | 394 | emit showIncidencePopupSignal(mPopupItem->incidence()); |
395 | 395 | ||
396 | } | 396 | } |
397 | } else if ( mPopupKind == 2 ) { | 397 | } else if ( mPopupKind == 2 ) { |
398 | if ( mLeftMouseDown ) { // we have a simulated right click - clear left mouse action | 398 | if ( mLeftMouseDown ) { // we have a simulated right click - clear left mouse action |
399 | endSelectAction( false ); // do not emit new event signal | 399 | endSelectAction( false ); // do not emit new event signal |
400 | mLeftMouseDown = false; // no more leftMouse computation | 400 | mLeftMouseDown = false; // no more leftMouse computation |
401 | } | 401 | } |
402 | mNewItemPopup->installEventFilter( this ); | 402 | if ( KOPrefs::instance()->mBlockPopupMenu ) |
403 | mNewItemPopup->installEventFilter( this ); | ||
403 | mNewItemPopup->popup( mPopupPos); | 404 | mNewItemPopup->popup( mPopupPos); |
404 | 405 | ||
405 | } | 406 | } |
406 | mLeftMouseDown = false; | 407 | mLeftMouseDown = false; |
407 | mPopupItem = 0; | 408 | mPopupItem = 0; |
408 | mPopupKind = 0; | 409 | mPopupKind = 0; |
409 | } | 410 | } |
410 | 411 | ||
411 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | 412 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) |
412 | { | 413 | { |
413 | static int startX = 0; | 414 | static int startX = 0; |
414 | static int startY = 0; | 415 | static int startY = 0; |
415 | static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); | 416 | static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); |
416 | static bool blockMoving = true; | 417 | static bool blockMoving = true; |
417 | 418 | ||
418 | //qDebug("KOAgenda::eventFilter_mous "); | 419 | //qDebug("KOAgenda::eventFilter_mous "); |
419 | if ( object == mNewItemPopup ) { | 420 | if ( object == mNewItemPopup ) { |
420 | //qDebug("mNewItemPopup "); | 421 | //qDebug("mNewItemPopup "); |
421 | if ( me->type() == QEvent::MouseButtonRelease ) { | 422 | if ( me->type() == QEvent::MouseButtonRelease ) { |
422 | mNewItemPopup->removeEventFilter( this ); | 423 | mNewItemPopup->removeEventFilter( this ); |
423 | int dX = me->globalPos().x() - mPopupPos.x();; | 424 | int dX = me->globalPos().x() - mPopupPos.x();; |
424 | if ( dX < 0 ) | 425 | if ( dX < 0 ) |
425 | dX = -dX; | 426 | dX = -dX; |
426 | int dY = me->globalPos().y() - mPopupPos.y(); | 427 | int dY = me->globalPos().y() - mPopupPos.y(); |
427 | if ( dY < 0 ) | 428 | if ( dY < 0 ) |
428 | dY = -dY; | 429 | dY = -dY; |
429 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | 430 | if ( dX > blockmoveDist || dY > blockmoveDist ) { |
430 | mNewItemPopup->hide(); | 431 | mNewItemPopup->hide(); |
431 | } | 432 | } |
432 | } | 433 | } |
433 | return true; | 434 | return true; |
434 | } | 435 | } |
435 | if ( object == mAllAgendaPopup ) { | 436 | if ( object == mAllAgendaPopup ) { |
436 | //qDebug(" mAllAgendaPopup "); | 437 | //qDebug(" mAllAgendaPopup "); |
437 | if ( me->type() == QEvent::MouseButtonRelease ) { | 438 | if ( me->type() == QEvent::MouseButtonRelease ) { |
438 | mAllAgendaPopup->removeEventFilter( this ); | 439 | mAllAgendaPopup->removeEventFilter( this ); |
439 | int dX = me->globalPos().x() - mPopupPos.x();; | 440 | int dX = me->globalPos().x() - mPopupPos.x();; |
440 | if ( dX < 0 ) | 441 | if ( dX < 0 ) |
441 | dX = -dX; | 442 | dX = -dX; |
442 | int dY = me->globalPos().y() - mPopupPos.y(); | 443 | int dY = me->globalPos().y() - mPopupPos.y(); |
443 | if ( dY < 0 ) | 444 | if ( dY < 0 ) |
444 | dY = -dY; | 445 | dY = -dY; |
445 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | 446 | if ( dX > blockmoveDist || dY > blockmoveDist ) { |
446 | mAllAgendaPopup->hide(); | 447 | mAllAgendaPopup->hide(); |
447 | } | 448 | } |
448 | } | 449 | } |
449 | return true; | 450 | return true; |
450 | } | 451 | } |
451 | QPoint viewportPos; | 452 | QPoint viewportPos; |
452 | if (object != viewport()) { | 453 | if (object != viewport()) { |
453 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); | 454 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); |
454 | } else { | 455 | } else { |
455 | viewportPos = me->pos(); | 456 | viewportPos = me->pos(); |
456 | } | 457 | } |
457 | 458 | ||
458 | switch (me->type()) { | 459 | switch (me->type()) { |
459 | case QEvent::MouseButtonPress: | 460 | case QEvent::MouseButtonPress: |
460 | if (me->button() == LeftButton) { | 461 | if (me->button() == LeftButton) { |
461 | mPopupTimer->start( 600 ); | 462 | mPopupTimer->start( 600 ); |
462 | mLeftMouseDown = true; | 463 | mLeftMouseDown = true; |
463 | } | 464 | } |
464 | blockMoving = true; | 465 | blockMoving = true; |
465 | startX = viewportPos.x(); | 466 | startX = viewportPos.x(); |
466 | startY = viewportPos.y(); | 467 | startY = viewportPos.y(); |
467 | mPopupPos = me->globalPos(); | 468 | mPopupPos = me->globalPos(); |
468 | if (object != viewport()) { | 469 | if (object != viewport()) { |
469 | mPopupItem = (KOAgendaItem *)object; | 470 | mPopupItem = (KOAgendaItem *)object; |
470 | mPopupKind = 1; | 471 | mPopupKind = 1; |
471 | if (me->button() == RightButton) { | 472 | if (me->button() == RightButton) { |
472 | popupMenu(); | 473 | popupMenu(); |
473 | } else if (me->button() == LeftButton) { | 474 | } else if (me->button() == LeftButton) { |
474 | mActionItem = (KOAgendaItem *)object; | 475 | mActionItem = (KOAgendaItem *)object; |
475 | if (mActionItem) { | 476 | if (mActionItem) { |
476 | if ( mSelectionHeight > 0 ) { | 477 | if ( mSelectionHeight > 0 ) { |
477 | int selectionCellX = mSelectionCellX * mGridSpacingX; | 478 | int selectionCellX = mSelectionCellX * mGridSpacingX; |
478 | int selectionYTop = mSelectionYTop; | 479 | int selectionYTop = mSelectionYTop; |
479 | int gridSpacingX = mGridSpacingX; | 480 | int gridSpacingX = mGridSpacingX; |
480 | int selectionHeight = mSelectionHeight; | 481 | int selectionHeight = mSelectionHeight; |
481 | clearSelection(); | 482 | clearSelection(); |
482 | repaintContents( selectionCellX, selectionYTop, | 483 | repaintContents( selectionCellX, selectionYTop, |
483 | gridSpacingX, selectionHeight,false ); | 484 | gridSpacingX, selectionHeight,false ); |
484 | } | 485 | } |
485 | selectItem(mActionItem); | 486 | selectItem(mActionItem); |
486 | Incidence *incidence = mActionItem->incidence(); | 487 | Incidence *incidence = mActionItem->incidence(); |
487 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { | 488 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { |
488 | mActionItem = 0; | 489 | mActionItem = 0; |
489 | } else { | 490 | } else { |
490 | startItemAction(viewportPos); | 491 | startItemAction(viewportPos); |
491 | } | 492 | } |
492 | } | 493 | } |
493 | } | 494 | } |
494 | } else { // ---------- viewport() | 495 | } else { // ---------- viewport() |
495 | mPopupItem = 0; | 496 | mPopupItem = 0; |
496 | mPopupKind = 2; | 497 | mPopupKind = 2; |
497 | selectItem(0); | 498 | selectItem(0); |
498 | mActionItem = 0; | 499 | mActionItem = 0; |
499 | if (me->button() == RightButton) { | 500 | if (me->button() == RightButton) { |
500 | int x,y; | 501 | int x,y; |
501 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 502 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
502 | int gx,gy; | 503 | int gx,gy; |
503 | contentsToGrid(x,y,gx,gy); | 504 | contentsToGrid(x,y,gx,gy); |
504 | mCurrentCellX = gx; | 505 | mCurrentCellX = gx; |
505 | mCurrentCellY = gy; | 506 | mCurrentCellY = gy; |
506 | mStartCellX = gx; | 507 | mStartCellX = gx; |
507 | mStartCellY = gy; | 508 | mStartCellY = gy; |
508 | popupMenu(); | 509 | popupMenu(); |
509 | } else if (me->button() == LeftButton) { | 510 | } else if (me->button() == LeftButton) { |
510 | setCursor(arrowCursor); | 511 | setCursor(arrowCursor); |
511 | startSelectAction(viewportPos); | 512 | startSelectAction(viewportPos); |
512 | } | 513 | } |
513 | } | 514 | } |
514 | break; | 515 | break; |
515 | 516 | ||
516 | case QEvent::MouseButtonRelease: | 517 | case QEvent::MouseButtonRelease: |
517 | if (me->button() == LeftButton ) { | 518 | if (me->button() == LeftButton ) { |
518 | mPopupTimer->stop(); | 519 | mPopupTimer->stop(); |
519 | } | 520 | } |
520 | if (object != viewport()) { | 521 | if (object != viewport()) { |
521 | if (me->button() == LeftButton && mLeftMouseDown) { | 522 | if (me->button() == LeftButton && mLeftMouseDown) { |
522 | if (mActionItem) { | 523 | if (mActionItem) { |
523 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | 524 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); |
524 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); | 525 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); |
525 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { | 526 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { |
526 | mScrollUpTimer.stop(); | 527 | mScrollUpTimer.stop(); |
527 | mScrollDownTimer.stop(); | 528 | mScrollDownTimer.stop(); |
528 | mActionItem->resetMove(); | 529 | mActionItem->resetMove(); |
529 | placeSubCells( mActionItem ); | 530 | placeSubCells( mActionItem ); |
530 | // emit startDragSignal( mActionItem->incidence() ); | 531 | // emit startDragSignal( mActionItem->incidence() ); |
531 | setCursor( arrowCursor ); | 532 | setCursor( arrowCursor ); |
532 | mActionItem = 0; | 533 | mActionItem = 0; |
533 | mActionType = NOP; | 534 | mActionType = NOP; |
534 | mItemMoved = 0; | 535 | mItemMoved = 0; |
535 | mLeftMouseDown = false; | 536 | mLeftMouseDown = false; |
536 | return true; | 537 | return true; |
537 | } | 538 | } |
538 | endItemAction(); | 539 | endItemAction(); |
539 | } | 540 | } |
540 | } | 541 | } |
541 | 542 | ||
542 | } else { // ---------- viewport() | 543 | } else { // ---------- viewport() |
543 | if (me->button() == LeftButton && mLeftMouseDown ) { //left click | 544 | if (me->button() == LeftButton && mLeftMouseDown ) { //left click |
544 | endSelectAction( true ); // emit new event signal | 545 | endSelectAction( true ); // emit new event signal |
545 | } | 546 | } |
546 | } | 547 | } |
547 | if (me->button() == LeftButton) | 548 | if (me->button() == LeftButton) |
548 | mLeftMouseDown = false; | 549 | mLeftMouseDown = false; |
549 | 550 | ||
550 | break; | 551 | break; |
551 | 552 | ||
552 | case QEvent::MouseMove: | 553 | case QEvent::MouseMove: |
553 | //qDebug("mm "); | 554 | //qDebug("mm "); |
554 | if ( !mLeftMouseDown ) | 555 | if ( !mLeftMouseDown ) |
555 | return false; | 556 | return false; |
556 | if ( blockMoving ) { | 557 | if ( blockMoving ) { |
557 | int dX, dY; | 558 | int dX, dY; |
558 | dX = startX - viewportPos.x(); | 559 | dX = startX - viewportPos.x(); |
559 | if ( dX < 0 ) | 560 | if ( dX < 0 ) |
560 | dX = -dX; | 561 | dX = -dX; |
561 | dY = viewportPos.y() - startY; | 562 | dY = viewportPos.y() - startY; |
562 | if ( dY < 0 ) | 563 | if ( dY < 0 ) |
563 | dY = -dY; | 564 | dY = -dY; |
564 | //qDebug("%d %d %d ", dX, dY , blockmoveDist ); | 565 | //qDebug("%d %d %d ", dX, dY , blockmoveDist ); |
565 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | 566 | if ( dX > blockmoveDist || dY > blockmoveDist ) { |
566 | blockMoving = false; | 567 | blockMoving = false; |
567 | } | 568 | } |
568 | } | 569 | } |
569 | if ( ! blockMoving ) | 570 | if ( ! blockMoving ) |
570 | mPopupTimer->stop(); | 571 | mPopupTimer->stop(); |
571 | if (object != viewport()) { | 572 | if (object != viewport()) { |
572 | KOAgendaItem *moveItem = (KOAgendaItem *)object; | 573 | KOAgendaItem *moveItem = (KOAgendaItem *)object; |
573 | if (!moveItem->incidence()->isReadOnly() ) { | 574 | if (!moveItem->incidence()->isReadOnly() ) { |
574 | if (!mActionItem) | 575 | if (!mActionItem) |
575 | setNoActionCursor(moveItem,viewportPos); | 576 | setNoActionCursor(moveItem,viewportPos); |
576 | else { | 577 | else { |
577 | if ( !blockMoving ) | 578 | if ( !blockMoving ) |
578 | performItemAction(viewportPos); | 579 | performItemAction(viewportPos); |
579 | } | 580 | } |
580 | } | 581 | } |
581 | } else { // ---------- viewport() | 582 | } else { // ---------- viewport() |
582 | mPopupPos = viewport()->mapToGlobal( me->pos() ); | 583 | mPopupPos = viewport()->mapToGlobal( me->pos() ); |
583 | if ( mActionType == SELECT ) { | 584 | if ( mActionType == SELECT ) { |
584 | performSelectAction( viewportPos ); | 585 | performSelectAction( viewportPos ); |
585 | } | 586 | } |
586 | } | 587 | } |
587 | break; | 588 | break; |
588 | 589 | ||
589 | case QEvent::MouseButtonDblClick: | 590 | case QEvent::MouseButtonDblClick: |
590 | mPopupTimer->stop(); | 591 | mPopupTimer->stop(); |
591 | if (object == viewport()) { | 592 | if (object == viewport()) { |
592 | selectItem(0); | 593 | selectItem(0); |
593 | int x,y; | 594 | int x,y; |
594 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 595 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
595 | int gx,gy; | 596 | int gx,gy; |
596 | contentsToGrid(x,y,gx,gy); | 597 | contentsToGrid(x,y,gx,gy); |
597 | emit newEventSignal(gx,gy); | 598 | emit newEventSignal(gx,gy); |
598 | } else { | 599 | } else { |
599 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; | 600 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; |
600 | selectItem(doubleClickedItem); | 601 | selectItem(doubleClickedItem); |
601 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 602 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
602 | emit editIncidenceSignal(doubleClickedItem->incidence()); | 603 | emit editIncidenceSignal(doubleClickedItem->incidence()); |
603 | else | 604 | else |
604 | emit showIncidenceSignal(doubleClickedItem->incidence()); | 605 | emit showIncidenceSignal(doubleClickedItem->incidence()); |
605 | } | 606 | } |
606 | break; | 607 | break; |
607 | 608 | ||
608 | default: | 609 | default: |
609 | break; | 610 | break; |
610 | } | 611 | } |
611 | return true; | 612 | return true; |
612 | #if 0 | 613 | #if 0 |
613 | //qDebug("KOAgenda::eventFilter_mous "); | 614 | //qDebug("KOAgenda::eventFilter_mous "); |
614 | QPoint viewportPos; | 615 | QPoint viewportPos; |
615 | if (object != viewport()) { | 616 | if (object != viewport()) { |
616 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); | 617 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); |
617 | } else { | 618 | } else { |
618 | viewportPos = me->pos(); | 619 | viewportPos = me->pos(); |
619 | } | 620 | } |
620 | static int startX = 0; | 621 | static int startX = 0; |
621 | static int startY = 0; | 622 | static int startY = 0; |
622 | static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); | 623 | static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); |
623 | static bool blockMoving = true; | 624 | static bool blockMoving = true; |
624 | static bool leftMouseDown = false; | 625 | static bool leftMouseDown = false; |
625 | bool rightButtonPressed = false; | 626 | bool rightButtonPressed = false; |
626 | switch (me->type()) { | 627 | switch (me->type()) { |
627 | case QEvent::MouseButtonPress: | 628 | case QEvent::MouseButtonPress: |
628 | if (me->button() == LeftButton) { | 629 | if (me->button() == LeftButton) { |
629 | leftMouseDown = true; | 630 | leftMouseDown = true; |
630 | } | 631 | } |
631 | else if (me->button() == RightButton) { | 632 | else if (me->button() == RightButton) { |
632 | leftMouseDown = false; | 633 | leftMouseDown = false; |
633 | } | 634 | } |
634 | blockMoving = true; | 635 | blockMoving = true; |
635 | startX = viewportPos.x(); | 636 | startX = viewportPos.x(); |
636 | startY = viewportPos.y(); | 637 | startY = viewportPos.y(); |
637 | if (object != viewport()) { // item clicked ************** | 638 | if (object != viewport()) { // item clicked ************** |
638 | if (me->button() == RightButton) { | 639 | if (me->button() == RightButton) { |
639 | leftMouseDown = false; | 640 | leftMouseDown = false; |
640 | mClickedItem = (KOAgendaItem *)object; | 641 | mClickedItem = (KOAgendaItem *)object; |
641 | if (mActionItem ) { | 642 | if (mActionItem ) { |
642 | endItemAction(); | 643 | endItemAction(); |
643 | } | 644 | } |
644 | if (mClickedItem) { | 645 | if (mClickedItem) { |
645 | selectItem(mClickedItem); | 646 | selectItem(mClickedItem); |
646 | emit showIncidencePopupSignal(mClickedItem->incidence()); | 647 | emit showIncidencePopupSignal(mClickedItem->incidence()); |
647 | } | 648 | } |
648 | return true; | 649 | return true; |
649 | } else if (me->button() == LeftButton) { | 650 | } else if (me->button() == LeftButton) { |
650 | mActionItem = (KOAgendaItem *)object; | 651 | mActionItem = (KOAgendaItem *)object; |
651 | if (mActionItem) { | 652 | if (mActionItem) { |
652 | if ( mSelectionHeight > 0 ) { | 653 | if ( mSelectionHeight > 0 ) { |
653 | int selectionCellX = mSelectionCellX * mGridSpacingX; | 654 | int selectionCellX = mSelectionCellX * mGridSpacingX; |
654 | int selectionYTop = mSelectionYTop; | 655 | int selectionYTop = mSelectionYTop; |
655 | int gridSpacingX = mGridSpacingX; | 656 | int gridSpacingX = mGridSpacingX; |
656 | int selectionHeight = mSelectionHeight; | 657 | int selectionHeight = mSelectionHeight; |
657 | clearSelection(); | 658 | clearSelection(); |
658 | repaintContents( selectionCellX, selectionYTop, | 659 | repaintContents( selectionCellX, selectionYTop, |
659 | gridSpacingX, selectionHeight,false ); | 660 | gridSpacingX, selectionHeight,false ); |
660 | } | 661 | } |
661 | selectItem(mActionItem); | 662 | selectItem(mActionItem); |
662 | Incidence *incidence = mActionItem->incidence(); | 663 | Incidence *incidence = mActionItem->incidence(); |
663 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { | 664 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { |
664 | mActionItem = 0; | 665 | mActionItem = 0; |
665 | } else { | 666 | } else { |
666 | startItemAction(viewportPos); | 667 | startItemAction(viewportPos); |
667 | } | 668 | } |
668 | } | 669 | } |
669 | } | 670 | } |
670 | } else { // ---------- viewport() | 671 | } else { // ---------- viewport() |
671 | selectItem(0); | 672 | selectItem(0); |
672 | mActionItem = 0; | 673 | mActionItem = 0; |
673 | if (me->button() == LeftButton ) { | 674 | if (me->button() == LeftButton ) { |
674 | setCursor(arrowCursor); | 675 | setCursor(arrowCursor); |
675 | startSelectAction(viewportPos); | 676 | startSelectAction(viewportPos); |
676 | } else if (me->button() == RightButton ) { | 677 | } else if (me->button() == RightButton ) { |
677 | setCursor(arrowCursor); | 678 | setCursor(arrowCursor); |
678 | if ( leftMouseDown ) { // we have a simulated right click - clear left mouse action | 679 | if ( leftMouseDown ) { // we have a simulated right click - clear left mouse action |
679 | endSelectAction( false ); // do not emit new event signal | 680 | endSelectAction( false ); // do not emit new event signal |
680 | leftMouseDown = false; // no more leftMouse computation | 681 | leftMouseDown = false; // no more leftMouse computation |
681 | } | 682 | } |
682 | int x,y; | 683 | int x,y; |
683 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 684 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
684 | int gx,gy; | 685 | int gx,gy; |
685 | contentsToGrid(x,y,gx,gy); | 686 | contentsToGrid(x,y,gx,gy); |
686 | mCurrentCellX = gx; | 687 | mCurrentCellX = gx; |
687 | mCurrentCellY = gy; | 688 | mCurrentCellY = gy; |
688 | mStartCellX = gx; | 689 | mStartCellX = gx; |
689 | mStartCellY = gy; | 690 | mStartCellY = gy; |
690 | mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) ); | 691 | mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) ); |
691 | } | 692 | } |
692 | } | 693 | } |
693 | break; | 694 | break; |
694 | 695 | ||
695 | case QEvent::MouseButtonRelease: | 696 | case QEvent::MouseButtonRelease: |
696 | 697 | ||
697 | if (object != viewport()) { | 698 | if (object != viewport()) { |
698 | if (me->button() == LeftButton && leftMouseDown) { | 699 | if (me->button() == LeftButton && leftMouseDown) { |
699 | if (mActionItem) { | 700 | if (mActionItem) { |
700 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | 701 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); |
701 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); | 702 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); |
702 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { | 703 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { |
703 | mScrollUpTimer.stop(); | 704 | mScrollUpTimer.stop(); |
704 | mScrollDownTimer.stop(); | 705 | mScrollDownTimer.stop(); |
705 | mActionItem->resetMove(); | 706 | mActionItem->resetMove(); |
706 | placeSubCells( mActionItem ); | 707 | placeSubCells( mActionItem ); |
707 | // emit startDragSignal( mActionItem->incidence() ); | 708 | // emit startDragSignal( mActionItem->incidence() ); |
708 | setCursor( arrowCursor ); | 709 | setCursor( arrowCursor ); |
709 | mActionItem = 0; | 710 | mActionItem = 0; |
710 | mActionType = NOP; | 711 | mActionType = NOP; |
711 | mItemMoved = 0; | 712 | mItemMoved = 0; |
712 | leftMouseDown = false; | 713 | leftMouseDown = false; |
713 | return true; | 714 | return true; |
714 | } | 715 | } |
715 | endItemAction(); | 716 | endItemAction(); |
716 | } | 717 | } |
717 | } | 718 | } |
718 | 719 | ||
719 | } else { // ---------- viewport() | 720 | } else { // ---------- viewport() |
720 | if (me->button() == LeftButton && leftMouseDown ) { //left click | 721 | if (me->button() == LeftButton && leftMouseDown ) { //left click |
721 | endSelectAction( true ); // emit new event signal | 722 | endSelectAction( true ); // emit new event signal |
722 | } | 723 | } |
723 | } | 724 | } |
724 | if (me->button() == LeftButton) | 725 | if (me->button() == LeftButton) |
725 | leftMouseDown = false; | 726 | leftMouseDown = false; |
726 | 727 | ||
727 | break; | 728 | break; |
728 | 729 | ||
729 | case QEvent::MouseMove: | 730 | case QEvent::MouseMove: |
730 | if ( !leftMouseDown ) | 731 | if ( !leftMouseDown ) |
731 | return true; | 732 | return true; |
732 | if ( blockMoving ) { | 733 | if ( blockMoving ) { |
733 | int dX, dY; | 734 | int dX, dY; |
734 | dX = startX - viewportPos.x(); | 735 | dX = startX - viewportPos.x(); |
735 | if ( dX < 0 ) | 736 | if ( dX < 0 ) |
736 | dX = -dX; | 737 | dX = -dX; |
737 | dY = viewportPos.y() - startY; | 738 | dY = viewportPos.y() - startY; |
738 | if ( dY < 0 ) | 739 | if ( dY < 0 ) |
739 | dY = -dY; | 740 | dY = -dY; |
740 | //qDebug("%d %d %d ", dX, dY , blockmoveDist ); | 741 | //qDebug("%d %d %d ", dX, dY , blockmoveDist ); |
741 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | 742 | if ( dX > blockmoveDist || dY > blockmoveDist ) { |
742 | blockMoving = false; | 743 | blockMoving = false; |
743 | } | 744 | } |
744 | } | 745 | } |
745 | if (object != viewport()) { | 746 | if (object != viewport()) { |
746 | KOAgendaItem *moveItem = (KOAgendaItem *)object; | 747 | KOAgendaItem *moveItem = (KOAgendaItem *)object; |
747 | if (!moveItem->incidence()->isReadOnly() ) { | 748 | if (!moveItem->incidence()->isReadOnly() ) { |
748 | if (!mActionItem) | 749 | if (!mActionItem) |
749 | setNoActionCursor(moveItem,viewportPos); | 750 | setNoActionCursor(moveItem,viewportPos); |
750 | else { | 751 | else { |
751 | if ( !blockMoving ) | 752 | if ( !blockMoving ) |
752 | performItemAction(viewportPos); | 753 | performItemAction(viewportPos); |
753 | } | 754 | } |
754 | } | 755 | } |
755 | } else { // ---------- viewport() | 756 | } else { // ---------- viewport() |
756 | if ( mActionType == SELECT ) { | 757 | if ( mActionType == SELECT ) { |
757 | performSelectAction( viewportPos ); | 758 | performSelectAction( viewportPos ); |
758 | } | 759 | } |
759 | } | 760 | } |
760 | break; | 761 | break; |
761 | 762 | ||
762 | case QEvent::MouseButtonDblClick: | 763 | case QEvent::MouseButtonDblClick: |
763 | blockMoving = false; | 764 | blockMoving = false; |
764 | leftMouseDown = false; | 765 | leftMouseDown = false; |
765 | if (object == viewport()) { | 766 | if (object == viewport()) { |
766 | selectItem(0); | 767 | selectItem(0); |
767 | int x,y; | 768 | int x,y; |
768 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 769 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
769 | int gx,gy; | 770 | int gx,gy; |
770 | contentsToGrid(x,y,gx,gy); | 771 | contentsToGrid(x,y,gx,gy); |
771 | emit newEventSignal(gx,gy); | 772 | emit newEventSignal(gx,gy); |
772 | } else { | 773 | } else { |
773 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; | 774 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; |
774 | selectItem(doubleClickedItem); | 775 | selectItem(doubleClickedItem); |
775 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 776 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
776 | emit editIncidenceSignal(doubleClickedItem->incidence()); | 777 | emit editIncidenceSignal(doubleClickedItem->incidence()); |
777 | else | 778 | else |
778 | emit showIncidenceSignal(doubleClickedItem->incidence()); | 779 | emit showIncidenceSignal(doubleClickedItem->incidence()); |
779 | } | 780 | } |
780 | break; | 781 | break; |
781 | 782 | ||
782 | default: | 783 | default: |
783 | break; | 784 | break; |
784 | } | 785 | } |
785 | return true; | 786 | return true; |
786 | #endif | 787 | #endif |
787 | } | 788 | } |
788 | 789 | ||
789 | void KOAgenda::newItem( int item ) | 790 | void KOAgenda::newItem( int item ) |
790 | { | 791 | { |
791 | if ( item == 1 ) { //new event | 792 | if ( item == 1 ) { //new event |
792 | newEventSignal(mStartCellX ,mStartCellY ); | 793 | newEventSignal(mStartCellX ,mStartCellY ); |
793 | } else | 794 | } else |
794 | if ( item == 2 ) { //new event | 795 | if ( item == 2 ) { //new event |
795 | newTodoSignal(mStartCellX ,mStartCellY ); | 796 | newTodoSignal(mStartCellX ,mStartCellY ); |
796 | } else | 797 | } else |
797 | { | 798 | { |
798 | emit showDateView( item, mStartCellX ); | 799 | emit showDateView( item, mStartCellX ); |
799 | // 3Day view | 800 | // 3Day view |
800 | // 4Week view | 801 | // 4Week view |
801 | // 5Month view | 802 | // 5Month view |
802 | // 6Journal view | 803 | // 6Journal view |
803 | } | 804 | } |
804 | } | 805 | } |
805 | void KOAgenda::startSelectAction(QPoint viewportPos) | 806 | void KOAgenda::startSelectAction(QPoint viewportPos) |
806 | { | 807 | { |
807 | //emit newStartSelectSignal(); | 808 | //emit newStartSelectSignal(); |
808 | 809 | ||
809 | mActionType = SELECT; | 810 | mActionType = SELECT; |
810 | 811 | ||
811 | int x,y; | 812 | int x,y; |
812 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 813 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
813 | int gx,gy; | 814 | int gx,gy; |
814 | contentsToGrid(x,y,gx,gy); | 815 | contentsToGrid(x,y,gx,gy); |
815 | 816 | ||
816 | mStartCellX = gx; | 817 | mStartCellX = gx; |
817 | mStartCellY = gy; | 818 | mStartCellY = gy; |
818 | mCurrentCellX = gx; | 819 | mCurrentCellX = gx; |
819 | mCurrentCellY = gy; | 820 | mCurrentCellY = gy; |
820 | 821 | ||
821 | // Store coordinates of old selection | 822 | // Store coordinates of old selection |
822 | int selectionX = mSelectionCellX * mGridSpacingX; | 823 | int selectionX = mSelectionCellX * mGridSpacingX; |
823 | int selectionYTop = mSelectionYTop; | 824 | int selectionYTop = mSelectionYTop; |
824 | int selectionHeight = mSelectionHeight; | 825 | int selectionHeight = mSelectionHeight; |
825 | 826 | ||
826 | // Store new selection | 827 | // Store new selection |
827 | mSelectionCellX = gx; | 828 | mSelectionCellX = gx; |
828 | mSelectionYTop = gy * mGridSpacingY; | 829 | mSelectionYTop = gy * mGridSpacingY; |
829 | mSelectionHeight = mGridSpacingY; | 830 | mSelectionHeight = mGridSpacingY; |
830 | 831 | ||
831 | // Clear old selection | 832 | // Clear old selection |
832 | repaintContents( selectionX, selectionYTop, | 833 | repaintContents( selectionX, selectionYTop, |
833 | mGridSpacingX, selectionHeight,false ); | 834 | mGridSpacingX, selectionHeight,false ); |
834 | 835 | ||
835 | // Paint new selection | 836 | // Paint new selection |
836 | // repaintContents( mSelectionCellX * mGridSpacingX, mSelectionYTop, | 837 | // repaintContents( mSelectionCellX * mGridSpacingX, mSelectionYTop, |
837 | // mGridSpacingX, mSelectionHeight ); | 838 | // mGridSpacingX, mSelectionHeight ); |
838 | } | 839 | } |
839 | 840 | ||
840 | void KOAgenda::performSelectAction(QPoint viewportPos) | 841 | void KOAgenda::performSelectAction(QPoint viewportPos) |
841 | { | 842 | { |
842 | int x,y; | 843 | int x,y; |
843 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 844 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
844 | int gx,gy; | 845 | int gx,gy; |
845 | contentsToGrid(x,y,gx,gy); | 846 | contentsToGrid(x,y,gx,gy); |
846 | 847 | ||
847 | QPoint clipperPos = clipper()-> | 848 | QPoint clipperPos = clipper()-> |
848 | mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | 849 | mapFromGlobal(viewport()->mapToGlobal(viewportPos)); |
849 | 850 | ||
850 | // Scroll if cursor was moved to upper or lower end of agenda. | 851 | // Scroll if cursor was moved to upper or lower end of agenda. |
851 | if (clipperPos.y() < mScrollBorderWidth) { | 852 | if (clipperPos.y() < mScrollBorderWidth) { |
852 | mScrollUpTimer.start(mScrollDelay); | 853 | mScrollUpTimer.start(mScrollDelay); |
853 | } else if (visibleHeight() - clipperPos.y() < | 854 | } else if (visibleHeight() - clipperPos.y() < |
854 | mScrollBorderWidth) { | 855 | mScrollBorderWidth) { |
855 | mScrollDownTimer.start(mScrollDelay); | 856 | mScrollDownTimer.start(mScrollDelay); |
856 | } else { | 857 | } else { |
857 | mScrollUpTimer.stop(); | 858 | mScrollUpTimer.stop(); |
858 | mScrollDownTimer.stop(); | 859 | mScrollDownTimer.stop(); |
859 | } | 860 | } |
860 | 861 | ||
861 | if ( gy > mCurrentCellY ) { | 862 | if ( gy > mCurrentCellY ) { |
862 | mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; | 863 | mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; |
863 | 864 | ||
864 | #if 0 | 865 | #if 0 |
865 | // FIXME: Repaint only the newly selected region | 866 | // FIXME: Repaint only the newly selected region |
866 | repaintContents( mSelectionCellX * mGridSpacingX, | 867 | repaintContents( mSelectionCellX * mGridSpacingX, |
867 | mCurrentCellY + mGridSpacingY, | 868 | mCurrentCellY + mGridSpacingY, |
868 | mGridSpacingX, | 869 | mGridSpacingX, |
869 | mSelectionHeight - ( gy - mCurrentCellY - 1 ) * mGridSpacingY ); | 870 | mSelectionHeight - ( gy - mCurrentCellY - 1 ) * mGridSpacingY ); |
870 | #else | 871 | #else |
871 | repaintContents( (KOGlobals::self()->reverseLayout() ? | 872 | repaintContents( (KOGlobals::self()->reverseLayout() ? |
872 | mColumns - 1 - mSelectionCellX : mSelectionCellX) * | 873 | mColumns - 1 - mSelectionCellX : mSelectionCellX) * |
873 | mGridSpacingX, mSelectionYTop, | 874 | mGridSpacingX, mSelectionYTop, |
874 | mGridSpacingX, mSelectionHeight , false); | 875 | mGridSpacingX, mSelectionHeight , false); |
875 | #endif | 876 | #endif |
876 | 877 | ||
877 | mCurrentCellY = gy; | 878 | mCurrentCellY = gy; |
878 | } else if ( gy < mCurrentCellY ) { | 879 | } else if ( gy < mCurrentCellY ) { |
879 | if ( gy >= mStartCellY ) { | 880 | if ( gy >= mStartCellY ) { |
880 | int selectionHeight = mSelectionHeight; | 881 | int selectionHeight = mSelectionHeight; |
881 | mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; | 882 | mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; |
882 | 883 | ||
883 | repaintContents( (KOGlobals::self()->reverseLayout() ? | 884 | repaintContents( (KOGlobals::self()->reverseLayout() ? |
884 | mColumns - 1 - mSelectionCellX : mSelectionCellX) * | 885 | mColumns - 1 - mSelectionCellX : mSelectionCellX) * |
885 | mGridSpacingX, mSelectionYTop, | 886 | mGridSpacingX, mSelectionYTop, |
886 | mGridSpacingX, selectionHeight,false ); | 887 | mGridSpacingX, selectionHeight,false ); |
887 | 888 | ||
888 | mCurrentCellY = gy; | 889 | mCurrentCellY = gy; |
889 | } else { | 890 | } else { |
890 | } | 891 | } |
891 | } | 892 | } |
892 | } | 893 | } |
893 | 894 | ||
894 | void KOAgenda::endSelectAction( bool emitNewEvent ) | 895 | void KOAgenda::endSelectAction( bool emitNewEvent ) |
895 | { | 896 | { |
896 | mActionType = NOP; | 897 | mActionType = NOP; |
897 | mScrollUpTimer.stop(); | 898 | mScrollUpTimer.stop(); |
898 | mScrollDownTimer.stop(); | 899 | mScrollDownTimer.stop(); |
899 | 900 | ||
900 | emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); | 901 | emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); |
901 | if ( emitNewEvent && mStartCellY < mCurrentCellY ) { | 902 | if ( emitNewEvent && mStartCellY < mCurrentCellY ) { |
902 | qDebug("ew event signal "); | 903 | qDebug("ew event signal "); |
903 | emit newEventSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); | 904 | emit newEventSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); |
904 | } | 905 | } |
905 | } | 906 | } |
906 | 907 | ||
907 | void KOAgenda::startItemAction(QPoint viewportPos) | 908 | void KOAgenda::startItemAction(QPoint viewportPos) |
908 | { | 909 | { |
909 | int x,y; | 910 | int x,y; |
910 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 911 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
911 | int gx,gy; | 912 | int gx,gy; |
912 | contentsToGrid(x,y,gx,gy); | 913 | contentsToGrid(x,y,gx,gy); |
913 | 914 | ||
914 | mStartCellX = gx; | 915 | mStartCellX = gx; |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index e8c7c76..a571ed4 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -1,508 +1,509 @@ | |||
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 | QColor defaultTodoRunColor = QColor(99,194,30); | 65 | QColor defaultTodoRunColor = QColor(99,194,30); |
66 | KPrefs::setCurrentGroup("General"); | 66 | KPrefs::setCurrentGroup("General"); |
67 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 67 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
68 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); | 68 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); |
69 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); | 69 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); |
70 | addItemBool("ShowIconSearch",&mShowIconSearch,true); | 70 | addItemBool("ShowIconSearch",&mShowIconSearch,true); |
71 | addItemBool("ShowIconList",&mShowIconList,true); | 71 | addItemBool("ShowIconList",&mShowIconList,true); |
72 | addItemBool("ShowIconDay1",&mShowIconDay1,true); | 72 | addItemBool("ShowIconDay1",&mShowIconDay1,true); |
73 | addItemBool("ShowIconDay5",&mShowIconDay5,true); | 73 | addItemBool("ShowIconDay5",&mShowIconDay5,true); |
74 | addItemBool("ShowIconDay6",&mShowIconDay6,true); | 74 | addItemBool("ShowIconDay6",&mShowIconDay6,true); |
75 | addItemBool("ShowIconDay7",&mShowIconDay7,true); | 75 | addItemBool("ShowIconDay7",&mShowIconDay7,true); |
76 | addItemBool("ShowIconMonth",&mShowIconMonth,true); | 76 | addItemBool("ShowIconMonth",&mShowIconMonth,true); |
77 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); | 77 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); |
78 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); | 78 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); |
79 | addItemBool("ShowIconBack",&mShowIconBack,true); | 79 | addItemBool("ShowIconBack",&mShowIconBack,true); |
80 | addItemBool("ShowIconToday",&mShowIconToday,true); | 80 | addItemBool("ShowIconToday",&mShowIconToday,true); |
81 | addItemBool("ShowIconForward",&mShowIconForward,true); | 81 | addItemBool("ShowIconForward",&mShowIconForward,true); |
82 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); | 82 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); |
83 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); | 83 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); |
84 | addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true); | 84 | addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true); |
85 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); | 85 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); |
86 | addItemBool("ShowIconNext",&mShowIconNext,true); | 86 | addItemBool("ShowIconNext",&mShowIconNext,true); |
87 | addItemBool("ShowIconJournal",&mShowIconJournal,true); | 87 | addItemBool("ShowIconJournal",&mShowIconJournal,true); |
88 | addItemBool("ShowIconStretch",&mShowIconStretch,true); | 88 | addItemBool("ShowIconStretch",&mShowIconStretch,true); |
89 | addItemBool("ShowIconFilter",&mShowIconFilter,false); | 89 | addItemBool("ShowIconFilter",&mShowIconFilter,false); |
90 | addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true); | 90 | addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true); |
91 | 91 | ||
92 | bool addIcons = false; | 92 | bool addIcons = false; |
93 | #ifdef DESKTOP_VERSION | 93 | #ifdef DESKTOP_VERSION |
94 | addIcons = true; | 94 | addIcons = true; |
95 | #endif | 95 | #endif |
96 | addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons); | 96 | addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons); |
97 | addItemBool("ShowIconAllday",&mShowIconAllday,addIcons); | 97 | addItemBool("ShowIconAllday",&mShowIconAllday,addIcons); |
98 | addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons); | 98 | addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons); |
99 | addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons); | 99 | addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons); |
100 | 100 | ||
101 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); | 101 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); |
102 | 102 | ||
103 | addItemBool("AskForQuit",&mAskForQuit,false); | 103 | addItemBool("AskForQuit",&mAskForQuit,false); |
104 | 104 | ||
105 | #ifndef DESKTOP_VERSION | 105 | #ifndef DESKTOP_VERSION |
106 | addItemBool("ShowFullMenu",&mShowFullMenu,false); | 106 | addItemBool("ShowFullMenu",&mShowFullMenu,false); |
107 | #else | 107 | #else |
108 | addItemBool("ShowFullMenu",&mShowFullMenu,true); | 108 | addItemBool("ShowFullMenu",&mShowFullMenu,true); |
109 | #endif | 109 | #endif |
110 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 110 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
111 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 111 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
112 | addItemBool("ToolBarHorV",&mToolBarHorV, true ); | 112 | addItemBool("ToolBarHorV",&mToolBarHorV, true ); |
113 | addItemBool("ToolBarUpV",&mToolBarUpV, false ); | 113 | addItemBool("ToolBarUpV",&mToolBarUpV, false ); |
114 | addItemBool("ToolBarHorN",&mToolBarHorN, true ); | 114 | addItemBool("ToolBarHorN",&mToolBarHorN, true ); |
115 | addItemBool("ToolBarUpN",&mToolBarUpN, false ); | 115 | addItemBool("ToolBarUpN",&mToolBarUpN, false ); |
116 | addItemBool("ToolBarHorF",&mToolBarHorF, true ); | 116 | addItemBool("ToolBarHorF",&mToolBarHorF, true ); |
117 | addItemBool("ToolBarUpF",&mToolBarUpF, false ); | 117 | addItemBool("ToolBarUpF",&mToolBarUpF, false ); |
118 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); | 118 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); |
119 | addItemInt("Whats Next Days",&mWhatsNextDays,3); | 119 | addItemInt("Whats Next Days",&mWhatsNextDays,3); |
120 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); | 120 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); |
121 | 121 | ||
122 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); | 122 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); |
123 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); | 123 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); |
124 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); | 124 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); |
125 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); | 125 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); |
126 | addItemInt("AllDay Size",&mAllDaySize,28); | 126 | addItemInt("AllDay Size",&mAllDaySize,28); |
127 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; | 127 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; |
128 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); | 128 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); |
129 | 129 | ||
130 | addItemStringList("LocationDefaults",&mLocationDefaults ); | 130 | addItemStringList("LocationDefaults",&mLocationDefaults ); |
131 | addItemStringList("EventSummary User",&mEventSummaryUser); | 131 | addItemStringList("EventSummary User",&mEventSummaryUser); |
132 | addItemStringList("TodoSummary User",&mTodoSummaryUser); | 132 | addItemStringList("TodoSummary User",&mTodoSummaryUser); |
133 | 133 | ||
134 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 134 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
135 | addItemBool("Enable Project View",&mEnableProjectView,false); | 135 | addItemBool("Enable Project View",&mEnableProjectView,false); |
136 | addItemBool("Auto Save",&mAutoSave,false); | 136 | addItemBool("Auto Save",&mAutoSave,false); |
137 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); | 137 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); |
138 | addItemBool("Confirm Deletes",&mConfirm,true); | 138 | addItemBool("Confirm Deletes",&mConfirm,true); |
139 | addItemString("Archive File",&mArchiveFile); | 139 | addItemString("Archive File",&mArchiveFile); |
140 | addItemString("Html Export File",&mHtmlExportFile, | 140 | addItemString("Html Export File",&mHtmlExportFile, |
141 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); | 141 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); |
142 | addItemBool("Html With Save",&mHtmlWithSave,false); | 142 | addItemBool("Html With Save",&mHtmlWithSave,false); |
143 | 143 | ||
144 | KPrefs::setCurrentGroup("Personal Settings"); | 144 | KPrefs::setCurrentGroup("Personal Settings"); |
145 | 145 | ||
146 | addItemInt("Mail Client",&mMailClient,MailClientKMail); | 146 | addItemInt("Mail Client",&mMailClient,MailClientKMail); |
147 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); | 147 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); |
148 | addItemBool("Bcc",&mBcc,false); | 148 | addItemBool("Bcc",&mBcc,false); |
149 | 149 | ||
150 | KPrefs::setCurrentGroup("Time & Date"); | 150 | KPrefs::setCurrentGroup("Time & Date"); |
151 | 151 | ||
152 | 152 | ||
153 | addItemInt("Default Start Time",&mStartTime,10); | 153 | addItemInt("Default Start Time",&mStartTime,10); |
154 | addItemInt("Default Duration",&mDefaultDuration,2); | 154 | addItemInt("Default Duration",&mDefaultDuration,2); |
155 | addItemInt("Default Alarm Time",&mAlarmTime,3); | 155 | addItemInt("Default Alarm Time",&mAlarmTime,3); |
156 | KPrefs::setCurrentGroup("AlarmSettings"); | 156 | KPrefs::setCurrentGroup("AlarmSettings"); |
157 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); | 157 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); |
158 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); | 158 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); |
159 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); | 159 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); |
160 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); | 160 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); |
161 | 161 | ||
162 | 162 | ||
163 | KPrefs::setCurrentGroup("Calendar"); | 163 | KPrefs::setCurrentGroup("Calendar"); |
164 | 164 | ||
165 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); | 165 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); |
166 | 166 | ||
167 | KPrefs::setCurrentGroup("Fonts"); | 167 | KPrefs::setCurrentGroup("Fonts"); |
168 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); | 168 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); |
169 | QFont fon = KGlobalSettings::generalFont(); | 169 | QFont fon = KGlobalSettings::generalFont(); |
170 | addItemFont("TimeBar Font",&mTimeBarFont,fon ); | 170 | addItemFont("TimeBar Font",&mTimeBarFont,fon ); |
171 | addItemFont("MonthView Font",&mMonthViewFont,fon); | 171 | addItemFont("MonthView Font",&mMonthViewFont,fon); |
172 | addItemFont("AgendaView Font",&mAgendaViewFont,fon); | 172 | addItemFont("AgendaView Font",&mAgendaViewFont,fon); |
173 | addItemFont("MarcusBains Font",&mMarcusBainsFont,fon); | 173 | addItemFont("MarcusBains Font",&mMarcusBainsFont,fon); |
174 | addItemFont("TimeLabels Font",&mTimeLabelsFont,fon); | 174 | addItemFont("TimeLabels Font",&mTimeLabelsFont,fon); |
175 | addItemFont("TodoView Font",&mTodoViewFont,fon); | 175 | addItemFont("TodoView Font",&mTodoViewFont,fon); |
176 | addItemFont("ListView Font",&mListViewFont,fon); | 176 | addItemFont("ListView Font",&mListViewFont,fon); |
177 | addItemFont("DateNavigator Font",&mDateNavigatorFont,fon); | 177 | addItemFont("DateNavigator Font",&mDateNavigatorFont,fon); |
178 | addItemFont("EditBox Font",&mEditBoxFont,fon); | 178 | addItemFont("EditBox Font",&mEditBoxFont,fon); |
179 | addItemFont("JournalView Font",&mJornalViewFont,fon); | 179 | addItemFont("JournalView Font",&mJornalViewFont,fon); |
180 | addItemFont("WhatsNextView Font",&mWhatsNextFont,fon); | 180 | addItemFont("WhatsNextView Font",&mWhatsNextFont,fon); |
181 | addItemFont("EventView Font",&mEventViewFont,fon); | 181 | addItemFont("EventView Font",&mEventViewFont,fon); |
182 | 182 | ||
183 | KPrefs::setCurrentGroup("RemoteSyncing"); | 183 | KPrefs::setCurrentGroup("RemoteSyncing"); |
184 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); | 184 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); |
185 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); | 185 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); |
186 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 186 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
187 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 187 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
188 | 188 | ||
189 | #ifdef _WIN32_ | 189 | #ifdef _WIN32_ |
190 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 190 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
191 | #else | 191 | #else |
192 | QString hdp= locateLocal("data","korganizer")+"/"; | 192 | QString hdp= locateLocal("data","korganizer")+"/"; |
193 | #endif | 193 | #endif |
194 | 194 | ||
195 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | 195 | KPrefs::setCurrentGroup("LoadSaveFileNames"); |
196 | 196 | ||
197 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | 197 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); |
198 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | 198 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); |
199 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | 199 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); |
200 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 200 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
201 | 201 | ||
202 | 202 | ||
203 | KPrefs::setCurrentGroup("Locale"); | 203 | KPrefs::setCurrentGroup("Locale"); |
204 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 204 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
205 | 205 | ||
206 | 206 | ||
207 | KPrefs::setCurrentGroup("Colors"); | 207 | KPrefs::setCurrentGroup("Colors"); |
208 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | 208 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); |
209 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | 209 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); |
210 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | 210 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); |
211 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); | 211 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); |
212 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | 212 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); |
213 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | 213 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); |
214 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | 214 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); |
215 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | 215 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); |
216 | addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor); | 216 | addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor); |
217 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | 217 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); |
218 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | 218 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); |
219 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | 219 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); |
220 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | 220 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); |
221 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | 221 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); |
222 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); | 222 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); |
223 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | 223 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); |
224 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | 224 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); |
225 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | 225 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); |
226 | addItemBool("UseAppColors",&mUseAppColors,false); | 226 | addItemBool("UseAppColors",&mUseAppColors,false); |
227 | 227 | ||
228 | 228 | ||
229 | 229 | ||
230 | KPrefs::setCurrentGroup("Views"); | 230 | KPrefs::setCurrentGroup("Views"); |
231 | addItemBool("Block Popup Menu",&mBlockPopupMenu,true); | ||
231 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); | 232 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); |
232 | addItemInt("Hour Size",&mHourSize,8); | 233 | addItemInt("Hour Size",&mHourSize,8); |
233 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | 234 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); |
234 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | 235 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); |
235 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | 236 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); |
236 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | 237 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); |
237 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); | 238 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); |
238 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); | 239 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); |
239 | #ifdef DESKTOP_VERION | 240 | #ifdef DESKTOP_VERION |
240 | addItemBool("Enable ToolTips",&mEnableToolTips,true); | 241 | addItemBool("Enable ToolTips",&mEnableToolTips,true); |
241 | #else | 242 | #else |
242 | addItemBool("Enable ToolTips",&mEnableToolTips,false); | 243 | addItemBool("Enable ToolTips",&mEnableToolTips,false); |
243 | #endif | 244 | #endif |
244 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); | 245 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); |
245 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); | 246 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); |
246 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); | 247 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); |
247 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); | 248 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); |
248 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); | 249 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); |
249 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); | 250 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); |
250 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); | 251 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); |
251 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | 252 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); |
252 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | 253 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); |
253 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; | 254 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; |
254 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); | 255 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); |
255 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | 256 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); |
256 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | 257 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); |
257 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | 258 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); |
258 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | 259 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); |
259 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); | 260 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); |
260 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); | 261 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); |
261 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); | 262 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); |
262 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | 263 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); |
263 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | 264 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); |
264 | #ifdef DESKTOP_VERSION | 265 | #ifdef DESKTOP_VERSION |
265 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | 266 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); |
266 | #else | 267 | #else |
267 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | 268 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); |
268 | #endif | 269 | #endif |
269 | addItemInt("Day Begins",&mDayBegins,7); | 270 | addItemInt("Day Begins",&mDayBegins,7); |
270 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | 271 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); |
271 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | 272 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); |
272 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | 273 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); |
273 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | 274 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); |
274 | 275 | ||
275 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | 276 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); |
276 | addItemBool("Full View Month",&mFullViewMonth,true); | 277 | addItemBool("Full View Month",&mFullViewMonth,true); |
277 | addItemBool("Full View Todo",&mFullViewTodo,true); | 278 | addItemBool("Full View Todo",&mFullViewTodo,true); |
278 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | 279 | addItemBool("Quick Todo",&mEnableQuickTodo,false); |
279 | 280 | ||
280 | addItemInt("Next X Days",&mNextXDays,3); | 281 | addItemInt("Next X Days",&mNextXDays,3); |
281 | 282 | ||
282 | KPrefs::setCurrentGroup("Printer"); | 283 | KPrefs::setCurrentGroup("Printer"); |
283 | 284 | ||
284 | KPrefs::setCurrentGroup("Layout"); | 285 | KPrefs::setCurrentGroup("Layout"); |
285 | 286 | ||
286 | addItemBool("CompactDialogs",&mCompactDialogs,false); | 287 | addItemBool("CompactDialogs",&mCompactDialogs,false); |
287 | addItemBool("VerticalScreen",&mVerticalScreen,true); | 288 | addItemBool("VerticalScreen",&mVerticalScreen,true); |
288 | 289 | ||
289 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | 290 | KPrefs::setCurrentGroup("KOrganizer Plugins"); |
290 | 291 | ||
291 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | 292 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); |
292 | 293 | ||
293 | KPrefs::setCurrentGroup("Group Scheduling"); | 294 | KPrefs::setCurrentGroup("Group Scheduling"); |
294 | 295 | ||
295 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | 296 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); |
296 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | 297 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); |
297 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | 298 | addItemStringList("AdditionalMails",&mAdditionalMails,""); |
298 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | 299 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); |
299 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | 300 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); |
300 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | 301 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); |
301 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | 302 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); |
302 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | 303 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); |
303 | 304 | ||
304 | KPrefs::setCurrentGroup( "Editors" ); | 305 | KPrefs::setCurrentGroup( "Editors" ); |
305 | 306 | ||
306 | addItemStringList( "EventTemplates", &mEventTemplates ); | 307 | addItemStringList( "EventTemplates", &mEventTemplates ); |
307 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | 308 | addItemStringList( "TodoTemplates", &mTodoTemplates ); |
308 | 309 | ||
309 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | 310 | addItemInt("DestinationPolicy",&mDestination,standardDestination); |
310 | 311 | ||
311 | KPrefs::setCurrentGroup( "ViewOptions" ); | 312 | KPrefs::setCurrentGroup( "ViewOptions" ); |
312 | addItemBool("EVshowDetails",&mEVshowDetails,true); | 313 | addItemBool("EVshowDetails",&mEVshowDetails,true); |
313 | addItemBool("EVshowCreated",&mEVshowCreated,true); | 314 | addItemBool("EVshowCreated",&mEVshowCreated,true); |
314 | addItemBool("EVshowChanged",&mEVshowChanged,true); | 315 | addItemBool("EVshowChanged",&mEVshowChanged,true); |
315 | addItemBool("WTshowDetails",&mWTshowDetails,false); | 316 | addItemBool("WTshowDetails",&mWTshowDetails,false); |
316 | addItemBool("WTshowCreated",&mWTshowCreated,false); | 317 | addItemBool("WTshowCreated",&mWTshowCreated,false); |
317 | addItemBool("WTshowChanged",&mWTshowChanged,false); | 318 | addItemBool("WTshowChanged",&mWTshowChanged,false); |
318 | 319 | ||
319 | } | 320 | } |
320 | 321 | ||
321 | 322 | ||
322 | KOPrefs::~KOPrefs() | 323 | KOPrefs::~KOPrefs() |
323 | { | 324 | { |
324 | if (mInstance == this) | 325 | if (mInstance == this) |
325 | mInstance = insd.setObject(0); | 326 | mInstance = insd.setObject(0); |
326 | 327 | ||
327 | //qDebug("KOPrefs::~KOPrefs() "); | 328 | //qDebug("KOPrefs::~KOPrefs() "); |
328 | } | 329 | } |
329 | 330 | ||
330 | 331 | ||
331 | KOPrefs *KOPrefs::instance() | 332 | KOPrefs *KOPrefs::instance() |
332 | { | 333 | { |
333 | if (!mInstance) { | 334 | if (!mInstance) { |
334 | mInstance = insd.setObject(new KOPrefs()); | 335 | mInstance = insd.setObject(new KOPrefs()); |
335 | mInstance->readConfig(); | 336 | mInstance->readConfig(); |
336 | } | 337 | } |
337 | 338 | ||
338 | return mInstance; | 339 | return mInstance; |
339 | } | 340 | } |
340 | 341 | ||
341 | void KOPrefs::usrSetDefaults() | 342 | void KOPrefs::usrSetDefaults() |
342 | { | 343 | { |
343 | 344 | ||
344 | } | 345 | } |
345 | 346 | ||
346 | void KOPrefs::fillMailDefaults() | 347 | void KOPrefs::fillMailDefaults() |
347 | { | 348 | { |
348 | if (mName.isEmpty()) mName = i18n("Anonymous"); | 349 | if (mName.isEmpty()) mName = i18n("Anonymous"); |
349 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 350 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
350 | } | 351 | } |
351 | 352 | ||
352 | void KOPrefs::setTimeZoneIdDefault() | 353 | void KOPrefs::setTimeZoneIdDefault() |
353 | { | 354 | { |
354 | ; | 355 | ; |
355 | } | 356 | } |
356 | 357 | ||
357 | void KOPrefs::setAllDefaults() | 358 | void KOPrefs::setAllDefaults() |
358 | { | 359 | { |
359 | setCategoryDefaults(); | 360 | setCategoryDefaults(); |
360 | mEventSummaryUser = getDefaultList() ; | 361 | mEventSummaryUser = getDefaultList() ; |
361 | mTodoSummaryUser = getDefaultList() ; | 362 | mTodoSummaryUser = getDefaultList() ; |
362 | mLocationDefaults = getLocationDefaultList(); | 363 | mLocationDefaults = getLocationDefaultList(); |
363 | } | 364 | } |
364 | 365 | ||
365 | void KOPrefs::setCategoryDefaults() | 366 | void KOPrefs::setCategoryDefaults() |
366 | { | 367 | { |
367 | mCustomCategories.clear(); | 368 | mCustomCategories.clear(); |
368 | mCustomCategories = getDefaultList(); | 369 | mCustomCategories = getDefaultList(); |
369 | 370 | ||
370 | QStringList::Iterator it; | 371 | QStringList::Iterator it; |
371 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 372 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
372 | setCategoryColor(*it,mDefaultCategoryColor); | 373 | setCategoryColor(*it,mDefaultCategoryColor); |
373 | } | 374 | } |
374 | } | 375 | } |
375 | QStringList KOPrefs::getLocationDefaultList() | 376 | QStringList KOPrefs::getLocationDefaultList() |
376 | { | 377 | { |
377 | QStringList retval ; | 378 | QStringList retval ; |
378 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | 379 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") |
379 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") | 380 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") |
380 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | 381 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") |
381 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | 382 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; |
382 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | 383 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") |
383 | 384 | ||
384 | retval.sort(); | 385 | retval.sort(); |
385 | return retval; | 386 | return retval; |
386 | } | 387 | } |
387 | QStringList KOPrefs::getDefaultList() | 388 | QStringList KOPrefs::getDefaultList() |
388 | { | 389 | { |
389 | QStringList retval ; | 390 | QStringList retval ; |
390 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") | 391 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") |
391 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") | 392 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") |
392 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") | 393 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") |
393 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") | 394 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") |
394 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") | 395 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") |
395 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") | 396 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") |
396 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") | 397 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") |
397 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; | 398 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; |
398 | retval.sort(); | 399 | retval.sort(); |
399 | //qDebug("cat %s ", retval.join("-").latin1()); | 400 | //qDebug("cat %s ", retval.join("-").latin1()); |
400 | return retval; | 401 | return retval; |
401 | } | 402 | } |
402 | 403 | ||
403 | void KOPrefs::usrReadConfig() | 404 | void KOPrefs::usrReadConfig() |
404 | { | 405 | { |
405 | config()->setGroup("General"); | 406 | config()->setGroup("General"); |
406 | 407 | ||
407 | //qDebug("KOPrefs::usrReadConfig() "); | 408 | //qDebug("KOPrefs::usrReadConfig() "); |
408 | mCustomCategories = config()->readListEntry("Custom Categories"); | 409 | mCustomCategories = config()->readListEntry("Custom Categories"); |
409 | mOldLoadedLanguage = mOldLanguage ; | 410 | mOldLoadedLanguage = mOldLanguage ; |
410 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | 411 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; |
411 | if (mLocationDefaults.isEmpty()) { | 412 | if (mLocationDefaults.isEmpty()) { |
412 | mLocationDefaults = getLocationDefaultList(); | 413 | mLocationDefaults = getLocationDefaultList(); |
413 | } | 414 | } |
414 | 415 | ||
415 | if (mEventSummaryUser.isEmpty()) { | 416 | if (mEventSummaryUser.isEmpty()) { |
416 | mEventSummaryUser = getDefaultList() ; | 417 | mEventSummaryUser = getDefaultList() ; |
417 | } | 418 | } |
418 | if (mTodoSummaryUser.isEmpty()) { | 419 | if (mTodoSummaryUser.isEmpty()) { |
419 | mTodoSummaryUser = getDefaultList() ; | 420 | mTodoSummaryUser = getDefaultList() ; |
420 | } | 421 | } |
421 | 422 | ||
422 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 423 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
423 | 424 | ||
424 | config()->setGroup("Personal Settings"); | 425 | config()->setGroup("Personal Settings"); |
425 | mName = config()->readEntry("user_name",""); | 426 | mName = config()->readEntry("user_name",""); |
426 | mEmail = config()->readEntry("user_email",""); | 427 | mEmail = config()->readEntry("user_email",""); |
427 | fillMailDefaults(); | 428 | fillMailDefaults(); |
428 | 429 | ||
429 | config()->setGroup("Category Colors"); | 430 | config()->setGroup("Category Colors"); |
430 | QStringList::Iterator it; | 431 | QStringList::Iterator it; |
431 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 432 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
432 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); | 433 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); |
433 | 434 | ||
434 | } | 435 | } |
435 | 436 | ||
436 | KPimPrefs::usrReadConfig(); | 437 | KPimPrefs::usrReadConfig(); |
437 | } | 438 | } |
438 | 439 | ||
439 | 440 | ||
440 | void KOPrefs::usrWriteConfig() | 441 | void KOPrefs::usrWriteConfig() |
441 | { | 442 | { |
442 | config()->setGroup("General"); | 443 | config()->setGroup("General"); |
443 | config()->writeEntry("Custom Categories",mCustomCategories); | 444 | config()->writeEntry("Custom Categories",mCustomCategories); |
444 | 445 | ||
445 | config()->setGroup("Personal Settings"); | 446 | config()->setGroup("Personal Settings"); |
446 | config()->writeEntry("user_name",mName); | 447 | config()->writeEntry("user_name",mName); |
447 | config()->writeEntry("user_email",mEmail); | 448 | config()->writeEntry("user_email",mEmail); |
448 | 449 | ||
449 | config()->setGroup("Category Colors"); | 450 | config()->setGroup("Category Colors"); |
450 | QDictIterator<QColor> it(mCategoryColors); | 451 | QDictIterator<QColor> it(mCategoryColors); |
451 | while (it.current()) { | 452 | while (it.current()) { |
452 | config()->writeEntry(it.currentKey(),*(it.current())); | 453 | config()->writeEntry(it.currentKey(),*(it.current())); |
453 | ++it; | 454 | ++it; |
454 | } | 455 | } |
455 | 456 | ||
456 | 457 | ||
457 | KPimPrefs::usrWriteConfig(); | 458 | KPimPrefs::usrWriteConfig(); |
458 | } | 459 | } |
459 | 460 | ||
460 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) | 461 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) |
461 | { | 462 | { |
462 | mCategoryColors.replace(cat,new QColor(color)); | 463 | mCategoryColors.replace(cat,new QColor(color)); |
463 | } | 464 | } |
464 | 465 | ||
465 | QColor *KOPrefs::categoryColor(QString cat) | 466 | QColor *KOPrefs::categoryColor(QString cat) |
466 | { | 467 | { |
467 | QColor *color = 0; | 468 | QColor *color = 0; |
468 | 469 | ||
469 | if (!cat.isEmpty()) color = mCategoryColors[cat]; | 470 | if (!cat.isEmpty()) color = mCategoryColors[cat]; |
470 | 471 | ||
471 | if (color) return color; | 472 | if (color) return color; |
472 | else return &mDefaultCategoryColor; | 473 | else return &mDefaultCategoryColor; |
473 | } | 474 | } |
474 | 475 | ||
475 | void KOPrefs::setFullName(const QString &name) | 476 | void KOPrefs::setFullName(const QString &name) |
476 | { | 477 | { |
477 | mName = name; | 478 | mName = name; |
478 | } | 479 | } |
479 | 480 | ||
480 | void KOPrefs::setEmail(const QString &email) | 481 | void KOPrefs::setEmail(const QString &email) |
481 | { | 482 | { |
482 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); | 483 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); |
483 | mEmail = email; | 484 | mEmail = email; |
484 | } | 485 | } |
485 | 486 | ||
486 | QString KOPrefs::fullName() | 487 | QString KOPrefs::fullName() |
487 | { | 488 | { |
488 | if (mEmailControlCenter) { | 489 | if (mEmailControlCenter) { |
489 | KEMailSettings settings; | 490 | KEMailSettings settings; |
490 | return settings.getSetting(KEMailSettings::RealName); | 491 | return settings.getSetting(KEMailSettings::RealName); |
491 | } else { | 492 | } else { |
492 | return mName; | 493 | return mName; |
493 | } | 494 | } |
494 | } | 495 | } |
495 | 496 | ||
496 | QString KOPrefs::email() | 497 | QString KOPrefs::email() |
497 | { | 498 | { |
498 | if (mEmailControlCenter) { | 499 | if (mEmailControlCenter) { |
499 | KEMailSettings settings; | 500 | KEMailSettings settings; |
500 | return settings.getSetting(KEMailSettings::EmailAddress); | 501 | return settings.getSetting(KEMailSettings::EmailAddress); |
501 | } else { | 502 | } else { |
502 | return mEmail; | 503 | return mEmail; |
503 | } | 504 | } |
504 | } | 505 | } |
505 | KConfig* KOPrefs::getConfig() | 506 | KConfig* KOPrefs::getConfig() |
506 | { | 507 | { |
507 | return config(); | 508 | return config(); |
508 | } | 509 | } |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index d511faa..2a0ee64 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -1,317 +1,319 @@ | |||
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 | #define VIEW_WN_VIEW 1 | 35 | #define VIEW_WN_VIEW 1 |
36 | #define VIEW_NX_VIEW 2 | 36 | #define VIEW_NX_VIEW 2 |
37 | #define VIEW_J_VIEW 3 | 37 | #define VIEW_J_VIEW 3 |
38 | #define VIEW_A_VIEW 4 | 38 | #define VIEW_A_VIEW 4 |
39 | #define VIEW_ML_VIEW 5 | 39 | #define VIEW_ML_VIEW 5 |
40 | #define VIEW_M_VIEW 6 | 40 | #define VIEW_M_VIEW 6 |
41 | #define VIEW_L_VIEW 7 | 41 | #define VIEW_L_VIEW 7 |
42 | #define VIEW_T_VIEW 8 | 42 | #define VIEW_T_VIEW 8 |
43 | 43 | ||
44 | class KOPrefs : public KPimPrefs | 44 | class KOPrefs : public KPimPrefs |
45 | { | 45 | { |
46 | public: | 46 | public: |
47 | enum { FormatVCalendar, FormatICalendar }; | 47 | enum { FormatVCalendar, FormatICalendar }; |
48 | enum { MailClientKMail, MailClientSendmail }; | 48 | enum { MailClientKMail, MailClientSendmail }; |
49 | enum { IMIPDummy, IMIPKMail }; | 49 | enum { IMIPDummy, IMIPKMail }; |
50 | enum { IMIPOutbox, IMIPdirectsend }; | 50 | enum { IMIPOutbox, IMIPdirectsend }; |
51 | enum { neverAuto, addressbookAuto, selectedAuto }; | 51 | enum { neverAuto, addressbookAuto, selectedAuto }; |
52 | enum { standardDestination, askDestination }; | 52 | enum { standardDestination, askDestination }; |
53 | 53 | ||
54 | virtual ~KOPrefs(); | 54 | virtual ~KOPrefs(); |
55 | 55 | ||
56 | /** Get instance of KOPrefs. It is made sure that there is only one | 56 | /** Get instance of KOPrefs. It is made sure that there is only one |
57 | instance. */ | 57 | instance. */ |
58 | static KOPrefs *instance(); | 58 | static KOPrefs *instance(); |
59 | 59 | ||
60 | /** Set preferences to default values */ | 60 | /** Set preferences to default values */ |
61 | void usrSetDefaults(); | 61 | void usrSetDefaults(); |
62 | 62 | ||
63 | /** Read preferences from config file */ | 63 | /** Read preferences from config file */ |
64 | void usrReadConfig(); | 64 | void usrReadConfig(); |
65 | 65 | ||
66 | /** Write preferences to config file */ | 66 | /** Write preferences to config file */ |
67 | void usrWriteConfig(); | 67 | void usrWriteConfig(); |
68 | void setCategoryDefaults(); | 68 | void setCategoryDefaults(); |
69 | void setAllDefaults(); | 69 | void setAllDefaults(); |
70 | 70 | ||
71 | protected: | 71 | protected: |
72 | void setTimeZoneIdDefault(); | 72 | void setTimeZoneIdDefault(); |
73 | 73 | ||
74 | /** Fill empty mail fields with default values. */ | 74 | /** Fill empty mail fields with default values. */ |
75 | void fillMailDefaults(); | 75 | void fillMailDefaults(); |
76 | 76 | ||
77 | private: | 77 | private: |
78 | /** Constructor disabled for public. Use instance() to create a KOPrefs | 78 | /** Constructor disabled for public. Use instance() to create a KOPrefs |
79 | object. */ | 79 | object. */ |
80 | KOPrefs(); | 80 | KOPrefs(); |
81 | 81 | ||
82 | static KOPrefs *mInstance; | 82 | static KOPrefs *mInstance; |
83 | QStringList getDefaultList(); | 83 | QStringList getDefaultList(); |
84 | QStringList getLocationDefaultList(); | 84 | QStringList getLocationDefaultList(); |
85 | public: | 85 | public: |
86 | // preferences data | 86 | // preferences data |
87 | KConfig* getConfig(); | 87 | KConfig* getConfig(); |
88 | void setFullName(const QString &); | 88 | void setFullName(const QString &); |
89 | QString fullName(); | 89 | QString fullName(); |
90 | void setEmail(const QString &); | 90 | void setEmail(const QString &); |
91 | QString email(); | 91 | QString email(); |
92 | 92 | ||
93 | QString mAdditional; | 93 | QString mAdditional; |
94 | 94 | ||
95 | bool mEmailControlCenter; | 95 | bool mEmailControlCenter; |
96 | 96 | ||
97 | bool mBcc; | 97 | bool mBcc; |
98 | bool mAutoSave; | 98 | bool mAutoSave; |
99 | int mAutoSaveInterval; | 99 | int mAutoSaveInterval; |
100 | bool mConfirm; | 100 | bool mConfirm; |
101 | 101 | ||
102 | bool mEnableGroupScheduling; | 102 | bool mEnableGroupScheduling; |
103 | bool mEnableProjectView; | 103 | bool mEnableProjectView; |
104 | 104 | ||
105 | int mDefaultFormat; | 105 | int mDefaultFormat; |
106 | int mMailClient; | 106 | int mMailClient; |
107 | 107 | ||
108 | int mStartTime; | 108 | int mStartTime; |
109 | int mDefaultDuration; | 109 | int mDefaultDuration; |
110 | int mAlarmTime; | 110 | int mAlarmTime; |
111 | 111 | ||
112 | int mWorkingHoursStart; | 112 | int mWorkingHoursStart; |
113 | int mWorkingHoursEnd; | 113 | int mWorkingHoursEnd; |
114 | bool mExcludeHolidays; | 114 | bool mExcludeHolidays; |
115 | bool mExcludeSaturdays; | 115 | bool mExcludeSaturdays; |
116 | bool mMarcusBainsShowSeconds; | 116 | bool mMarcusBainsShowSeconds; |
117 | 117 | ||
118 | QFont mTimeBarFont; | 118 | QFont mTimeBarFont; |
119 | QFont mMonthViewFont; | 119 | QFont mMonthViewFont; |
120 | QFont mAgendaViewFont; | 120 | QFont mAgendaViewFont; |
121 | QFont mMarcusBainsFont; | 121 | QFont mMarcusBainsFont; |
122 | QFont mTimeLabelsFont; | 122 | QFont mTimeLabelsFont; |
123 | QFont mTodoViewFont; | 123 | QFont mTodoViewFont; |
124 | QFont mListViewFont; | 124 | QFont mListViewFont; |
125 | QFont mDateNavigatorFont; | 125 | QFont mDateNavigatorFont; |
126 | QFont mEditBoxFont; | 126 | QFont mEditBoxFont; |
127 | QFont mJornalViewFont; | 127 | QFont mJornalViewFont; |
128 | QFont mWhatsNextFont; | 128 | QFont mWhatsNextFont; |
129 | QFont mEventViewFont; | 129 | QFont mEventViewFont; |
130 | 130 | ||
131 | 131 | ||
132 | 132 | ||
133 | 133 | ||
134 | QColor mHolidayColor; | 134 | QColor mHolidayColor; |
135 | QColor mHighlightColor; | 135 | QColor mHighlightColor; |
136 | QColor mEventColor; | 136 | QColor mEventColor; |
137 | QColor mTodoDoneColor; | 137 | QColor mTodoDoneColor; |
138 | QColor mAgendaBgColor; | 138 | QColor mAgendaBgColor; |
139 | QColor mWorkingHoursColor; | 139 | QColor mWorkingHoursColor; |
140 | QColor mTodoDueTodayColor; | 140 | QColor mTodoDueTodayColor; |
141 | QColor mTodoOverdueColor; | 141 | QColor mTodoOverdueColor; |
142 | QColor mTodoRunColor; | 142 | QColor mTodoRunColor; |
143 | QColor mMonthViewEvenColor; | 143 | QColor mMonthViewEvenColor; |
144 | QColor mMonthViewOddColor; | 144 | QColor mMonthViewOddColor; |
145 | QColor mMonthViewHolidayColor; | 145 | QColor mMonthViewHolidayColor; |
146 | bool mMonthViewUsesDayColors; | 146 | bool mMonthViewUsesDayColors; |
147 | bool mMonthViewSatSunTog; | 147 | bool mMonthViewSatSunTog; |
148 | bool mMonthViewWeek; | 148 | bool mMonthViewWeek; |
149 | QColor mAppColor1; | 149 | QColor mAppColor1; |
150 | QColor mAppColor2; | 150 | QColor mAppColor2; |
151 | bool mUseAppColors; | 151 | bool mUseAppColors; |
152 | 152 | ||
153 | int mDayBegins; | 153 | int mDayBegins; |
154 | int mHourSize; | 154 | int mHourSize; |
155 | int mAllDaySize; | 155 | int mAllDaySize; |
156 | bool mShowFullMenu; | 156 | bool mShowFullMenu; |
157 | bool mDailyRecur; | 157 | bool mDailyRecur; |
158 | bool mWeeklyRecur; | 158 | bool mWeeklyRecur; |
159 | bool mMonthDailyRecur; | 159 | bool mMonthDailyRecur; |
160 | bool mMonthWeeklyRecur; | 160 | bool mMonthWeeklyRecur; |
161 | bool mMonthShowIcons; | 161 | bool mMonthShowIcons; |
162 | bool mMonthShowShort; | 162 | bool mMonthShowShort; |
163 | bool mEnableToolTips; | 163 | bool mEnableToolTips; |
164 | bool mEnableMonthScroll; | 164 | bool mEnableMonthScroll; |
165 | bool mFullViewMonth; | 165 | bool mFullViewMonth; |
166 | bool mMonthViewUsesCategoryColor; | 166 | bool mMonthViewUsesCategoryColor; |
167 | bool mFullViewTodo; | 167 | bool mFullViewTodo; |
168 | bool mShowCompletedTodo; | 168 | bool mShowCompletedTodo; |
169 | bool mMarcusBainsEnabled; | 169 | bool mMarcusBainsEnabled; |
170 | int mNextXDays; | 170 | int mNextXDays; |
171 | int mWhatsNextDays; | 171 | int mWhatsNextDays; |
172 | int mWhatsNextPrios; | 172 | int mWhatsNextPrios; |
173 | bool mEnableQuickTodo; | 173 | bool mEnableQuickTodo; |
174 | 174 | ||
175 | bool mCompactDialogs; | 175 | bool mCompactDialogs; |
176 | bool mVerticalScreen; | 176 | bool mVerticalScreen; |
177 | 177 | ||
178 | bool mShowIconNewTodo; | 178 | bool mShowIconNewTodo; |
179 | bool mShowIconNewEvent; | 179 | bool mShowIconNewEvent; |
180 | bool mShowIconSearch; | 180 | bool mShowIconSearch; |
181 | bool mShowIconList; | 181 | bool mShowIconList; |
182 | bool mShowIconDay1; | 182 | bool mShowIconDay1; |
183 | bool mShowIconDay5; | 183 | bool mShowIconDay5; |
184 | bool mShowIconDay6; | 184 | bool mShowIconDay6; |
185 | bool mShowIconDay7; | 185 | bool mShowIconDay7; |
186 | bool mShowIconMonth; | 186 | bool mShowIconMonth; |
187 | bool mShowIconTodoview; | 187 | bool mShowIconTodoview; |
188 | bool mShowIconBackFast; | 188 | bool mShowIconBackFast; |
189 | bool mShowIconBack; | 189 | bool mShowIconBack; |
190 | bool mShowIconToday; | 190 | bool mShowIconToday; |
191 | bool mShowIconForward; | 191 | bool mShowIconForward; |
192 | bool mShowIconForwardFast; | 192 | bool mShowIconForwardFast; |
193 | bool mShowIconWhatsThis; | 193 | bool mShowIconWhatsThis; |
194 | bool mShowIconWeekNum; | 194 | bool mShowIconWeekNum; |
195 | bool mShowIconNextDays; | 195 | bool mShowIconNextDays; |
196 | bool mShowIconNext; | 196 | bool mShowIconNext; |
197 | bool mShowIconJournal; | 197 | bool mShowIconJournal; |
198 | bool mShowIconFilter; | 198 | bool mShowIconFilter; |
199 | bool mShowIconOnetoolbar; | 199 | bool mShowIconOnetoolbar; |
200 | bool mShowIconNavigator; | 200 | bool mShowIconNavigator; |
201 | bool mShowIconAllday; | 201 | bool mShowIconAllday; |
202 | bool mShowIconFilterview; | 202 | bool mShowIconFilterview; |
203 | bool mShowIconToggleFull; | 203 | bool mShowIconToggleFull; |
204 | 204 | ||
205 | bool mShowIconStretch; | 205 | bool mShowIconStretch; |
206 | 206 | ||
207 | bool mToolBarHor; | 207 | bool mToolBarHor; |
208 | bool mToolBarUp; | 208 | bool mToolBarUp; |
209 | bool mToolBarHorV; | 209 | bool mToolBarHorV; |
210 | bool mToolBarUpV; | 210 | bool mToolBarUpV; |
211 | bool mToolBarHorN; | 211 | bool mToolBarHorN; |
212 | bool mToolBarUpN; | 212 | bool mToolBarUpN; |
213 | bool mToolBarHorF; | 213 | bool mToolBarHorF; |
214 | bool mToolBarUpF; | 214 | bool mToolBarUpF; |
215 | bool mToolBarMiniIcons; | 215 | bool mToolBarMiniIcons; |
216 | 216 | ||
217 | bool mAskForQuit; | 217 | bool mAskForQuit; |
218 | bool mUsePassWd; | 218 | bool mUsePassWd; |
219 | bool mShowSyncEvents; | 219 | bool mShowSyncEvents; |
220 | bool mShowTodoInAgenda; | 220 | bool mShowTodoInAgenda; |
221 | bool mShowTimeInAgenda; | 221 | bool mShowTimeInAgenda; |
222 | bool mHideNonStartedTodos; | 222 | bool mHideNonStartedTodos; |
223 | 223 | ||
224 | bool mBlockPopupMenu; | ||
225 | |||
224 | int mLastSyncTime; | 226 | int mLastSyncTime; |
225 | void setCategoryColor(QString cat,const QColor & color); | 227 | void setCategoryColor(QString cat,const QColor & color); |
226 | QColor *categoryColor(QString cat); | 228 | QColor *categoryColor(QString cat); |
227 | 229 | ||
228 | QString mArchiveFile; | 230 | QString mArchiveFile; |
229 | QString mHtmlExportFile; | 231 | QString mHtmlExportFile; |
230 | bool mHtmlWithSave; | 232 | bool mHtmlWithSave; |
231 | 233 | ||
232 | QStringList mSelectedPlugins; | 234 | QStringList mSelectedPlugins; |
233 | 235 | ||
234 | QString mLastImportFile; | 236 | QString mLastImportFile; |
235 | QString mLastVcalFile; | 237 | QString mLastVcalFile; |
236 | QString mLastSaveFile; | 238 | QString mLastSaveFile; |
237 | QString mLastLoadFile; | 239 | QString mLastLoadFile; |
238 | 240 | ||
239 | 241 | ||
240 | QString mDefaultAlarmFile; | 242 | QString mDefaultAlarmFile; |
241 | int mIMIPScheduler; | 243 | int mIMIPScheduler; |
242 | int mIMIPSend; | 244 | int mIMIPSend; |
243 | QStringList mAdditionalMails; | 245 | QStringList mAdditionalMails; |
244 | int mIMIPAutoRefresh; | 246 | int mIMIPAutoRefresh; |
245 | int mIMIPAutoInsertReply; | 247 | int mIMIPAutoInsertReply; |
246 | int mIMIPAutoInsertRequest; | 248 | int mIMIPAutoInsertRequest; |
247 | int mIMIPAutoFreeBusy; | 249 | int mIMIPAutoFreeBusy; |
248 | int mIMIPAutoFreeBusyReply; | 250 | int mIMIPAutoFreeBusyReply; |
249 | 251 | ||
250 | QStringList mTodoTemplates; | 252 | QStringList mTodoTemplates; |
251 | QStringList mEventTemplates; | 253 | QStringList mEventTemplates; |
252 | 254 | ||
253 | int mDestination; | 255 | int mDestination; |
254 | 256 | ||
255 | 257 | ||
256 | bool mEditOnDoubleClick; | 258 | bool mEditOnDoubleClick; |
257 | bool mViewChangeHoldFullscreen; | 259 | bool mViewChangeHoldFullscreen; |
258 | bool mViewChangeHoldNonFullscreen; | 260 | bool mViewChangeHoldNonFullscreen; |
259 | bool mCenterOnCurrentTime; | 261 | bool mCenterOnCurrentTime; |
260 | bool mSetTimeToDayStartAt; | 262 | bool mSetTimeToDayStartAt; |
261 | bool mHighlightCurrentDay; | 263 | bool mHighlightCurrentDay; |
262 | bool mUseHighlightLightColor; | 264 | bool mUseHighlightLightColor; |
263 | bool mListViewMonthTimespan; | 265 | bool mListViewMonthTimespan; |
264 | bool mWNViewShowsParents; | 266 | bool mWNViewShowsParents; |
265 | bool mWNViewShowsPast; | 267 | bool mWNViewShowsPast; |
266 | bool mWNViewShowLocation; | 268 | bool mWNViewShowLocation; |
267 | bool mTodoViewShowsPercentage; | 269 | bool mTodoViewShowsPercentage; |
268 | bool mTodoViewUsesCatColors; | 270 | bool mTodoViewUsesCatColors; |
269 | bool mMonthViewUsesBigFont; | 271 | bool mMonthViewUsesBigFont; |
270 | bool mTodoViewUsesSmallFont; | 272 | bool mTodoViewUsesSmallFont; |
271 | bool mTodoViewUsesForegroundColor; | 273 | bool mTodoViewUsesForegroundColor; |
272 | bool mMonthViewUsesForegroundColor; | 274 | bool mMonthViewUsesForegroundColor; |
273 | 275 | ||
274 | bool mHightlightDateTimeEdit; | 276 | bool mHightlightDateTimeEdit; |
275 | bool mShortDateInViewer; | 277 | bool mShortDateInViewer; |
276 | 278 | ||
277 | bool mShowDateNavigator; | 279 | bool mShowDateNavigator; |
278 | 280 | ||
279 | QStringList mLocationDefaults; | 281 | QStringList mLocationDefaults; |
280 | QStringList mEventSummaryUser; | 282 | QStringList mEventSummaryUser; |
281 | QStringList mTodoSummaryUser; | 283 | QStringList mTodoSummaryUser; |
282 | 284 | ||
283 | bool mUseInternalAlarmNotification; | 285 | bool mUseInternalAlarmNotification; |
284 | int mAlarmPlayBeeps; | 286 | int mAlarmPlayBeeps; |
285 | int mAlarmSuspendTime; | 287 | int mAlarmSuspendTime; |
286 | int mAlarmSuspendCount; | 288 | int mAlarmSuspendCount; |
287 | int mAlarmBeepInterval; | 289 | int mAlarmBeepInterval; |
288 | int mOldLanguage; | 290 | int mOldLanguage; |
289 | int mOldLoadedLanguage; | 291 | int mOldLoadedLanguage; |
290 | 292 | ||
291 | 293 | ||
292 | QString mActiveSyncPort; | 294 | QString mActiveSyncPort; |
293 | QString mActiveSyncIP; | 295 | QString mActiveSyncIP; |
294 | 296 | ||
295 | // settings for eventviewer | 297 | // settings for eventviewer |
296 | bool mEVshowDetails; | 298 | bool mEVshowDetails; |
297 | bool mEVshowCreated; | 299 | bool mEVshowCreated; |
298 | bool mEVshowChanged; | 300 | bool mEVshowChanged; |
299 | bool mWTshowDetails; | 301 | bool mWTshowDetails; |
300 | bool mWTshowCreated; | 302 | bool mWTshowCreated; |
301 | bool mWTshowChanged; | 303 | bool mWTshowChanged; |
302 | 304 | ||
303 | int mCurrentDisplayedView; | 305 | int mCurrentDisplayedView; |
304 | 306 | ||
305 | private: | 307 | private: |
306 | QDict<QColor> mCategoryColors; | 308 | QDict<QColor> mCategoryColors; |
307 | QColor mDefaultCategoryColor; | 309 | QColor mDefaultCategoryColor; |
308 | 310 | ||
309 | QFont mDefaultTimeBarFont; | 311 | QFont mDefaultTimeBarFont; |
310 | QFont mDefaultViewFont; | 312 | QFont mDefaultViewFont; |
311 | QFont mDefaultMonthViewFont; | 313 | QFont mDefaultMonthViewFont; |
312 | 314 | ||
313 | QString mName; | 315 | QString mName; |
314 | QString mEmail; | 316 | QString mEmail; |
315 | }; | 317 | }; |
316 | 318 | ||
317 | #endif | 319 | #endif |
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp index a8943de..ad3c61c 100644 --- a/korganizer/koprefsdialog.cpp +++ b/korganizer/koprefsdialog.cpp | |||
@@ -1,937 +1,945 @@ | |||
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 | #include <kglobalsettings.h> | 56 | #include <kglobalsettings.h> |
57 | 57 | ||
58 | #include <kurlrequester.h> | 58 | #include <kurlrequester.h> |
59 | #include <klineedit.h> | 59 | #include <klineedit.h> |
60 | 60 | ||
61 | #if defined(USE_SOLARIS) | 61 | #if defined(USE_SOLARIS) |
62 | #include <sys/param.h> | 62 | #include <sys/param.h> |
63 | 63 | ||
64 | #define ZONEINFODIR "/usr/share/lib/zoneinfo" | 64 | #define ZONEINFODIR "/usr/share/lib/zoneinfo" |
65 | #define INITFILE "/etc/default/init" | 65 | #define INITFILE "/etc/default/init" |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | #include "koprefs.h" | 68 | #include "koprefs.h" |
69 | 69 | ||
70 | #include "koprefsdialog.h" | 70 | #include "koprefsdialog.h" |
71 | #include "kpimglobalprefs.h" | 71 | #include "kpimglobalprefs.h" |
72 | 72 | ||
73 | 73 | ||
74 | KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : | 74 | KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : |
75 | KPrefsDialog(KOPrefs::instance(),parent,name,true) | 75 | KPrefsDialog(KOPrefs::instance(),parent,name,true) |
76 | { | 76 | { |
77 | 77 | ||
78 | setFont( KGlobalSettings::generalMaxFont() ); | 78 | setFont( KGlobalSettings::generalMaxFont() ); |
79 | setCaption( i18n("Preferences - some settings need a restart (nr)")); | 79 | setCaption( i18n("Preferences - some settings need a restart (nr)")); |
80 | mCategoryDict.setAutoDelete(true); | 80 | mCategoryDict.setAutoDelete(true); |
81 | 81 | ||
82 | KGlobal::locale()->insertCatalogue("timezones"); | 82 | KGlobal::locale()->insertCatalogue("timezones"); |
83 | mSpacingHint = spacingHintSmall(); | 83 | mSpacingHint = spacingHintSmall(); |
84 | mMarginHint = marginHintSmall(); | 84 | mMarginHint = marginHintSmall(); |
85 | #ifndef DESKTOP_VERSION | 85 | #ifndef DESKTOP_VERSION |
86 | if ( QApplication::desktop()->height() == 480 ) | 86 | if ( QApplication::desktop()->height() == 480 ) |
87 | hideButtons(); | 87 | hideButtons(); |
88 | #endif | 88 | #endif |
89 | 89 | ||
90 | setupGlobalTab(); | 90 | setupGlobalTab(); |
91 | setupMainTab(); | 91 | setupMainTab(); |
92 | // setupLocaleTab(); | 92 | // setupLocaleTab(); |
93 | //setupTimeZoneTab(); | 93 | //setupTimeZoneTab(); |
94 | setupTimeTab(); | 94 | setupTimeTab(); |
95 | //setupLocaleDateTab(); | 95 | //setupLocaleDateTab(); |
96 | setupFontsTab(); | 96 | setupFontsTab(); |
97 | setupColorsTab(); | 97 | setupColorsTab(); |
98 | setupViewsTab(); | 98 | setupViewsTab(); |
99 | //setupSyncTab(); | 99 | //setupSyncTab(); |
100 | //setupSyncAlgTab(); | 100 | //setupSyncAlgTab(); |
101 | //setupPrinterTab(); | 101 | //setupPrinterTab(); |
102 | //setupGroupSchedulingTab(); | 102 | //setupGroupSchedulingTab(); |
103 | //setupGroupAutomationTab(); | 103 | //setupGroupAutomationTab(); |
104 | 104 | ||
105 | 105 | ||
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | KOPrefsDialog::~KOPrefsDialog() | 109 | KOPrefsDialog::~KOPrefsDialog() |
110 | { | 110 | { |
111 | } | 111 | } |
112 | void KOPrefsDialog::setupGlobalTab() | 112 | void KOPrefsDialog::setupGlobalTab() |
113 | { | 113 | { |
114 | QFrame *topFrame = addPage(i18n("Global"),0,0); | 114 | QFrame *topFrame = addPage(i18n("Global"),0,0); |
115 | kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); | 115 | kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); |
116 | QVBoxLayout *topLayout = new QVBoxLayout(topFrame); | 116 | QVBoxLayout *topLayout = new QVBoxLayout(topFrame); |
117 | topLayout->addWidget( kdelibcfg ); | 117 | topLayout->addWidget( kdelibcfg ); |
118 | 118 | ||
119 | 119 | ||
120 | } | 120 | } |
121 | void KOPrefsDialog::setupLocaleDateTab() | 121 | void KOPrefsDialog::setupLocaleDateTab() |
122 | { | 122 | { |
123 | #if 0 | 123 | #if 0 |
124 | QFrame *topFrame = addPage(i18n("Date Format"),0,0); | 124 | QFrame *topFrame = addPage(i18n("Date Format"),0,0); |
125 | QGridLayout *topLayout = new QGridLayout(topFrame,3,2); | 125 | QGridLayout *topLayout = new QGridLayout(topFrame,3,2); |
126 | topLayout->setSpacing(mSpacingHint); | 126 | topLayout->setSpacing(mSpacingHint); |
127 | topLayout->setMargin(mMarginHint); | 127 | topLayout->setMargin(mMarginHint); |
128 | int iii = 0; | 128 | int iii = 0; |
129 | 129 | ||
130 | 130 | ||
131 | KPrefsDialogWidRadios *syncPrefsGroup = | 131 | KPrefsDialogWidRadios *syncPrefsGroup = |
132 | addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); | 132 | addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); |
133 | QString format; | 133 | QString format; |
134 | if ( QApplication::desktop()->width() < 480 ) | 134 | if ( QApplication::desktop()->width() < 480 ) |
135 | format = "(%d.%m.%Y)"; | 135 | format = "(%d.%m.%Y)"; |
136 | else | 136 | else |
137 | format = "(%d.%m.%Y|%A %d %B %Y)"; | 137 | format = "(%d.%m.%Y|%A %d %B %Y)"; |
138 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); | 138 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); |
139 | if ( QApplication::desktop()->width() < 480 ) | 139 | if ( QApplication::desktop()->width() < 480 ) |
140 | format = "(%m.%d.%Y)"; | 140 | format = "(%m.%d.%Y)"; |
141 | else | 141 | else |
142 | format = "(%m.%d.%Y|%A %B %d %Y)"; | 142 | format = "(%m.%d.%Y|%A %B %d %Y)"; |
143 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); | 143 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); |
144 | if ( QApplication::desktop()->width() < 480 ) | 144 | if ( QApplication::desktop()->width() < 480 ) |
145 | format = "(%Y-%m-%d)"; | 145 | format = "(%Y-%m-%d)"; |
146 | else | 146 | else |
147 | format = "(%Y-%m-%d|%A %Y %B %d)"; | 147 | format = "(%Y-%m-%d|%A %Y %B %d)"; |
148 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); | 148 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); |
149 | syncPrefsGroup->addRadio(i18n("User defined")); | 149 | syncPrefsGroup->addRadio(i18n("User defined")); |
150 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 150 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
151 | ++iii; | 151 | ++iii; |
152 | ++iii; | 152 | ++iii; |
153 | QLabel * lab; | 153 | QLabel * lab; |
154 | mUserDateFormatLong = new QLineEdit(topFrame); | 154 | mUserDateFormatLong = new QLineEdit(topFrame); |
155 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); | 155 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); |
156 | topLayout->addWidget(lab ,iii,0); | 156 | topLayout->addWidget(lab ,iii,0); |
157 | topLayout->addWidget(mUserDateFormatLong,iii,1); | 157 | topLayout->addWidget(mUserDateFormatLong,iii,1); |
158 | ++iii; | 158 | ++iii; |
159 | mUserDateFormatShort = new QLineEdit(topFrame); | 159 | mUserDateFormatShort = new QLineEdit(topFrame); |
160 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); | 160 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); |
161 | topLayout->addWidget(lab ,iii,0); | 161 | topLayout->addWidget(lab ,iii,0); |
162 | topLayout->addWidget(mUserDateFormatShort,iii,1); | 162 | topLayout->addWidget(mUserDateFormatShort,iii,1); |
163 | ++iii; | 163 | ++iii; |
164 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); | 164 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); |
165 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 165 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
166 | ++iii; | 166 | ++iii; |
167 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); | 167 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); |
168 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 168 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
169 | ++iii; | 169 | ++iii; |
170 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); | 170 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); |
171 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 171 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
172 | ++iii; | 172 | ++iii; |
173 | #endif | 173 | #endif |
174 | 174 | ||
175 | } | 175 | } |
176 | 176 | ||
177 | void KOPrefsDialog::setupLocaleTab() | 177 | void KOPrefsDialog::setupLocaleTab() |
178 | { | 178 | { |
179 | #if 0 | 179 | #if 0 |
180 | QFrame *topFrame = addPage(i18n("Locale"),0,0); | 180 | QFrame *topFrame = addPage(i18n("Locale"),0,0); |
181 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 181 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); |
182 | topLayout->setSpacing(mSpacingHint); | 182 | topLayout->setSpacing(mSpacingHint); |
183 | topLayout->setMargin(mMarginHint); | 183 | topLayout->setMargin(mMarginHint); |
184 | int iii = 0; | 184 | int iii = 0; |
185 | KPrefsDialogWidRadios *syncPrefsGroup = | 185 | KPrefsDialogWidRadios *syncPrefsGroup = |
186 | addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); | 186 | addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); |
187 | syncPrefsGroup->addRadio(i18n("English")); | 187 | syncPrefsGroup->addRadio(i18n("English")); |
188 | syncPrefsGroup->addRadio(i18n("German")); | 188 | syncPrefsGroup->addRadio(i18n("German")); |
189 | syncPrefsGroup->addRadio(i18n("French")); | 189 | syncPrefsGroup->addRadio(i18n("French")); |
190 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); | 190 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); |
191 | if ( QApplication::desktop()->width() < 300 ) | 191 | if ( QApplication::desktop()->width() < 300 ) |
192 | ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | 192 | ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); |
193 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 193 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
194 | ++iii; | 194 | ++iii; |
195 | 195 | ||
196 | syncPrefsGroup = | 196 | syncPrefsGroup = |
197 | addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); | 197 | addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); |
198 | if ( QApplication::desktop()->width() > 300 ) | 198 | if ( QApplication::desktop()->width() > 300 ) |
199 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | 199 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); |
200 | syncPrefsGroup->addRadio(i18n("24:00")); | 200 | syncPrefsGroup->addRadio(i18n("24:00")); |
201 | syncPrefsGroup->addRadio(i18n("12:00am")); | 201 | syncPrefsGroup->addRadio(i18n("12:00am")); |
202 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | 202 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); |
203 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 203 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
204 | ++iii; | 204 | ++iii; |
205 | KPrefsDialogWidBool *sb; | 205 | KPrefsDialogWidBool *sb; |
206 | if ( QApplication::desktop()->width() < 300 ) { | 206 | if ( QApplication::desktop()->width() < 300 ) { |
207 | sb = | 207 | sb = |
208 | addWidBool(i18n("Week starts on Sunday"), | 208 | addWidBool(i18n("Week starts on Sunday"), |
209 | &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); | 209 | &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); |
210 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 210 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
211 | ++iii; | 211 | ++iii; |
212 | sb = | 212 | sb = |
213 | addWidBool(i18n("Use short date in (WN/E) view"), | 213 | addWidBool(i18n("Use short date in (WN/E) view"), |
214 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); | 214 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); |
215 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 215 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
216 | } | 216 | } |
217 | else { | 217 | else { |
218 | QWidget * hb = new QWidget( topFrame ); | 218 | QWidget * hb = new QWidget( topFrame ); |
219 | QHBoxLayout *hbLayout = new QHBoxLayout(hb); | 219 | QHBoxLayout *hbLayout = new QHBoxLayout(hb); |
220 | sb = | 220 | sb = |
221 | addWidBool(i18n("Week starts on Sunday"), | 221 | addWidBool(i18n("Week starts on Sunday"), |
222 | &(KOPrefs::instance()->mWeekStartsOnSunday),hb); | 222 | &(KOPrefs::instance()->mWeekStartsOnSunday),hb); |
223 | hbLayout->addWidget(sb->checkBox() ); | 223 | hbLayout->addWidget(sb->checkBox() ); |
224 | sb = | 224 | sb = |
225 | addWidBool(i18n("Use short date in (WN/E) view"), | 225 | addWidBool(i18n("Use short date in (WN/E) view"), |
226 | &(KOPrefs::instance()->mShortDateInViewer),hb); | 226 | &(KOPrefs::instance()->mShortDateInViewer),hb); |
227 | hbLayout->addWidget(sb->checkBox() ); | 227 | hbLayout->addWidget(sb->checkBox() ); |
228 | topLayout->addMultiCellWidget(hb, iii,iii,0,1); | 228 | topLayout->addMultiCellWidget(hb, iii,iii,0,1); |
229 | 229 | ||
230 | } | 230 | } |
231 | // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION | 231 | // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION |
232 | #if 0 | 232 | #if 0 |
233 | ++iii; | 233 | ++iii; |
234 | sb = | 234 | sb = |
235 | addWidBool(i18n("Quick load/save (w/o Unicode)"), | 235 | addWidBool(i18n("Quick load/save (w/o Unicode)"), |
236 | &(KOPrefs::instance()->mUseQuicksave),topFrame); | 236 | &(KOPrefs::instance()->mUseQuicksave),topFrame); |
237 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 237 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
238 | #endif | 238 | #endif |
239 | #endif | 239 | #endif |
240 | } | 240 | } |
241 | void KOPrefsDialog::showSyncPage() | 241 | void KOPrefsDialog::showSyncPage() |
242 | { | 242 | { |
243 | showPage ( 0 ) ; | 243 | showPage ( 0 ) ; |
244 | kdelibcfg->showTimeZoneTab() ; | 244 | kdelibcfg->showTimeZoneTab() ; |
245 | 245 | ||
246 | } | 246 | } |
247 | void KOPrefsDialog::setupSyncAlgTab() | 247 | void KOPrefsDialog::setupSyncAlgTab() |
248 | { | 248 | { |
249 | #if 0 | 249 | #if 0 |
250 | QLabel * lab; | 250 | QLabel * lab; |
251 | QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); | 251 | QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); |
252 | mSetupSyncAlgTab = topFrame; | 252 | mSetupSyncAlgTab = topFrame; |
253 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 253 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
254 | topLayout->setSpacing(mSpacingHint); | 254 | topLayout->setSpacing(mSpacingHint); |
255 | topLayout->setMargin(mMarginHint); | 255 | topLayout->setMargin(mMarginHint); |
256 | int iii = 0; | 256 | int iii = 0; |
257 | 257 | ||
258 | KPrefsDialogWidBool *sb = | 258 | KPrefsDialogWidBool *sb = |
259 | addWidBool(i18n("Ask for preferences before syncing"), | 259 | addWidBool(i18n("Ask for preferences before syncing"), |
260 | &(KOPrefs::instance()->mAskForPreferences),topFrame); | 260 | &(KOPrefs::instance()->mAskForPreferences),topFrame); |
261 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 261 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
262 | 262 | ||
263 | ++iii; | 263 | ++iii; |
264 | 264 | ||
265 | KPrefsDialogWidRadios *syncPrefsGroup = | 265 | KPrefsDialogWidRadios *syncPrefsGroup = |
266 | addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), | 266 | addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), |
267 | topFrame); | 267 | topFrame); |
268 | syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 268 | syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
269 | syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 269 | syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
270 | syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 270 | syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
271 | syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 271 | syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
272 | syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 272 | syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
273 | syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 273 | syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
274 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 274 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
275 | ++iii; | 275 | ++iii; |
276 | sb = | 276 | sb = |
277 | addWidBool(i18n("Show summary after syncing"), | 277 | addWidBool(i18n("Show summary after syncing"), |
278 | &(KOPrefs::instance()->mShowSyncSummary),topFrame); | 278 | &(KOPrefs::instance()->mShowSyncSummary),topFrame); |
279 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 279 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
280 | 280 | ||
281 | ++iii; | 281 | ++iii; |
282 | #endif | 282 | #endif |
283 | 283 | ||
284 | 284 | ||
285 | 285 | ||
286 | } | 286 | } |
287 | 287 | ||
288 | 288 | ||
289 | void KOPrefsDialog::setupSyncTab() | 289 | void KOPrefsDialog::setupSyncTab() |
290 | { | 290 | { |
291 | #if 0 | 291 | #if 0 |
292 | QLabel * lab; | 292 | QLabel * lab; |
293 | QFrame *topFrame = addPage(i18n("Sync Network"),0,0); | 293 | QFrame *topFrame = addPage(i18n("Sync Network"),0,0); |
294 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 294 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
295 | topLayout->setSpacing(mSpacingHint); | 295 | topLayout->setSpacing(mSpacingHint); |
296 | topLayout->setMargin(mMarginHint); | 296 | topLayout->setMargin(mMarginHint); |
297 | lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); | 297 | lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); |
298 | int iii = 0; | 298 | int iii = 0; |
299 | topLayout->addMultiCellWidget(lab , iii,iii,0,1); | 299 | topLayout->addMultiCellWidget(lab , iii,iii,0,1); |
300 | ++iii; | 300 | ++iii; |
301 | 301 | ||
302 | mRemoteIPEdit = new QLineEdit(topFrame); | 302 | mRemoteIPEdit = new QLineEdit(topFrame); |
303 | lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); | 303 | lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); |
304 | topLayout->addWidget(lab ,iii,0); | 304 | topLayout->addWidget(lab ,iii,0); |
305 | topLayout->addWidget(mRemoteIPEdit,iii,1); | 305 | topLayout->addWidget(mRemoteIPEdit,iii,1); |
306 | ++iii; | 306 | ++iii; |
307 | mRemoteUser = new QLineEdit(topFrame); | 307 | mRemoteUser = new QLineEdit(topFrame); |
308 | lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); | 308 | lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); |
309 | topLayout->addWidget(lab ,iii,0); | 309 | topLayout->addWidget(lab ,iii,0); |
310 | topLayout->addWidget(mRemoteUser, iii,1); | 310 | topLayout->addWidget(mRemoteUser, iii,1); |
311 | ++iii; | 311 | ++iii; |
312 | 312 | ||
313 | mRemoteFile = new QLineEdit(topFrame); | 313 | mRemoteFile = new QLineEdit(topFrame); |
314 | lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); | 314 | lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); |
315 | topLayout->addWidget(lab ,iii,0); | 315 | topLayout->addWidget(lab ,iii,0); |
316 | topLayout->addWidget(mRemoteFile,iii,1); | 316 | topLayout->addWidget(mRemoteFile,iii,1); |
317 | ++iii; | 317 | ++iii; |
318 | 318 | ||
319 | mLocalTempFile = new QLineEdit(topFrame); | 319 | mLocalTempFile = new QLineEdit(topFrame); |
320 | lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); | 320 | lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); |
321 | topLayout->addWidget(lab ,iii,0); | 321 | topLayout->addWidget(lab ,iii,0); |
322 | topLayout->addWidget(mLocalTempFile,iii,1); | 322 | topLayout->addWidget(mLocalTempFile,iii,1); |
323 | ++iii; | 323 | ++iii; |
324 | 324 | ||
325 | KPrefsDialogWidBool *wb = | 325 | KPrefsDialogWidBool *wb = |
326 | addWidBool(i18n("Write back synced file"), | 326 | addWidBool(i18n("Write back synced file"), |
327 | &(KOPrefs::instance()->mWriteBackFile),topFrame); | 327 | &(KOPrefs::instance()->mWriteBackFile),topFrame); |
328 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); | 328 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); |
329 | ++iii; | 329 | ++iii; |
330 | wb = | 330 | wb = |
331 | addWidBool(i18n("Write back existing entries only"), | 331 | addWidBool(i18n("Write back existing entries only"), |
332 | &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); | 332 | &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); |
333 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); | 333 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); |
334 | ++iii; | 334 | ++iii; |
335 | 335 | ||
336 | #endif | 336 | #endif |
337 | } | 337 | } |
338 | 338 | ||
339 | void KOPrefsDialog::setupMainTab() | 339 | void KOPrefsDialog::setupMainTab() |
340 | { | 340 | { |
341 | QFrame *topFrame = addPage(i18n("General"),0,0); | 341 | QFrame *topFrame = addPage(i18n("General"),0,0); |
342 | // DesktopIcon("identity",KIcon::SizeMedium)); | 342 | // DesktopIcon("identity",KIcon::SizeMedium)); |
343 | 343 | ||
344 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | 344 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); |
345 | topLayout->setSpacing(mSpacingHint); | 345 | topLayout->setSpacing(mSpacingHint); |
346 | topLayout->setMargin(mMarginHint); | 346 | topLayout->setMargin(mMarginHint); |
347 | 347 | ||
348 | // KPrefsDialogWidBool *emailControlCenter = | 348 | // KPrefsDialogWidBool *emailControlCenter = |
349 | // addWidBool(i18n("&Use email settings from Control Center"), | 349 | // addWidBool(i18n("&Use email settings from Control Center"), |
350 | // &(KOPrefs::instance()->mEmailControlCenter),topFrame); | 350 | // &(KOPrefs::instance()->mEmailControlCenter),topFrame); |
351 | // topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); | 351 | // topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); |
352 | // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), | 352 | // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), |
353 | // SLOT(toggleEmailSettings(bool))); | 353 | // SLOT(toggleEmailSettings(bool))); |
354 | 354 | ||
355 | mNameEdit = new QLineEdit(topFrame); | 355 | mNameEdit = new QLineEdit(topFrame); |
356 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); | 356 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); |
357 | topLayout->addWidget(mNameLabel,0,0); | 357 | topLayout->addWidget(mNameLabel,0,0); |
358 | topLayout->addWidget(mNameEdit,0,1); | 358 | topLayout->addWidget(mNameEdit,0,1); |
359 | 359 | ||
360 | mEmailEdit = new QLineEdit(topFrame); | 360 | mEmailEdit = new QLineEdit(topFrame); |
361 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); | 361 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); |
362 | topLayout->addWidget(mEmailLabel,1,0); | 362 | topLayout->addWidget(mEmailLabel,1,0); |
363 | topLayout->addWidget(mEmailEdit,1,1); | 363 | topLayout->addWidget(mEmailEdit,1,1); |
364 | KPrefsDialogWidBool *wb; | 364 | KPrefsDialogWidBool *wb; |
365 | 365 | ||
366 | 366 | ||
367 | 367 | ||
368 | KPrefsDialogWidBool *widbool = addWidBool(i18n("Full menu bar(nr)"), | 368 | KPrefsDialogWidBool *widbool = addWidBool(i18n("Full menu bar(nr)"), |
369 | &(KOPrefs::instance()->mShowFullMenu),topFrame); | 369 | &(KOPrefs::instance()->mShowFullMenu),topFrame); |
370 | topLayout->addMultiCellWidget( widbool->checkBox(), 2,2,0,1); | 370 | topLayout->addMultiCellWidget( widbool->checkBox(), 2,2,0,1); |
371 | 371 | ||
372 | 372 | ||
373 | widbool = addWidBool(i18n("Mini icons in toolbar(nr)"), | 373 | widbool = addWidBool(i18n("Mini icons in toolbar(nr)"), |
374 | &(KOPrefs::instance()->mToolBarMiniIcons),topFrame); | 374 | &(KOPrefs::instance()->mToolBarMiniIcons),topFrame); |
375 | topLayout->addMultiCellWidget( widbool->checkBox(), 3,3,0,1); | 375 | topLayout->addMultiCellWidget( widbool->checkBox(), 3,3,0,1); |
376 | 376 | ||
377 | 377 | ||
378 | KPrefsDialogWidBool *verticalScreen = | 378 | KPrefsDialogWidBool *verticalScreen = |
379 | addWidBool(i18n("Show vertical screen (Needs restart)"), | 379 | addWidBool(i18n("Show vertical screen (Needs restart)"), |
380 | &(KOPrefs::instance()->mVerticalScreen),topFrame); | 380 | &(KOPrefs::instance()->mVerticalScreen),topFrame); |
381 | //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); | 381 | //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); |
382 | topLayout->addMultiCellWidget(verticalScreen->checkBox(),4,4,0,1); | 382 | topLayout->addMultiCellWidget(verticalScreen->checkBox(),4,4,0,1); |
383 | 383 | ||
384 | 384 | ||
385 | int iii = 5; | ||
386 | widbool = addWidBool(i18n("Block popup until mouse button release"), | ||
387 | &(KOPrefs::instance()->mBlockPopupMenu),topFrame); | ||
388 | topLayout->addMultiCellWidget( widbool->checkBox(), iii,iii,0,1); | ||
389 | ++iii; | ||
385 | QHBox *dummy = new QHBox(topFrame); | 390 | QHBox *dummy = new QHBox(topFrame); |
386 | new QLabel(i18n("Days in Next-X-Days:"),dummy); | 391 | new QLabel(i18n("Days in Next-X-Days:"),dummy); |
387 | mNextXDaysSpin = new QSpinBox(2,14,1,dummy); | 392 | mNextXDaysSpin = new QSpinBox(2,14,1,dummy); |
388 | 393 | ||
389 | topLayout->addMultiCellWidget(dummy,5,5,0,1); | 394 | topLayout->addMultiCellWidget(dummy,iii,iii,0,1); |
390 | 395 | ||
396 | ++iii; | ||
391 | 397 | ||
392 | 398 | ||
393 | // KPrefsDialogWidBool *bcc = | 399 | // KPrefsDialogWidBool *bcc = |
394 | // addWidBool(i18n("Send copy to owner when mailing events"), | 400 | // addWidBool(i18n("Send copy to owner when mailing events"), |
395 | // &(KOPrefs::instance()->mBcc),topFrame); | 401 | // &(KOPrefs::instance()->mBcc),topFrame); |
396 | // topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); | 402 | // topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); |
397 | 403 | ||
398 | 404 | ||
399 | // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); | 405 | // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); |
400 | //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); | 406 | //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); |
401 | 407 | ||
402 | // addWidBool(i18n("Enable automatic saving of calendar"), | 408 | // addWidBool(i18n("Enable automatic saving of calendar"), |
403 | // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); | 409 | // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); |
404 | 410 | ||
405 | QHBox *intervalBox = new QHBox(topFrame); | 411 | QHBox *intervalBox = new QHBox(topFrame); |
406 | // intervalBox->setSpacing(mSpacingHint); | 412 | // intervalBox->setSpacing(mSpacingHint); |
407 | topLayout->addMultiCellWidget(intervalBox,6,6,0,1); | 413 | topLayout->addMultiCellWidget(intervalBox,iii,iii,0,1); |
414 | ++iii; | ||
408 | QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); | 415 | QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); |
409 | mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); | 416 | mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); |
410 | autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); | 417 | autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); |
411 | /* | 418 | /* |
412 | QHBox * agendasize = new QHBox ( topFrame ); | 419 | QHBox * agendasize = new QHBox ( topFrame ); |
413 | 420 | ||
414 | new QLabel (i18n("AllDayAgenda Height:"), agendasize ); | 421 | new QLabel (i18n("AllDayAgenda Height:"), agendasize ); |
415 | 422 | ||
416 | 423 | ||
417 | mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); | 424 | mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); |
418 | topLayout->addMultiCellWidget(agendasize,7,7,0,1); | 425 | topLayout->addMultiCellWidget(agendasize,7,7,0,1); |
419 | */ | 426 | */ |
420 | 427 | ||
421 | 428 | ||
422 | KPrefsDialogWidBool *ask = | 429 | KPrefsDialogWidBool *ask = |
423 | addWidBool(i18n("Ask for quit when closing KO/Pi"), | 430 | addWidBool(i18n("Ask for quit when closing KO/Pi"), |
424 | &(KOPrefs::instance()->mAskForQuit),topFrame); | 431 | &(KOPrefs::instance()->mAskForQuit),topFrame); |
425 | topLayout->addMultiCellWidget(ask->checkBox(),7,7,0,1); | 432 | topLayout->addMultiCellWidget(ask->checkBox(),iii,iii,0,1); |
433 | ++iii; | ||
426 | 434 | ||
427 | 435 | ||
428 | /* | 436 | /* |
429 | KPrefsDialogWidBool *confirmCheck = | 437 | KPrefsDialogWidBool *confirmCheck = |
430 | addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), | 438 | addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), |
431 | topFrame); | 439 | topFrame); |
432 | topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); | 440 | topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); |
433 | 441 | ||
434 | 442 | ||
435 | mEnableGroupScheduling = | 443 | mEnableGroupScheduling = |
436 | addWidBool(i18n("Enable group scheduling"), | 444 | addWidBool(i18n("Enable group scheduling"), |
437 | &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); | 445 | &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); |
438 | topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); | 446 | topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); |
439 | connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), | 447 | connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), |
440 | SLOT(warningGroupScheduling())); | 448 | SLOT(warningGroupScheduling())); |
441 | 449 | ||
442 | mEnableProjectView = | 450 | mEnableProjectView = |
443 | addWidBool(i18n("Enable project view"), | 451 | addWidBool(i18n("Enable project view"), |
444 | &(KOPrefs::instance()->mEnableProjectView),topFrame); | 452 | &(KOPrefs::instance()->mEnableProjectView),topFrame); |
445 | topLayout->addWidget(mEnableProjectView->checkBox(),9,0); | 453 | topLayout->addWidget(mEnableProjectView->checkBox(),9,0); |
446 | connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), | 454 | connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), |
447 | SLOT(warningProjectView())); | 455 | SLOT(warningProjectView())); |
448 | 456 | ||
449 | // Can't be disabled anymore | 457 | // Can't be disabled anymore |
450 | mEnableGroupScheduling->checkBox()->hide(); | 458 | mEnableGroupScheduling->checkBox()->hide(); |
451 | 459 | ||
452 | // Disable setting, because this feature now becomes stable | 460 | // Disable setting, because this feature now becomes stable |
453 | mEnableProjectView->checkBox()->hide(); | 461 | mEnableProjectView->checkBox()->hide(); |
454 | 462 | ||
455 | KPrefsDialogWidRadios *defaultFormatGroup = | 463 | KPrefsDialogWidRadios *defaultFormatGroup = |
456 | addWidRadios(i18n("Default Calendar Format"), | 464 | addWidRadios(i18n("Default Calendar Format"), |
457 | &(KOPrefs::instance()->mDefaultFormat),topFrame); | 465 | &(KOPrefs::instance()->mDefaultFormat),topFrame); |
458 | defaultFormatGroup->addRadio(i18n("vCalendar")); | 466 | defaultFormatGroup->addRadio(i18n("vCalendar")); |
459 | defaultFormatGroup->addRadio(i18n("iCalendar")); | 467 | defaultFormatGroup->addRadio(i18n("iCalendar")); |
460 | 468 | ||
461 | topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); | 469 | topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); |
462 | 470 | ||
463 | // Default format unconditionally is iCalendar | 471 | // Default format unconditionally is iCalendar |
464 | defaultFormatGroup->groupBox()->hide(); | 472 | defaultFormatGroup->groupBox()->hide(); |
465 | 473 | ||
466 | KPrefsDialogWidRadios *mailClientGroup = | 474 | KPrefsDialogWidRadios *mailClientGroup = |
467 | addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), | 475 | addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), |
468 | topFrame); | 476 | topFrame); |
469 | mailClientGroup->addRadio(i18n("KMail")); | 477 | mailClientGroup->addRadio(i18n("KMail")); |
470 | mailClientGroup->addRadio(i18n("Sendmail")); | 478 | mailClientGroup->addRadio(i18n("Sendmail")); |
471 | topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); | 479 | topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); |
472 | 480 | ||
473 | KPrefsDialogWidBool *htmlsave = | 481 | KPrefsDialogWidBool *htmlsave = |
474 | addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), | 482 | addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), |
475 | topFrame); | 483 | topFrame); |
476 | topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); | 484 | topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); |
477 | 485 | ||
478 | KPrefsDialogWidRadios *destinationGroup = | 486 | KPrefsDialogWidRadios *destinationGroup = |
479 | addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), | 487 | addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), |
480 | topFrame); | 488 | topFrame); |
481 | destinationGroup->addRadio(i18n("be added to the standard resource")); | 489 | destinationGroup->addRadio(i18n("be added to the standard resource")); |
482 | destinationGroup->addRadio(i18n("be asked which resource to use")); | 490 | destinationGroup->addRadio(i18n("be asked which resource to use")); |
483 | topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); | 491 | topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); |
484 | 492 | ||
485 | topLayout->setRowStretch(14,1); | 493 | topLayout->setRowStretch(14,1); |
486 | */ | 494 | */ |
487 | } | 495 | } |
488 | 496 | ||
489 | 497 | ||
490 | void KOPrefsDialog::setupTimeTab() | 498 | void KOPrefsDialog::setupTimeTab() |
491 | { | 499 | { |
492 | QFrame *topFrame = addPage(i18n("Time"),0,0); | 500 | QFrame *topFrame = addPage(i18n("Time"),0,0); |
493 | // DesktopIcon("clock",KIcon::SizeMedium)); | 501 | // DesktopIcon("clock",KIcon::SizeMedium)); |
494 | 502 | ||
495 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 503 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); |
496 | topLayout->setSpacing(mSpacingHint); | 504 | topLayout->setSpacing(mSpacingHint); |
497 | topLayout->setMargin(mMarginHint); | 505 | topLayout->setMargin(mMarginHint); |
498 | 506 | ||
499 | QHBox *dummy = new QHBox(topFrame); | 507 | QHBox *dummy = new QHBox(topFrame); |
500 | KPrefsDialogWidTime *dayBegins = | 508 | KPrefsDialogWidTime *dayBegins = |
501 | addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), | 509 | addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), |
502 | dummy); | 510 | dummy); |
503 | //topLayout->addWidget(dayBegins->label(),2,0); | 511 | //topLayout->addWidget(dayBegins->label(),2,0); |
504 | 512 | ||
505 | //topLayout->addWidget(dayBegins->spinBox(),2,1); | 513 | //topLayout->addWidget(dayBegins->spinBox(),2,1); |
506 | topLayout->addMultiCellWidget(dummy,0,0,0,1); | 514 | topLayout->addMultiCellWidget(dummy,0,0,0,1); |
507 | 515 | ||
508 | topLayout->addWidget(new QLabel(i18n("Default appointment time:"), | 516 | topLayout->addWidget(new QLabel(i18n("Default appointment time:"), |
509 | topFrame),1,0); | 517 | topFrame),1,0); |
510 | mStartTimeSpin = new QSpinBox(0,23,1,topFrame); | 518 | mStartTimeSpin = new QSpinBox(0,23,1,topFrame); |
511 | mStartTimeSpin->setSuffix(":00"); | 519 | mStartTimeSpin->setSuffix(":00"); |
512 | topLayout->addWidget(mStartTimeSpin,1,1); | 520 | topLayout->addWidget(mStartTimeSpin,1,1); |
513 | 521 | ||
514 | topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), | 522 | topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), |
515 | topFrame),2,0); | 523 | topFrame),2,0); |
516 | mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); | 524 | mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); |
517 | mDefaultDurationSpin->setSuffix(":00"); | 525 | mDefaultDurationSpin->setSuffix(":00"); |
518 | topLayout->addWidget(mDefaultDurationSpin,2,1); | 526 | topLayout->addWidget(mDefaultDurationSpin,2,1); |
519 | 527 | ||
520 | QStringList alarmList; | 528 | QStringList alarmList; |
521 | alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") | 529 | alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") |
522 | << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; | 530 | << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; |
523 | topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), | 531 | topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), |
524 | 3,0); | 532 | 3,0); |
525 | mAlarmTimeCombo = new QComboBox(topFrame); | 533 | mAlarmTimeCombo = new QComboBox(topFrame); |
526 | mAlarmTimeCombo->insertStringList(alarmList); | 534 | mAlarmTimeCombo->insertStringList(alarmList); |
527 | topLayout->addWidget(mAlarmTimeCombo,3,1); | 535 | topLayout->addWidget(mAlarmTimeCombo,3,1); |
528 | 536 | ||
529 | 537 | ||
530 | QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, | 538 | QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, |
531 | i18n("Working Hours"), | 539 | i18n("Working Hours"), |
532 | topFrame); | 540 | topFrame); |
533 | topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); | 541 | topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); |
534 | workingHoursGroup->layout()->setSpacing( 0 ); | 542 | workingHoursGroup->layout()->setSpacing( 0 ); |
535 | workingHoursGroup->layout()->setMargin( 4 ); | 543 | workingHoursGroup->layout()->setMargin( 4 ); |
536 | QHBox *workStartBox = new QHBox(workingHoursGroup); | 544 | QHBox *workStartBox = new QHBox(workingHoursGroup); |
537 | // workStartBox->setMargin( 0 ); | 545 | // workStartBox->setMargin( 0 ); |
538 | addWidTime(i18n("Daily starting hour:"), | 546 | addWidTime(i18n("Daily starting hour:"), |
539 | &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); | 547 | &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); |
540 | 548 | ||
541 | QHBox *workEndBox = new QHBox(workingHoursGroup); | 549 | QHBox *workEndBox = new QHBox(workingHoursGroup); |
542 | //workEndBox->setMargin( 0 ); | 550 | //workEndBox->setMargin( 0 ); |
543 | addWidTime(i18n("Daily ending hour:"), | 551 | addWidTime(i18n("Daily ending hour:"), |
544 | &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); | 552 | &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); |
545 | QVBox *excludeBox = new QVBox(workingHoursGroup); | 553 | QVBox *excludeBox = new QVBox(workingHoursGroup); |
546 | //excludeBox->setMargin( 0 ); | 554 | //excludeBox->setMargin( 0 ); |
547 | addWidBool(i18n("Exclude holidays"), | 555 | addWidBool(i18n("Exclude holidays"), |
548 | &(KOPrefs::instance()->mExcludeHolidays),excludeBox); | 556 | &(KOPrefs::instance()->mExcludeHolidays),excludeBox); |
549 | 557 | ||
550 | addWidBool(i18n("Exclude Saturdays"), | 558 | addWidBool(i18n("Exclude Saturdays"), |
551 | &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); | 559 | &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); |
552 | 560 | ||
553 | // KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), | 561 | // KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), |
554 | // &(KOPrefs::instance()->mMarcusBainsShowSeconds), | 562 | // &(KOPrefs::instance()->mMarcusBainsShowSeconds), |
555 | // topFrame); | 563 | // topFrame); |
556 | // topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); | 564 | // topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); |
557 | 565 | ||
558 | // topLayout->setRowStretch(6,1); | 566 | // topLayout->setRowStretch(6,1); |
559 | } | 567 | } |
560 | 568 | ||
561 | 569 | ||
562 | void KOPrefsDialog::setupViewsTab() | 570 | void KOPrefsDialog::setupViewsTab() |
563 | { | 571 | { |
564 | 572 | ||
565 | QFrame *topFrame = addPage(i18n("Views"),0,0); | 573 | QFrame *topFrame = addPage(i18n("Views"),0,0); |
566 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 574 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
567 | 575 | ||
568 | QGridLayout *topLayout = new QGridLayout(topFrame,6,1); | 576 | QGridLayout *topLayout = new QGridLayout(topFrame,6,1); |
569 | topLayout->setSpacing(mSpacingHint); | 577 | topLayout->setSpacing(mSpacingHint); |
570 | topLayout->setMargin(mMarginHint); | 578 | topLayout->setMargin(mMarginHint); |
571 | 579 | ||
572 | // QBoxLayout *dayBeginsLayout = new QHBoxLayout; | 580 | // QBoxLayout *dayBeginsLayout = new QHBoxLayout; |
573 | // topLayout->addLayout(dayBeginsLayout,0,0); | 581 | // topLayout->addLayout(dayBeginsLayout,0,0); |
574 | 582 | ||
575 | // KPrefsDialogWidTime *dayBegins = | 583 | // KPrefsDialogWidTime *dayBegins = |
576 | // addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), | 584 | // addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), |
577 | // topFrame); | 585 | // topFrame); |
578 | // dayBeginsLayout->addWidget(dayBegins->label()); | 586 | // dayBeginsLayout->addWidget(dayBegins->label()); |
579 | // dayBeginsLayout->addStretch(1); | 587 | // dayBeginsLayout->addStretch(1); |
580 | // dayBeginsLayout->addWidget(dayBegins->spinBox()); | 588 | // dayBeginsLayout->addWidget(dayBegins->spinBox()); |
581 | 589 | ||
582 | // QBoxLayout *nextDaysLayout = new QHBoxLayout; | 590 | // QBoxLayout *nextDaysLayout = new QHBoxLayout; |
583 | // topLayout->addLayout(nextDaysLayout,1,0); | 591 | // topLayout->addLayout(nextDaysLayout,1,0); |
584 | // nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); | 592 | // nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); |
585 | // mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); | 593 | // mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); |
586 | // nextDaysLayout->addStretch(1); | 594 | // nextDaysLayout->addStretch(1); |
587 | // nextDaysLayout->addWidget(mNextXDaysSpin); | 595 | // nextDaysLayout->addWidget(mNextXDaysSpin); |
588 | 596 | ||
589 | 597 | ||
590 | int ii = 0; | 598 | int ii = 0; |
591 | KPrefsDialogWidBool *dummy = | 599 | KPrefsDialogWidBool *dummy = |
592 | addWidBool(i18n("Edit item on doubleclick (if not, show)"), | 600 | addWidBool(i18n("Edit item on doubleclick (if not, show)"), |
593 | &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); | 601 | &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); |
594 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 602 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
595 | 603 | ||
596 | 604 | ||
597 | 605 | ||
598 | 606 | ||
599 | 607 | ||
600 | 608 | ||
601 | // topLayout->addWidget(hourSizeGroup,ii++,0); | 609 | // topLayout->addWidget(hourSizeGroup,ii++,0); |
602 | // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); | 610 | // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); |
603 | //topLayout->setRowStretch(11,1); | 611 | //topLayout->setRowStretch(11,1); |
604 | 612 | ||
605 | 613 | ||
606 | 614 | ||
607 | 615 | ||
608 | #if 0 | 616 | #if 0 |
609 | 617 | ||
610 | topFrame = addPage(i18n("ViewChange"),0,0); | 618 | topFrame = addPage(i18n("ViewChange"),0,0); |
611 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 619 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
612 | 620 | ||
613 | topLayout = new QGridLayout(topFrame,6,1); | 621 | topLayout = new QGridLayout(topFrame,6,1); |
614 | topLayout->setSpacing(mSpacingHint); | 622 | topLayout->setSpacing(mSpacingHint); |
615 | topLayout->setMargin(mMarginHint); | 623 | topLayout->setMargin(mMarginHint); |
616 | ii = 0; | 624 | ii = 0; |
617 | 625 | ||
618 | #endif | 626 | #endif |
619 | 627 | ||
620 | dummy = | 628 | dummy = |
621 | addWidBool(i18n("Hold fullscreen on view change"), | 629 | addWidBool(i18n("Hold fullscreen on view change"), |
622 | &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); | 630 | &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); |
623 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 631 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
624 | 632 | ||
625 | dummy = | 633 | dummy = |
626 | addWidBool(i18n("Hold non-fullscreen on view change"), | 634 | addWidBool(i18n("Hold non-fullscreen on view change"), |
627 | &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); | 635 | &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); |
628 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 636 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
629 | 637 | ||
630 | 638 | ||
631 | 639 | ||
632 | KPrefsDialogWidBool *fullViewMonth = | 640 | KPrefsDialogWidBool *fullViewMonth = |
633 | addWidBool(i18n("Next days view uses full window"), | 641 | addWidBool(i18n("Next days view uses full window"), |
634 | &(KOPrefs::instance()->mFullViewMonth),topFrame); | 642 | &(KOPrefs::instance()->mFullViewMonth),topFrame); |
635 | topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); | 643 | topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); |
636 | 644 | ||
637 | 645 | ||
638 | KPrefsDialogWidBool *fullViewTodo = | 646 | KPrefsDialogWidBool *fullViewTodo = |
639 | addWidBool(i18n("Event list view uses full window"), | 647 | addWidBool(i18n("Event list view uses full window"), |
640 | &(KOPrefs::instance()->mFullViewTodo),topFrame); | 648 | &(KOPrefs::instance()->mFullViewTodo),topFrame); |
641 | topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); | 649 | topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); |
642 | dummy = | 650 | dummy = |
643 | addWidBool(i18n("Listview uses monthly timespan"), | 651 | addWidBool(i18n("Listview uses monthly timespan"), |
644 | &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); | 652 | &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); |
645 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 653 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
646 | dummy = | 654 | dummy = |
647 | addWidBool(i18n("Highlight selection in Time Edit"), | 655 | addWidBool(i18n("Highlight selection in Time Edit"), |
648 | &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); | 656 | &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); |
649 | topLayout->addWidget( dummy->checkBox(), ii++,0); | 657 | topLayout->addWidget( dummy->checkBox(), ii++,0); |
650 | 658 | ||
651 | KPrefsDialogWidBool *dailyRecur = | 659 | KPrefsDialogWidBool *dailyRecur = |
652 | addWidBool(i18n("Show events that recur daily in date nav."), | 660 | addWidBool(i18n("Show events that recur daily in date nav."), |
653 | &(KOPrefs::instance()->mDailyRecur),topFrame); | 661 | &(KOPrefs::instance()->mDailyRecur),topFrame); |
654 | topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | 662 | topLayout->addWidget(dailyRecur->checkBox(),ii++,0); |
655 | 663 | ||
656 | KPrefsDialogWidBool *weeklyRecur = | 664 | KPrefsDialogWidBool *weeklyRecur = |
657 | addWidBool(i18n("Show ev. that recur weekly in date nav."), | 665 | addWidBool(i18n("Show ev. that recur weekly in date nav."), |
658 | &(KOPrefs::instance()->mWeeklyRecur),topFrame); | 666 | &(KOPrefs::instance()->mWeeklyRecur),topFrame); |
659 | topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); | 667 | topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); |
660 | 668 | ||
661 | #ifdef DESKTOP_VERSION | 669 | #ifdef DESKTOP_VERSION |
662 | KPrefsDialogWidBool *enableToolTips = | 670 | KPrefsDialogWidBool *enableToolTips = |
663 | addWidBool(i18n("Enable tooltips displaying summary of ev."), | 671 | addWidBool(i18n("Enable tooltips displaying summary of ev."), |
664 | &(KOPrefs::instance()->mEnableToolTips),topFrame); | 672 | &(KOPrefs::instance()->mEnableToolTips),topFrame); |
665 | topLayout->addWidget(enableToolTips->checkBox(),ii++,0); | 673 | topLayout->addWidget(enableToolTips->checkBox(),ii++,0); |
666 | #endif | 674 | #endif |
667 | // ********************************************************* | 675 | // ********************************************************* |
668 | 676 | ||
669 | topFrame = addPage(i18n("Agenda View"),0,0); | 677 | topFrame = addPage(i18n("Agenda View"),0,0); |
670 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 678 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
671 | 679 | ||
672 | topLayout = new QGridLayout(topFrame,5,1); | 680 | topLayout = new QGridLayout(topFrame,5,1); |
673 | topLayout->setSpacing(mSpacingHint); | 681 | topLayout->setSpacing(mSpacingHint); |
674 | topLayout->setMargin(mMarginHint); | 682 | topLayout->setMargin(mMarginHint); |
675 | ii = 0; | 683 | ii = 0; |
676 | 684 | ||
677 | 685 | ||
678 | dummy = | 686 | dummy = |
679 | addWidBool(i18n("Show time in agenda items"), | 687 | addWidBool(i18n("Show time in agenda items"), |
680 | &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); | 688 | &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); |
681 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 689 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
682 | 690 | ||
683 | dummy = | 691 | dummy = |
684 | addWidBool(i18n("Highlight current day in agenda"), | 692 | addWidBool(i18n("Highlight current day in agenda"), |
685 | &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); | 693 | &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); |
686 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 694 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
687 | 695 | ||
688 | dummy = | 696 | dummy = |
689 | addWidBool(i18n("Use light color for highlight current day"), | 697 | addWidBool(i18n("Use light color for highlight current day"), |
690 | &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); | 698 | &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); |
691 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 699 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
692 | 700 | ||
693 | 701 | ||
694 | KPrefsDialogWidBool *marcusBainsEnabled = | 702 | KPrefsDialogWidBool *marcusBainsEnabled = |
695 | addWidBool(i18n("Show current time"), | 703 | addWidBool(i18n("Show current time"), |
696 | &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); | 704 | &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); |
697 | topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); | 705 | topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); |
698 | 706 | ||
699 | 707 | ||
700 | dummy = | 708 | dummy = |
701 | addWidBool(i18n("Set agenda to DayBeginsAt on change"), | 709 | addWidBool(i18n("Set agenda to DayBeginsAt on change"), |
702 | &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); | 710 | &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); |
703 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 711 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
704 | 712 | ||
705 | dummy = | 713 | dummy = |
706 | addWidBool(i18n("Set agenda to current time on change"), | 714 | addWidBool(i18n("Set agenda to current time on change"), |
707 | &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); | 715 | &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); |
708 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 716 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
709 | 717 | ||
710 | 718 | ||
711 | 719 | ||
712 | 720 | ||
713 | 721 | ||
714 | 722 | ||
715 | 723 | ||
716 | topFrame = addPage(i18n("Month View"),0,0); | 724 | topFrame = addPage(i18n("Month View"),0,0); |
717 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 725 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
718 | 726 | ||
719 | topLayout = new QGridLayout(topFrame,5,1); | 727 | topLayout = new QGridLayout(topFrame,5,1); |
720 | topLayout->setSpacing(mSpacingHint); | 728 | topLayout->setSpacing(mSpacingHint); |
721 | topLayout->setMargin(mMarginHint); | 729 | topLayout->setMargin(mMarginHint); |
722 | ii = 0; | 730 | ii = 0; |
723 | QLabel *lab; | 731 | QLabel *lab; |
724 | QHBox *habo = new QHBox( topFrame ); | 732 | QHBox *habo = new QHBox( topFrame ); |
725 | if ( QApplication::desktop()->width() <= 480 ) { | 733 | if ( QApplication::desktop()->width() <= 480 ) { |
726 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); | 734 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); |
727 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | 735 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); |
728 | ii++; | 736 | ii++; |
729 | } else { | 737 | } else { |
730 | new QLabel ( i18n("Show events that recur "), habo ); | 738 | new QLabel ( i18n("Show events that recur "), habo ); |
731 | } | 739 | } |
732 | dailyRecur = | 740 | dailyRecur = |
733 | addWidBool(i18n("daily"), | 741 | addWidBool(i18n("daily"), |
734 | &(KOPrefs::instance()->mMonthDailyRecur),habo); | 742 | &(KOPrefs::instance()->mMonthDailyRecur),habo); |
735 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | 743 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); |
736 | 744 | ||
737 | weeklyRecur = | 745 | weeklyRecur = |
738 | addWidBool(i18n("weekly"), | 746 | addWidBool(i18n("weekly"), |
739 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); | 747 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); |
740 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | 748 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); |
741 | ii++; | 749 | ii++; |
742 | 750 | ||
743 | 751 | ||
744 | habo = new QHBox( topFrame ); | 752 | habo = new QHBox( topFrame ); |
745 | if ( QApplication::desktop()->width() <= 480 ) { | 753 | if ( QApplication::desktop()->width() <= 480 ) { |
746 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); | 754 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); |
747 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | 755 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); |
748 | ii++; | 756 | ii++; |
749 | 757 | ||
750 | } else { | 758 | } else { |
751 | new QLabel ( i18n("Show in every cell "), habo ); | 759 | new QLabel ( i18n("Show in every cell "), habo ); |
752 | } | 760 | } |
753 | weeklyRecur = | 761 | weeklyRecur = |
754 | addWidBool(i18n("short month"), | 762 | addWidBool(i18n("short month"), |
755 | &(KOPrefs::instance()->mMonthShowShort),habo); | 763 | &(KOPrefs::instance()->mMonthShowShort),habo); |
756 | weeklyRecur = | 764 | weeklyRecur = |
757 | addWidBool(i18n("icons"), | 765 | addWidBool(i18n("icons"), |
758 | &(KOPrefs::instance()->mMonthShowIcons),habo); | 766 | &(KOPrefs::instance()->mMonthShowIcons),habo); |
759 | 767 | ||
760 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | 768 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); |
761 | ii++; | 769 | ii++; |
762 | #ifdef DESKTOP_VERSION | 770 | #ifdef DESKTOP_VERSION |
763 | KPrefsDialogWidBool *enableMonthScroll = | 771 | KPrefsDialogWidBool *enableMonthScroll = |
764 | addWidBool(i18n("Enable scrollbars in month view cells"), | 772 | addWidBool(i18n("Enable scrollbars in month view cells"), |
765 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); | 773 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); |
766 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); | 774 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); |
767 | #endif | 775 | #endif |
768 | dummy = | 776 | dummy = |
769 | addWidBool(i18n("Week view mode uses bigger font"), | 777 | addWidBool(i18n("Week view mode uses bigger font"), |
770 | &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); | 778 | &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); |
771 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 779 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
772 | dummy = | 780 | dummy = |
773 | addWidBool(i18n("Show Sat/Sun together"), | 781 | addWidBool(i18n("Show Sat/Sun together"), |
774 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); | 782 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); |
775 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 783 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
776 | 784 | ||
777 | KPrefsDialogWidBool *coloredCategoriesInMonthView = | 785 | KPrefsDialogWidBool *coloredCategoriesInMonthView = |
778 | addWidBool(i18n("Month view uses category colors"), | 786 | addWidBool(i18n("Month view uses category colors"), |
779 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); | 787 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); |
780 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 788 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
781 | 789 | ||
782 | dummy = | 790 | dummy = |
783 | addWidBool(i18n("Categorie colors are applied to text"), | 791 | addWidBool(i18n("Categorie colors are applied to text"), |
784 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); | 792 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); |
785 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 793 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
786 | coloredCategoriesInMonthView = | 794 | coloredCategoriesInMonthView = |
787 | addWidBool(i18n("Month view uses day colors"), | 795 | addWidBool(i18n("Month view uses day colors"), |
788 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); | 796 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); |
789 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 797 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
790 | 798 | ||
791 | KPrefsDialogWidColor *holidayColor = | 799 | KPrefsDialogWidColor *holidayColor = |
792 | addWidColor(i18n("Day color odd months"), | 800 | addWidColor(i18n("Day color odd months"), |
793 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); | 801 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); |
794 | topLayout->addWidget(holidayColor->label(),ii,0); | 802 | topLayout->addWidget(holidayColor->label(),ii,0); |
795 | topLayout->addWidget(holidayColor->button(),ii++,1); | 803 | topLayout->addWidget(holidayColor->button(),ii++,1); |
796 | 804 | ||
797 | holidayColor = | 805 | holidayColor = |
798 | addWidColor(i18n("Day color even months"), | 806 | addWidColor(i18n("Day color even months"), |
799 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); | 807 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); |
800 | topLayout->addWidget(holidayColor->label(),ii,0); | 808 | topLayout->addWidget(holidayColor->label(),ii,0); |
801 | topLayout->addWidget(holidayColor->button(),ii++,1); | 809 | topLayout->addWidget(holidayColor->button(),ii++,1); |
802 | 810 | ||
803 | 811 | ||
804 | holidayColor = | 812 | holidayColor = |
805 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), | 813 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), |
806 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); | 814 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); |
807 | topLayout->addWidget(holidayColor->label(),ii,0); | 815 | topLayout->addWidget(holidayColor->label(),ii,0); |
808 | topLayout->addWidget(holidayColor->button(),ii++,1); | 816 | topLayout->addWidget(holidayColor->button(),ii++,1); |
809 | // *********************** What'sNext View | 817 | // *********************** What'sNext View |
810 | topFrame = addPage(i18n("What's Next View"),0,0); | 818 | topFrame = addPage(i18n("What's Next View"),0,0); |
811 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 819 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
812 | 820 | ||
813 | topLayout = new QGridLayout(topFrame,4,1); | 821 | topLayout = new QGridLayout(topFrame,4,1); |
814 | topLayout->setSpacing(mSpacingHint); | 822 | topLayout->setSpacing(mSpacingHint); |
815 | topLayout->setMargin(mMarginHint); | 823 | topLayout->setMargin(mMarginHint); |
816 | ii = 0; | 824 | ii = 0; |
817 | 825 | ||
818 | 826 | ||
819 | QHBox* hdummy = new QHBox(topFrame); | 827 | QHBox* hdummy = new QHBox(topFrame); |
820 | new QLabel(i18n("Days in What's Next:"),hdummy); | 828 | new QLabel(i18n("Days in What's Next:"),hdummy); |
821 | mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); | 829 | mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); |
822 | 830 | ||
823 | topLayout->addWidget(hdummy,ii++,0); | 831 | topLayout->addWidget(hdummy,ii++,0); |
824 | 832 | ||
825 | QHBox *prioBox = new QHBox(topFrame); | 833 | QHBox *prioBox = new QHBox(topFrame); |
826 | // intervalBox->setSpacing(mSpacingHint); | 834 | // intervalBox->setSpacing(mSpacingHint); |
827 | topLayout->addWidget(prioBox,ii++,0); | 835 | topLayout->addWidget(prioBox,ii++,0); |
828 | 836 | ||
829 | QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox); | 837 | QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox); |
830 | mPrioSpin = new QSpinBox(0,5,1,prioBox); | 838 | mPrioSpin = new QSpinBox(0,5,1,prioBox); |
831 | if ( QApplication::desktop()->width() < 300 ) | 839 | if ( QApplication::desktop()->width() < 300 ) |
832 | mPrioSpin->setFixedWidth( 40 ); | 840 | mPrioSpin->setFixedWidth( 40 ); |
833 | 841 | ||
834 | KPrefsDialogWidBool *passwdk = | 842 | KPrefsDialogWidBool *passwdk = |
835 | 843 | ||
836 | addWidBool(i18n("Show events, that are done"), | 844 | addWidBool(i18n("Show events, that are done"), |
837 | &(KOPrefs::instance()->mWNViewShowsPast),topFrame); | 845 | &(KOPrefs::instance()->mWNViewShowsPast),topFrame); |
838 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 846 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
839 | passwdk = | 847 | passwdk = |
840 | addWidBool(i18n("Show parent To-Do's"), | 848 | addWidBool(i18n("Show parent To-Do's"), |
841 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); | 849 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); |
842 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 850 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
843 | 851 | ||
844 | passwdk = | 852 | passwdk = |
845 | addWidBool(i18n("Show location"), | 853 | addWidBool(i18n("Show location"), |
846 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); | 854 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); |
847 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 855 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
848 | 856 | ||
849 | passwdk = | 857 | passwdk = |
850 | addWidBool(i18n("Show Sync Events in WN+Agenda"), | 858 | addWidBool(i18n("Show Sync Events in WN+Agenda"), |
851 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); | 859 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); |
852 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 860 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
853 | passwdk = | 861 | passwdk = |
854 | addWidBool(i18n("Use short date in WN+Event view"), | 862 | addWidBool(i18n("Use short date in WN+Event view"), |
855 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); | 863 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); |
856 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 864 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
857 | 865 | ||
858 | 866 | ||
859 | 867 | ||
860 | 868 | ||
861 | // *********************** Todo View | 869 | // *********************** Todo View |
862 | 870 | ||
863 | topFrame = addPage(i18n("Todo View"),0,0); | 871 | topFrame = addPage(i18n("Todo View"),0,0); |
864 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 872 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
865 | 873 | ||
866 | topLayout = new QGridLayout(topFrame,4,1); | 874 | topLayout = new QGridLayout(topFrame,4,1); |
867 | topLayout->setSpacing(mSpacingHint); | 875 | topLayout->setSpacing(mSpacingHint); |
868 | topLayout->setMargin(mMarginHint); | 876 | topLayout->setMargin(mMarginHint); |
869 | ii = 0; | 877 | ii = 0; |
870 | dummy = | 878 | dummy = |
871 | addWidBool(i18n("Hide not running Todos in To-do view"), | 879 | addWidBool(i18n("Hide not running Todos in To-do view"), |
872 | &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); | 880 | &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); |
873 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 881 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
874 | 882 | ||
875 | 883 | ||
876 | KPrefsDialogWidBool *showCompletedTodo = | 884 | KPrefsDialogWidBool *showCompletedTodo = |
877 | addWidBool(i18n("To-do view shows completed Todos"), | 885 | addWidBool(i18n("To-do view shows completed Todos"), |
878 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); | 886 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); |
879 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); | 887 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); |
880 | dummy = | 888 | dummy = |
881 | addWidBool(i18n("To-do view shows complete as 'xx %'"), | 889 | addWidBool(i18n("To-do view shows complete as 'xx %'"), |
882 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); | 890 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); |
883 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 891 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
884 | 892 | ||
885 | dummy = | 893 | dummy = |
886 | addWidBool(i18n("Small To-do view uses smaller font"), | 894 | addWidBool(i18n("Small To-do view uses smaller font"), |
887 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); | 895 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); |
888 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 896 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
889 | 897 | ||
890 | 898 | ||
891 | 899 | ||
892 | dummy = | 900 | dummy = |
893 | addWidBool(i18n("Todo view uses category colors"), | 901 | addWidBool(i18n("Todo view uses category colors"), |
894 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); | 902 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); |
895 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 903 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
896 | 904 | ||
897 | 905 | ||
898 | QWidget* wid = new QWidget( topFrame ); | 906 | QWidget* wid = new QWidget( topFrame ); |
899 | // Todo run today color | 907 | // Todo run today color |
900 | KPrefsDialogWidColor *todoRunColor = | 908 | KPrefsDialogWidColor *todoRunColor = |
901 | addWidColor(i18n("Color for running todos:"), | 909 | addWidColor(i18n("Color for running todos:"), |
902 | &(KOPrefs::instance()->mTodoRunColor),wid); | 910 | &(KOPrefs::instance()->mTodoRunColor),wid); |
903 | QHBoxLayout *widLayout = new QHBoxLayout(wid); | 911 | QHBoxLayout *widLayout = new QHBoxLayout(wid); |
904 | widLayout->addWidget( todoRunColor->label() ); | 912 | widLayout->addWidget( todoRunColor->label() ); |
905 | widLayout->addWidget( todoRunColor->button() ); | 913 | widLayout->addWidget( todoRunColor->button() ); |
906 | topLayout->addWidget(wid,ii++,0); | 914 | topLayout->addWidget(wid,ii++,0); |
907 | 915 | ||
908 | wid = new QWidget( topFrame ); | 916 | wid = new QWidget( topFrame ); |
909 | // Todo due today color | 917 | // Todo due today color |
910 | KPrefsDialogWidColor *todoDueTodayColor = | 918 | KPrefsDialogWidColor *todoDueTodayColor = |
911 | addWidColor(i18n("Todo due today color:"), | 919 | addWidColor(i18n("Todo due today color:"), |
912 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); | 920 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); |
913 | widLayout = new QHBoxLayout(wid); | 921 | widLayout = new QHBoxLayout(wid); |
914 | widLayout->addWidget( todoDueTodayColor->label() ); | 922 | widLayout->addWidget( todoDueTodayColor->label() ); |
915 | widLayout->addWidget( todoDueTodayColor->button() ); | 923 | widLayout->addWidget( todoDueTodayColor->button() ); |
916 | topLayout->addWidget(wid,ii++,0); | 924 | topLayout->addWidget(wid,ii++,0); |
917 | //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); | 925 | //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); |
918 | 926 | ||
919 | // Todo overdue color | 927 | // Todo overdue color |
920 | wid = new QWidget( topFrame ); | 928 | wid = new QWidget( topFrame ); |
921 | widLayout = new QHBoxLayout(wid); | 929 | widLayout = new QHBoxLayout(wid); |
922 | KPrefsDialogWidColor *todoOverdueColor = | 930 | KPrefsDialogWidColor *todoOverdueColor = |
923 | addWidColor(i18n("Todo overdue color:"), | 931 | addWidColor(i18n("Todo overdue color:"), |
924 | &(KOPrefs::instance()->mTodoOverdueColor),wid); | 932 | &(KOPrefs::instance()->mTodoOverdueColor),wid); |
925 | widLayout->addWidget(todoOverdueColor->label()); | 933 | widLayout->addWidget(todoOverdueColor->label()); |
926 | widLayout->addWidget(todoOverdueColor->button()); | 934 | widLayout->addWidget(todoOverdueColor->button()); |
927 | topLayout->addWidget(wid,ii++,0); | 935 | topLayout->addWidget(wid,ii++,0); |
928 | 936 | ||
929 | dummy = | 937 | dummy = |
930 | addWidBool(i18n("Colors are applied to text"), | 938 | addWidBool(i18n("Colors are applied to text"), |
931 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); | 939 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); |
932 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 940 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
933 | 941 | ||
934 | dummy = | 942 | dummy = |
935 | addWidBool(i18n("Allday Agenda view shows todos"), | 943 | addWidBool(i18n("Allday Agenda view shows todos"), |
936 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); | 944 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); |
937 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 945 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 9b5d4ce..7817a75 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -586,884 +586,885 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
586 | KOTodoView::~KOTodoView() | 586 | KOTodoView::~KOTodoView() |
587 | { | 587 | { |
588 | // delete mKOTodoViewWhatsThis; | 588 | // delete mKOTodoViewWhatsThis; |
589 | delete mDocPrefs; | 589 | delete mDocPrefs; |
590 | } | 590 | } |
591 | QString KOTodoView::getWhatsThisText(QPoint p) | 591 | QString KOTodoView::getWhatsThisText(QPoint p) |
592 | { | 592 | { |
593 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); | 593 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); |
594 | if ( item ) | 594 | if ( item ) |
595 | return KIncidenceFormatter::instance()->getFormattedText( item->todo(), | 595 | return KIncidenceFormatter::instance()->getFormattedText( item->todo(), |
596 | KOPrefs::instance()->mWTshowDetails, | 596 | KOPrefs::instance()->mWTshowDetails, |
597 | KOPrefs::instance()->mWTshowCreated, | 597 | KOPrefs::instance()->mWTshowCreated, |
598 | KOPrefs::instance()->mWTshowChanged); | 598 | KOPrefs::instance()->mWTshowChanged); |
599 | return i18n("That is the todo view" ); | 599 | return i18n("That is the todo view" ); |
600 | 600 | ||
601 | } | 601 | } |
602 | 602 | ||
603 | void KOTodoView::jumpToDate () | 603 | void KOTodoView::jumpToDate () |
604 | { | 604 | { |
605 | // if (mActiveItem) { | 605 | // if (mActiveItem) { |
606 | // mActiveItem->todo()); | 606 | // mActiveItem->todo()); |
607 | // if ( mActiveItem->todo()->hasDueDate() ) | 607 | // if ( mActiveItem->todo()->hasDueDate() ) |
608 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); | 608 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); |
609 | } | 609 | } |
610 | void KOTodoView::paintNeeded() | 610 | void KOTodoView::paintNeeded() |
611 | { | 611 | { |
612 | if ( mPendingUpdateBeforeRepaint ) { | 612 | if ( mPendingUpdateBeforeRepaint ) { |
613 | updateView(); | 613 | updateView(); |
614 | mPendingUpdateBeforeRepaint = false; | 614 | mPendingUpdateBeforeRepaint = false; |
615 | } | 615 | } |
616 | } | 616 | } |
617 | void KOTodoView::paintEvent(QPaintEvent * pevent) | 617 | void KOTodoView::paintEvent(QPaintEvent * pevent) |
618 | { | 618 | { |
619 | if ( mPendingUpdateBeforeRepaint ) { | 619 | if ( mPendingUpdateBeforeRepaint ) { |
620 | updateView(); | 620 | updateView(); |
621 | mPendingUpdateBeforeRepaint = false; | 621 | mPendingUpdateBeforeRepaint = false; |
622 | } | 622 | } |
623 | KOrg::BaseView::paintEvent( pevent); | 623 | KOrg::BaseView::paintEvent( pevent); |
624 | } | 624 | } |
625 | 625 | ||
626 | void KOTodoView::updateView() | 626 | void KOTodoView::updateView() |
627 | { | 627 | { |
628 | pendingSubtodo = 0; | 628 | pendingSubtodo = 0; |
629 | if ( mBlockUpdate ) { | 629 | if ( mBlockUpdate ) { |
630 | return; | 630 | return; |
631 | } | 631 | } |
632 | if ( !isVisible() ) { | 632 | if ( !isVisible() ) { |
633 | mPendingUpdateBeforeRepaint = true; | 633 | mPendingUpdateBeforeRepaint = true; |
634 | return; | 634 | return; |
635 | } | 635 | } |
636 | storeCurrentItem(); | 636 | storeCurrentItem(); |
637 | //qDebug("KOTodoView::updateView() %x", this); | 637 | //qDebug("KOTodoView::updateView() %x", this); |
638 | if ( isFlatDisplay ) { | 638 | if ( isFlatDisplay ) { |
639 | displayAllFlat(); | 639 | displayAllFlat(); |
640 | resetCurrentItem(); | 640 | resetCurrentItem(); |
641 | return; | 641 | return; |
642 | } | 642 | } |
643 | //qDebug("update "); | 643 | //qDebug("update "); |
644 | // kdDebug() << "KOTodoView::updateView()" << endl; | 644 | // kdDebug() << "KOTodoView::updateView()" << endl; |
645 | QFont fo = KOPrefs::instance()->mTodoViewFont; | 645 | QFont fo = KOPrefs::instance()->mTodoViewFont; |
646 | 646 | ||
647 | 647 | ||
648 | mTodoListView->clear(); | 648 | mTodoListView->clear(); |
649 | if ( mName == "todolistsmall" ) { | 649 | if ( mName == "todolistsmall" ) { |
650 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { | 650 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { |
651 | int ps = fo.pointSize() -2; | 651 | int ps = fo.pointSize() -2; |
652 | if ( ps > 12 ) | 652 | if ( ps > 12 ) |
653 | ps -= 2; | 653 | ps -= 2; |
654 | fo.setPointSize( ps ); | 654 | fo.setPointSize( ps ); |
655 | } | 655 | } |
656 | } | 656 | } |
657 | 657 | ||
658 | mTodoListView->setFont( fo ); | 658 | mTodoListView->setFont( fo ); |
659 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); | 659 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); |
660 | //mTodoListView->header()->setMaximumHeight(fm.height()); | 660 | //mTodoListView->header()->setMaximumHeight(fm.height()); |
661 | QPtrList<Todo> todoList = calendar()->todos(); | 661 | QPtrList<Todo> todoList = calendar()->todos(); |
662 | 662 | ||
663 | /* | 663 | /* |
664 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; | 664 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; |
665 | Event *t; | 665 | Event *t; |
666 | for(t = todoList.first(); t; t = todoList.next()) { | 666 | for(t = todoList.first(); t; t = todoList.next()) { |
667 | kdDebug() << " " << t->getSummary() << endl; | 667 | kdDebug() << " " << t->getSummary() << endl; |
668 | 668 | ||
669 | if (t->getRelatedTo()) { | 669 | if (t->getRelatedTo()) { |
670 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; | 670 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; |
671 | } | 671 | } |
672 | 672 | ||
673 | QPtrList<Event> l = t->getRelations(); | 673 | QPtrList<Event> l = t->getRelations(); |
674 | Event *c; | 674 | Event *c; |
675 | for(c=l.first();c;c=l.next()) { | 675 | for(c=l.first();c;c=l.next()) { |
676 | kdDebug() << " - relation: " << c->getSummary() << endl; | 676 | kdDebug() << " - relation: " << c->getSummary() << endl; |
677 | } | 677 | } |
678 | } | 678 | } |
679 | */ | 679 | */ |
680 | 680 | ||
681 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a | 681 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a |
682 | // specific order of events. That means that we have to generate parent items | 682 | // specific order of events. That means that we have to generate parent items |
683 | // recursively for proper hierarchical display of Todos. | 683 | // recursively for proper hierarchical display of Todos. |
684 | mTodoMap.clear(); | 684 | mTodoMap.clear(); |
685 | Todo *todo; | 685 | Todo *todo; |
686 | todo = todoList.first();// todo; todo = todoList.next()) { | 686 | todo = todoList.first();// todo; todo = todoList.next()) { |
687 | while ( todo ) { | 687 | while ( todo ) { |
688 | bool next = true; | 688 | bool next = true; |
689 | // qDebug("todo %s ", todo->summary().latin1()); | 689 | // qDebug("todo %s ", todo->summary().latin1()); |
690 | Incidence *incidence = todo->relatedTo(); | 690 | Incidence *incidence = todo->relatedTo(); |
691 | while ( incidence ) { | 691 | while ( incidence ) { |
692 | if ( incidence->type() == "Todo") { | 692 | if ( incidence->type() == "Todo") { |
693 | //qDebug("related %s ",incidence->summary().latin1() ); | 693 | //qDebug("related %s ",incidence->summary().latin1() ); |
694 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { | 694 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { |
695 | //qDebug("related not found "); | 695 | //qDebug("related not found "); |
696 | todoList.remove( ); | 696 | todoList.remove( ); |
697 | todo = todoList.current(); | 697 | todo = todoList.current(); |
698 | next = false; | 698 | next = false; |
699 | incidence = 0; | 699 | incidence = 0; |
700 | 700 | ||
701 | } else { | 701 | } else { |
702 | //qDebug("related found "); | 702 | //qDebug("related found "); |
703 | incidence = incidence->relatedTo(); | 703 | incidence = incidence->relatedTo(); |
704 | } | 704 | } |
705 | } else | 705 | } else |
706 | incidence = 0; | 706 | incidence = 0; |
707 | } | 707 | } |
708 | if ( next ) | 708 | if ( next ) |
709 | todo = todoList.next(); | 709 | todo = todoList.next(); |
710 | } | 710 | } |
711 | // qDebug("again .... "); | 711 | // qDebug("again .... "); |
712 | // for(todo = todoList.first(); todo; todo = todoList.next()) { | 712 | // for(todo = todoList.first(); todo; todo = todoList.next()) { |
713 | 713 | ||
714 | // qDebug("yytodo %s ", todo->summary().latin1()); | 714 | // qDebug("yytodo %s ", todo->summary().latin1()); |
715 | // } | 715 | // } |
716 | //qDebug("for "); | 716 | //qDebug("for "); |
717 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 717 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
718 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) | 718 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) |
719 | { | 719 | { |
720 | insertTodoItem(todo); | 720 | insertTodoItem(todo); |
721 | } | 721 | } |
722 | } | 722 | } |
723 | //qDebug("for end "); | 723 | //qDebug("for end "); |
724 | // Restore opened/closed state | 724 | // Restore opened/closed state |
725 | mTodoListView->blockSignals( true ); | 725 | mTodoListView->blockSignals( true ); |
726 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); | 726 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); |
727 | mTodoListView->blockSignals( false ); | 727 | mTodoListView->blockSignals( false ); |
728 | resetCurrentItem(); | 728 | resetCurrentItem(); |
729 | processSelectionChange(); | 729 | processSelectionChange(); |
730 | } | 730 | } |
731 | 731 | ||
732 | void KOTodoView::storeCurrentItem() | 732 | void KOTodoView::storeCurrentItem() |
733 | { | 733 | { |
734 | mCurItem = 0; | 734 | mCurItem = 0; |
735 | mCurItemRootParent = 0; | 735 | mCurItemRootParent = 0; |
736 | mCurItemParent = 0; | 736 | mCurItemParent = 0; |
737 | mCurItemAbove = 0; | 737 | mCurItemAbove = 0; |
738 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 738 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
739 | if (mActiveItem) { | 739 | if (mActiveItem) { |
740 | mCurItem = mActiveItem->todo(); | 740 | mCurItem = mActiveItem->todo(); |
741 | KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); | 741 | KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); |
742 | if ( activeItemAbove ) | 742 | if ( activeItemAbove ) |
743 | mCurItemAbove = activeItemAbove->todo(); | 743 | mCurItemAbove = activeItemAbove->todo(); |
744 | mCurItemRootParent = mCurItem; | 744 | mCurItemRootParent = mCurItem; |
745 | mCurItemParent = mCurItemRootParent->relatedTo(); | 745 | mCurItemParent = mCurItemRootParent->relatedTo(); |
746 | while ( mCurItemRootParent->relatedTo() != 0 ) | 746 | while ( mCurItemRootParent->relatedTo() != 0 ) |
747 | mCurItemRootParent = mCurItemRootParent->relatedTo(); | 747 | mCurItemRootParent = mCurItemRootParent->relatedTo(); |
748 | } | 748 | } |
749 | mActiveItem = 0; | 749 | mActiveItem = 0; |
750 | } | 750 | } |
751 | 751 | ||
752 | void KOTodoView::resetCurrentItem() | 752 | void KOTodoView::resetCurrentItem() |
753 | { | 753 | { |
754 | mTodoListView->setFocus(); | 754 | mTodoListView->setFocus(); |
755 | KOTodoViewItem* foundItem = 0; | 755 | KOTodoViewItem* foundItem = 0; |
756 | KOTodoViewItem* foundItemRoot = 0; | 756 | KOTodoViewItem* foundItemRoot = 0; |
757 | KOTodoViewItem* foundItemParent = 0; | 757 | KOTodoViewItem* foundItemParent = 0; |
758 | KOTodoViewItem* foundItemAbove = 0; | 758 | KOTodoViewItem* foundItemAbove = 0; |
759 | if ( mTodoListView->firstChild () ) { | 759 | if ( mTodoListView->firstChild () ) { |
760 | if ( mCurItem ) { | 760 | if ( mCurItem ) { |
761 | KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); | 761 | KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); |
762 | while ( item ) { | 762 | while ( item ) { |
763 | if ( item->todo() == mCurItem ) { | 763 | if ( item->todo() == mCurItem ) { |
764 | foundItem = item; | 764 | foundItem = item; |
765 | break; | 765 | break; |
766 | } else if ( item->todo() == mCurItemAbove ) { | 766 | } else if ( item->todo() == mCurItemAbove ) { |
767 | foundItemAbove = item; | 767 | foundItemAbove = item; |
768 | 768 | ||
769 | } | 769 | } |
770 | if ( item->todo() == mCurItemRootParent ) { | 770 | if ( item->todo() == mCurItemRootParent ) { |
771 | foundItemRoot = item; | 771 | foundItemRoot = item; |
772 | } | 772 | } |
773 | if ( item->todo() == mCurItemParent ) { | 773 | if ( item->todo() == mCurItemParent ) { |
774 | foundItemParent = item; | 774 | foundItemParent = item; |
775 | } | 775 | } |
776 | item = (KOTodoViewItem*)item->itemBelow(); | 776 | item = (KOTodoViewItem*)item->itemBelow(); |
777 | } | 777 | } |
778 | if ( ! foundItem ) { | 778 | if ( ! foundItem ) { |
779 | if ( foundItemParent ) { | 779 | if ( foundItemParent ) { |
780 | foundItem = foundItemParent; | 780 | foundItem = foundItemParent; |
781 | } else { | 781 | } else { |
782 | if ( foundItemRoot ) | 782 | if ( foundItemRoot ) |
783 | foundItem = foundItemRoot; | 783 | foundItem = foundItemRoot; |
784 | else | 784 | else |
785 | foundItem = foundItemAbove; | 785 | foundItem = foundItemAbove; |
786 | } | 786 | } |
787 | } | 787 | } |
788 | } | 788 | } |
789 | if ( foundItem ) { | 789 | if ( foundItem ) { |
790 | mTodoListView->setCurrentItem( foundItem ); | 790 | mTodoListView->setCurrentItem( foundItem ); |
791 | mTodoListView->ensureItemVisible( foundItem ); | 791 | mTodoListView->ensureItemVisible( foundItem ); |
792 | } else { | 792 | } else { |
793 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); | 793 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); |
794 | } | 794 | } |
795 | } | 795 | } |
796 | mTodoListView->setFocus(); | 796 | mTodoListView->setFocus(); |
797 | } | 797 | } |
798 | //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; | 798 | //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; |
799 | bool KOTodoView::checkTodo( Todo * todo ) | 799 | bool KOTodoView::checkTodo( Todo * todo ) |
800 | { | 800 | { |
801 | 801 | ||
802 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) | 802 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) |
803 | return false; | 803 | return false; |
804 | if ( !todo->isCompleted() ) { | 804 | if ( !todo->isCompleted() ) { |
805 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) | 805 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) |
806 | return true; | 806 | return true; |
807 | } | 807 | } |
808 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { | 808 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { |
809 | if ( todo->hasStartDate() ) | 809 | if ( todo->hasStartDate() ) |
810 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) | 810 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) |
811 | return false; | 811 | return false; |
812 | if ( todo->hasDueDate() ) | 812 | if ( todo->hasDueDate() ) |
813 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) | 813 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) |
814 | return false; | 814 | return false; |
815 | } | 815 | } |
816 | return true; | 816 | return true; |
817 | } | 817 | } |
818 | 818 | ||
819 | void KOTodoView::restoreItemState( QListViewItem *item ) | 819 | void KOTodoView::restoreItemState( QListViewItem *item ) |
820 | { | 820 | { |
821 | pendingSubtodo = 0; | 821 | pendingSubtodo = 0; |
822 | while( item ) { | 822 | while( item ) { |
823 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 823 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
824 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); | 824 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); |
825 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); | 825 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); |
826 | item = item->nextSibling(); | 826 | item = item->nextSibling(); |
827 | } | 827 | } |
828 | } | 828 | } |
829 | 829 | ||
830 | 830 | ||
831 | QMap<Todo *,KOTodoViewItem *>::ConstIterator | 831 | QMap<Todo *,KOTodoViewItem *>::ConstIterator |
832 | KOTodoView::insertTodoItem(Todo *todo) | 832 | KOTodoView::insertTodoItem(Todo *todo) |
833 | { | 833 | { |
834 | 834 | ||
835 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; | 835 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; |
836 | // TODO: Check, if dynmaic cast is necessary | 836 | // TODO: Check, if dynmaic cast is necessary |
837 | 837 | ||
838 | pendingSubtodo = 0; | 838 | pendingSubtodo = 0; |
839 | Incidence *incidence = todo->relatedTo(); | 839 | Incidence *incidence = todo->relatedTo(); |
840 | if (incidence && incidence->type() == "Todo") { | 840 | if (incidence && incidence->type() == "Todo") { |
841 | Todo *relatedTodo = static_cast<Todo *>(incidence); | 841 | Todo *relatedTodo = static_cast<Todo *>(incidence); |
842 | 842 | ||
843 | // kdDebug() << " has Related" << endl; | 843 | // kdDebug() << " has Related" << endl; |
844 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 844 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
845 | itemIterator = mTodoMap.find(relatedTodo); | 845 | itemIterator = mTodoMap.find(relatedTodo); |
846 | if (itemIterator == mTodoMap.end()) { | 846 | if (itemIterator == mTodoMap.end()) { |
847 | // kdDebug() << " related not yet in list" << endl; | 847 | // kdDebug() << " related not yet in list" << endl; |
848 | itemIterator = insertTodoItem (relatedTodo); | 848 | itemIterator = insertTodoItem (relatedTodo); |
849 | } | 849 | } |
850 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem | 850 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem |
851 | // and one into the map. Sure finding is more easy but why? -zecke | 851 | // and one into the map. Sure finding is more easy but why? -zecke |
852 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); | 852 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); |
853 | return mTodoMap.insert(todo,todoItem); | 853 | return mTodoMap.insert(todo,todoItem); |
854 | } else { | 854 | } else { |
855 | // kdDebug() << " no Related" << endl; | 855 | // kdDebug() << " no Related" << endl; |
856 | // see above -zecke | 856 | // see above -zecke |
857 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 857 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
858 | return mTodoMap.insert(todo,todoItem); | 858 | return mTodoMap.insert(todo,todoItem); |
859 | } | 859 | } |
860 | } | 860 | } |
861 | 861 | ||
862 | 862 | ||
863 | void KOTodoView::updateConfig() | 863 | void KOTodoView::updateConfig() |
864 | { | 864 | { |
865 | updateView(); | 865 | updateView(); |
866 | mTodoListView->repaintContents(); | 866 | mTodoListView->repaintContents(); |
867 | } | 867 | } |
868 | 868 | ||
869 | QPtrList<Incidence> KOTodoView::selectedIncidences() | 869 | QPtrList<Incidence> KOTodoView::selectedIncidences() |
870 | { | 870 | { |
871 | QPtrList<Incidence> selected; | 871 | QPtrList<Incidence> selected; |
872 | 872 | ||
873 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 873 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
874 | // if (!item) item = mActiveItem; | 874 | // if (!item) item = mActiveItem; |
875 | if (item) selected.append(item->todo()); | 875 | if (item) selected.append(item->todo()); |
876 | 876 | ||
877 | return selected; | 877 | return selected; |
878 | } | 878 | } |
879 | 879 | ||
880 | QPtrList<Todo> KOTodoView::selectedTodos() | 880 | QPtrList<Todo> KOTodoView::selectedTodos() |
881 | { | 881 | { |
882 | QPtrList<Todo> selected; | 882 | QPtrList<Todo> selected; |
883 | 883 | ||
884 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 884 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
885 | // if (!item) item = mActiveItem; | 885 | // if (!item) item = mActiveItem; |
886 | if (item) selected.append(item->todo()); | 886 | if (item) selected.append(item->todo()); |
887 | 887 | ||
888 | return selected; | 888 | return selected; |
889 | } | 889 | } |
890 | 890 | ||
891 | void KOTodoView::changeEventDisplay(Event *, int) | 891 | void KOTodoView::changeEventDisplay(Event *, int) |
892 | { | 892 | { |
893 | updateView(); | 893 | updateView(); |
894 | } | 894 | } |
895 | 895 | ||
896 | void KOTodoView::showDates(const QDate &, const QDate &) | 896 | void KOTodoView::showDates(const QDate &, const QDate &) |
897 | { | 897 | { |
898 | } | 898 | } |
899 | 899 | ||
900 | void KOTodoView::showEvents(QPtrList<Event>) | 900 | void KOTodoView::showEvents(QPtrList<Event>) |
901 | { | 901 | { |
902 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; | 902 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; |
903 | } | 903 | } |
904 | 904 | ||
905 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 905 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
906 | const QDate &td) | 906 | const QDate &td) |
907 | { | 907 | { |
908 | #ifndef KORG_NOPRINTER | 908 | #ifndef KORG_NOPRINTER |
909 | calPrinter->preview(CalPrinter::Todolist, fd, td); | 909 | calPrinter->preview(CalPrinter::Todolist, fd, td); |
910 | #endif | 910 | #endif |
911 | } | 911 | } |
912 | 912 | ||
913 | void KOTodoView::editItem(QListViewItem *item ) | 913 | void KOTodoView::editItem(QListViewItem *item ) |
914 | { | 914 | { |
915 | // qDebug("editItem(QListViewItem *item ) "); | 915 | // qDebug("editItem(QListViewItem *item ) "); |
916 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); | 916 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); |
917 | } | 917 | } |
918 | 918 | ||
919 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) | 919 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) |
920 | { | 920 | { |
921 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); | 921 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); |
922 | } | 922 | } |
923 | 923 | ||
924 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) | 924 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) |
925 | { | 925 | { |
926 | pendingSubtodo = 0; | 926 | pendingSubtodo = 0; |
927 | mActiveItem = (KOTodoViewItem *)item; | 927 | mActiveItem = (KOTodoViewItem *)item; |
928 | if (item) { | 928 | if (item) { |
929 | switch (column){ | 929 | switch (column){ |
930 | case 1: | 930 | case 1: |
931 | mPriorityPopupMenu->popup(QCursor::pos ()); break; | 931 | mPriorityPopupMenu->popup(QCursor::pos ()); break; |
932 | case 2: | 932 | case 2: |
933 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; | 933 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; |
934 | case 3: | 934 | case 3: |
935 | moveTodo(); | 935 | moveTodo(); |
936 | break; | 936 | break; |
937 | case 8: | 937 | case 8: |
938 | getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; | 938 | getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; |
939 | default: | 939 | default: |
940 | mItemPopupMenu->popup(QCursor::pos()); | 940 | mItemPopupMenu->popup(QCursor::pos()); |
941 | } | 941 | } |
942 | } else mPopupMenu->popup(QCursor::pos()); | 942 | } else mPopupMenu->popup(QCursor::pos()); |
943 | } | 943 | } |
944 | void KOTodoView::newTodo() | 944 | void KOTodoView::newTodo() |
945 | { | 945 | { |
946 | emit newTodoSignal(); | 946 | emit newTodoSignal(); |
947 | } | 947 | } |
948 | 948 | ||
949 | void KOTodoView::newSubTodo() | 949 | void KOTodoView::newSubTodo() |
950 | { | 950 | { |
951 | if (mActiveItem) { | 951 | if (mActiveItem) { |
952 | emit newSubTodoSignal(mActiveItem->todo()); | 952 | emit newSubTodoSignal(mActiveItem->todo()); |
953 | } | 953 | } |
954 | } | 954 | } |
955 | void KOTodoView::unparentTodo() | 955 | void KOTodoView::unparentTodo() |
956 | { | 956 | { |
957 | if (mActiveItem) { | 957 | if (mActiveItem) { |
958 | emit unparentTodoSignal(mActiveItem->todo()); | 958 | emit unparentTodoSignal(mActiveItem->todo()); |
959 | } | 959 | } |
960 | } | 960 | } |
961 | 961 | ||
962 | void KOTodoView::reparentTodo() | 962 | void KOTodoView::reparentTodo() |
963 | { | 963 | { |
964 | if (mActiveItem) { | 964 | if (mActiveItem) { |
965 | qDebug("KOTodoView::reparentTodo() "); | 965 | qDebug("KOTodoView::reparentTodo() "); |
966 | topLevelWidget()->setCaption(i18n("Click on new parent item")); | 966 | topLevelWidget()->setCaption(i18n("Click on new parent item")); |
967 | pendingSubtodo = mActiveItem; | 967 | pendingSubtodo = mActiveItem; |
968 | } | 968 | } |
969 | } | 969 | } |
970 | void KOTodoView::editTodo() | 970 | void KOTodoView::editTodo() |
971 | { | 971 | { |
972 | if (mActiveItem) { | 972 | if (mActiveItem) { |
973 | emit editTodoSignal(mActiveItem->todo()); | 973 | emit editTodoSignal(mActiveItem->todo()); |
974 | } | 974 | } |
975 | } | 975 | } |
976 | void KOTodoView::cloneTodo() | 976 | void KOTodoView::cloneTodo() |
977 | { | 977 | { |
978 | if (mActiveItem) { | 978 | if (mActiveItem) { |
979 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); | 979 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); |
980 | } | 980 | } |
981 | } | 981 | } |
982 | void KOTodoView::cancelTodo() | 982 | void KOTodoView::cancelTodo() |
983 | { | 983 | { |
984 | if (mActiveItem) { | 984 | if (mActiveItem) { |
985 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); | 985 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); |
986 | } | 986 | } |
987 | } | 987 | } |
988 | void KOTodoView::moveTodo() | 988 | void KOTodoView::moveTodo() |
989 | { | 989 | { |
990 | if (mActiveItem) { | 990 | if (mActiveItem) { |
991 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); | 991 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); |
992 | } | 992 | } |
993 | } | 993 | } |
994 | void KOTodoView::beamTodo() | 994 | void KOTodoView::beamTodo() |
995 | { | 995 | { |
996 | if (mActiveItem) { | 996 | if (mActiveItem) { |
997 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); | 997 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); |
998 | } | 998 | } |
999 | } | 999 | } |
1000 | 1000 | ||
1001 | 1001 | ||
1002 | void KOTodoView::showTodo() | 1002 | void KOTodoView::showTodo() |
1003 | { | 1003 | { |
1004 | if (mActiveItem) { | 1004 | if (mActiveItem) { |
1005 | emit showTodoSignal(mActiveItem->todo()); | 1005 | emit showTodoSignal(mActiveItem->todo()); |
1006 | } | 1006 | } |
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | void KOTodoView::deleteTodo() | 1009 | void KOTodoView::deleteTodo() |
1010 | { | 1010 | { |
1011 | if (mActiveItem) { | 1011 | if (mActiveItem) { |
1012 | emit deleteTodoSignal(mActiveItem->todo()); | 1012 | emit deleteTodoSignal(mActiveItem->todo()); |
1013 | } | 1013 | } |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | void KOTodoView::setNewPriority(int index) | 1016 | void KOTodoView::setNewPriority(int index) |
1017 | { | 1017 | { |
1018 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1018 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1019 | mActiveItem->todo()->setPriority(mPriority[index]); | 1019 | mActiveItem->todo()->setPriority(mPriority[index]); |
1020 | mActiveItem->construct(); | 1020 | mActiveItem->construct(); |
1021 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); | 1021 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); |
1022 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1022 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1023 | } | 1023 | } |
1024 | } | 1024 | } |
1025 | 1025 | ||
1026 | void KOTodoView::setNewPercentage(int index) | 1026 | void KOTodoView::setNewPercentage(int index) |
1027 | { | 1027 | { |
1028 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1028 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1029 | 1029 | ||
1030 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { | 1030 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { |
1031 | mActiveItem->setOn( true ); | 1031 | mActiveItem->setOn( true ); |
1032 | return; | 1032 | return; |
1033 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { | 1033 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { |
1034 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); | 1034 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); |
1035 | if ( par && par->isOn() ) | 1035 | if ( par && par->isOn() ) |
1036 | par->setOn( false ); | 1036 | par->setOn( false ); |
1037 | } | 1037 | } |
1038 | if (mPercentage[index] == 100) { | 1038 | if (mPercentage[index] == 100) { |
1039 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); | 1039 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); |
1040 | } else { | 1040 | } else { |
1041 | mActiveItem->todo()->setCompleted(false); | 1041 | mActiveItem->todo()->setCompleted(false); |
1042 | } | 1042 | } |
1043 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); | 1043 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); |
1044 | mActiveItem->construct(); | 1044 | mActiveItem->construct(); |
1045 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); | 1045 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); |
1046 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1046 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1047 | } | 1047 | } |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | 1050 | ||
1051 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) | 1051 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) |
1052 | { | 1052 | { |
1053 | QPopupMenu* tempMenu = new QPopupMenu (this); | 1053 | QPopupMenu* tempMenu = new QPopupMenu (this); |
1054 | QStringList checkedCategories = todoItem->todo()->categories (); | 1054 | QStringList checkedCategories = todoItem->todo()->categories (); |
1055 | 1055 | ||
1056 | tempMenu->setCheckable (true); | 1056 | tempMenu->setCheckable (true); |
1057 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 1057 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
1058 | it != KOPrefs::instance()->mCustomCategories.end (); | 1058 | it != KOPrefs::instance()->mCustomCategories.end (); |
1059 | ++it) { | 1059 | ++it) { |
1060 | int index = tempMenu->insertItem (*it); | 1060 | int index = tempMenu->insertItem (*it); |
1061 | mCategory[index] = *it; | 1061 | mCategory[index] = *it; |
1062 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); | 1062 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); |
1063 | } | 1063 | } |
1064 | 1064 | ||
1065 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | 1065 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); |
1066 | return tempMenu; | 1066 | return tempMenu; |
1067 | 1067 | ||
1068 | 1068 | ||
1069 | } | 1069 | } |
1070 | void KOTodoView::changedCategories(int index) | 1070 | void KOTodoView::changedCategories(int index) |
1071 | { | 1071 | { |
1072 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1072 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1073 | QStringList categories = mActiveItem->todo()->categories (); | 1073 | QStringList categories = mActiveItem->todo()->categories (); |
1074 | QString colcat = categories.first(); | 1074 | QString colcat = categories.first(); |
1075 | if (categories.find (mCategory[index]) != categories.end ()) | 1075 | if (categories.find (mCategory[index]) != categories.end ()) |
1076 | categories.remove (mCategory[index]); | 1076 | categories.remove (mCategory[index]); |
1077 | else | 1077 | else |
1078 | categories.insert (categories.end(), mCategory[index]); | 1078 | categories.insert (categories.end(), mCategory[index]); |
1079 | categories.sort (); | 1079 | categories.sort (); |
1080 | if ( !colcat.isEmpty() ) { | 1080 | if ( !colcat.isEmpty() ) { |
1081 | if ( categories.find ( colcat ) != categories.end () ) { | 1081 | if ( categories.find ( colcat ) != categories.end () ) { |
1082 | categories.remove( colcat ); | 1082 | categories.remove( colcat ); |
1083 | categories.prepend( colcat ); | 1083 | categories.prepend( colcat ); |
1084 | } | 1084 | } |
1085 | } | 1085 | } |
1086 | mActiveItem->todo()->setCategories (categories); | 1086 | mActiveItem->todo()->setCategories (categories); |
1087 | mActiveItem->construct(); | 1087 | mActiveItem->construct(); |
1088 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1088 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1089 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); | 1089 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); |
1090 | } | 1090 | } |
1091 | } | 1091 | } |
1092 | void KOTodoView::itemDoubleClicked(QListViewItem *item) | 1092 | void KOTodoView::itemDoubleClicked(QListViewItem *item) |
1093 | { | 1093 | { |
1094 | if ( pendingSubtodo != 0 ) { | 1094 | if ( pendingSubtodo != 0 ) { |
1095 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1095 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1096 | } | 1096 | } |
1097 | pendingSubtodo = 0; | 1097 | pendingSubtodo = 0; |
1098 | int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); | 1098 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); |
1099 | //qDebug("ROW %d ", row); | 1099 | int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); |
1100 | qDebug("ROW %d ", row); | ||
1100 | if (!item) { | 1101 | if (!item) { |
1101 | newTodo(); | 1102 | newTodo(); |
1102 | return; | 1103 | return; |
1103 | } else { | 1104 | } else { |
1104 | if ( row == 2 ) { | 1105 | if ( row == 2 || row == 1 ) { |
1105 | mActiveItem = (KOTodoViewItem *) item; | 1106 | mActiveItem = (KOTodoViewItem *) item; |
1106 | newSubTodo(); | 1107 | newSubTodo(); |
1107 | return; | 1108 | return; |
1108 | } | 1109 | } |
1109 | if ( row == 1 ) { | 1110 | if ( row == 5 || row == 6 ) { |
1110 | mActiveItem = (KOTodoViewItem *) item; | 1111 | mActiveItem = (KOTodoViewItem *) item; |
1111 | toggleRunningItem(); | 1112 | toggleRunningItem(); |
1112 | return; | 1113 | return; |
1113 | } | 1114 | } |
1114 | } | 1115 | } |
1115 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 1116 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
1116 | editItem( item ); | 1117 | editItem( item ); |
1117 | else | 1118 | else |
1118 | showItem( item , QPoint(), 0 ); | 1119 | showItem( item , QPoint(), 0 ); |
1119 | } | 1120 | } |
1120 | void KOTodoView::toggleRunningItem() | 1121 | void KOTodoView::toggleRunningItem() |
1121 | { | 1122 | { |
1122 | // qDebug("KOTodoView::toggleRunning() "); | 1123 | // qDebug("KOTodoView::toggleRunning() "); |
1123 | if ( ! mActiveItem ) | 1124 | if ( ! mActiveItem ) |
1124 | return; | 1125 | return; |
1125 | Todo * t = mActiveItem->todo(); | 1126 | Todo * t = mActiveItem->todo(); |
1126 | if ( t->isRunning() ) { | 1127 | if ( t->isRunning() ) { |
1127 | int result = KMessageBox::warningContinueCancel(this, | 1128 | int result = KMessageBox::warningContinueCancel(this, |
1128 | i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop todo"),i18n("Cancel"), true); | 1129 | i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop todo"),i18n("Cancel"), true); |
1129 | if (result != KMessageBox::Continue) return; | 1130 | if (result != KMessageBox::Continue) return; |
1130 | t->setRunning( false ); | 1131 | t->setRunning( false ); |
1131 | mActiveItem->construct(); | 1132 | mActiveItem->construct(); |
1132 | } else { | 1133 | } else { |
1133 | int result = KMessageBox::warningContinueCancel(this, | 1134 | int result = KMessageBox::warningContinueCancel(this, |
1134 | i18n("The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is stopped"),i18n("Start todo"),i18n("Cancel"), true); | 1135 | i18n("The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is stopped"),i18n("Start todo"),i18n("Cancel"), true); |
1135 | if (result != KMessageBox::Continue) return; | 1136 | if (result != KMessageBox::Continue) return; |
1136 | t->setRunning( true ); | 1137 | t->setRunning( true ); |
1137 | mActiveItem->construct(); | 1138 | mActiveItem->construct(); |
1138 | } | 1139 | } |
1139 | } | 1140 | } |
1140 | 1141 | ||
1141 | void KOTodoView::itemClicked(QListViewItem *item) | 1142 | void KOTodoView::itemClicked(QListViewItem *item) |
1142 | { | 1143 | { |
1143 | //qDebug("KOTodoView::itemClicked %d", item); | 1144 | //qDebug("KOTodoView::itemClicked %d", item); |
1144 | if (!item) { | 1145 | if (!item) { |
1145 | if ( pendingSubtodo != 0 ) { | 1146 | if ( pendingSubtodo != 0 ) { |
1146 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1147 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1147 | } | 1148 | } |
1148 | pendingSubtodo = 0; | 1149 | pendingSubtodo = 0; |
1149 | return; | 1150 | return; |
1150 | } | 1151 | } |
1151 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1152 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1152 | if ( pendingSubtodo != 0 ) { | 1153 | if ( pendingSubtodo != 0 ) { |
1153 | bool allowReparent = true; | 1154 | bool allowReparent = true; |
1154 | QListViewItem *par = item; | 1155 | QListViewItem *par = item; |
1155 | while ( par ) { | 1156 | while ( par ) { |
1156 | if ( par == pendingSubtodo ) { | 1157 | if ( par == pendingSubtodo ) { |
1157 | allowReparent = false; | 1158 | allowReparent = false; |
1158 | break; | 1159 | break; |
1159 | } | 1160 | } |
1160 | par = par->parent(); | 1161 | par = par->parent(); |
1161 | } | 1162 | } |
1162 | if ( !allowReparent ) { | 1163 | if ( !allowReparent ) { |
1163 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); | 1164 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); |
1164 | qDebug("Recursive reparenting not possible "); | 1165 | qDebug("Recursive reparenting not possible "); |
1165 | pendingSubtodo = 0; | 1166 | pendingSubtodo = 0; |
1166 | } else { | 1167 | } else { |
1167 | Todo* newParent = todoItem->todo(); | 1168 | Todo* newParent = todoItem->todo(); |
1168 | Todo* newSub = pendingSubtodo->todo(); | 1169 | Todo* newSub = pendingSubtodo->todo(); |
1169 | pendingSubtodo = 0; | 1170 | pendingSubtodo = 0; |
1170 | emit reparentTodoSignal( newParent,newSub ); | 1171 | emit reparentTodoSignal( newParent,newSub ); |
1171 | return; | 1172 | return; |
1172 | } | 1173 | } |
1173 | } | 1174 | } |
1174 | #if 0 | 1175 | #if 0 |
1175 | // handled by the item itself | 1176 | // handled by the item itself |
1176 | bool completed = todoItem->todo()->isCompleted(); // Completed or not? | 1177 | bool completed = todoItem->todo()->isCompleted(); // Completed or not? |
1177 | qDebug("com %d ",completed ); | 1178 | qDebug("com %d ",completed ); |
1178 | qDebug("itemclicked "); | 1179 | qDebug("itemclicked "); |
1179 | if (todoItem->isOn()) { | 1180 | if (todoItem->isOn()) { |
1180 | qDebug("on "); | 1181 | qDebug("on "); |
1181 | if (!completed) { | 1182 | if (!completed) { |
1182 | qDebug("set true "); | 1183 | qDebug("set true "); |
1183 | todoItem->todo()->setCompleted(QDateTime::currentDateTime()); | 1184 | todoItem->todo()->setCompleted(QDateTime::currentDateTime()); |
1184 | } | 1185 | } |
1185 | } else { | 1186 | } else { |
1186 | qDebug("not on "); | 1187 | qDebug("not on "); |
1187 | if (completed) { | 1188 | if (completed) { |
1188 | qDebug("set false "); | 1189 | qDebug("set false "); |
1189 | todoItem->todo()->setCompleted(false); | 1190 | todoItem->todo()->setCompleted(false); |
1190 | } | 1191 | } |
1191 | } | 1192 | } |
1192 | #endif | 1193 | #endif |
1193 | } | 1194 | } |
1194 | 1195 | ||
1195 | void KOTodoView::setDocumentId( const QString &id ) | 1196 | void KOTodoView::setDocumentId( const QString &id ) |
1196 | { | 1197 | { |
1197 | kdDebug() << "KOTodoView::setDocumentId()" << endl; | 1198 | kdDebug() << "KOTodoView::setDocumentId()" << endl; |
1198 | 1199 | ||
1199 | mDocPrefs->setDoc( id ); | 1200 | mDocPrefs->setDoc( id ); |
1200 | } | 1201 | } |
1201 | 1202 | ||
1202 | void KOTodoView::itemStateChanged( QListViewItem *item ) | 1203 | void KOTodoView::itemStateChanged( QListViewItem *item ) |
1203 | { | 1204 | { |
1204 | if (!item) return; | 1205 | if (!item) return; |
1205 | 1206 | ||
1206 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1207 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1207 | 1208 | ||
1208 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; | 1209 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; |
1209 | 1210 | ||
1210 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); | 1211 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); |
1211 | } | 1212 | } |
1212 | 1213 | ||
1213 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const | 1214 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const |
1214 | { | 1215 | { |
1215 | mTodoListView->saveLayout(config,group); | 1216 | mTodoListView->saveLayout(config,group); |
1216 | } | 1217 | } |
1217 | 1218 | ||
1218 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) | 1219 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) |
1219 | { | 1220 | { |
1220 | mTodoListView->restoreLayout(config,group); | 1221 | mTodoListView->restoreLayout(config,group); |
1221 | } | 1222 | } |
1222 | 1223 | ||
1223 | void KOTodoView::processSelectionChange() | 1224 | void KOTodoView::processSelectionChange() |
1224 | { | 1225 | { |
1225 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; | 1226 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; |
1226 | 1227 | ||
1227 | KOTodoViewItem *item = | 1228 | KOTodoViewItem *item = |
1228 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); | 1229 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); |
1229 | 1230 | ||
1230 | if ( !item ) { | 1231 | if ( !item ) { |
1231 | emit incidenceSelected( 0 ); | 1232 | emit incidenceSelected( 0 ); |
1232 | } else { | 1233 | } else { |
1233 | emit incidenceSelected( item->todo() ); | 1234 | emit incidenceSelected( item->todo() ); |
1234 | } | 1235 | } |
1235 | } | 1236 | } |
1236 | 1237 | ||
1237 | void KOTodoView::modified(bool b) | 1238 | void KOTodoView::modified(bool b) |
1238 | { | 1239 | { |
1239 | emit isModified(b); | 1240 | emit isModified(b); |
1240 | } | 1241 | } |
1241 | void KOTodoView::setTodoModified( Todo* todo ) | 1242 | void KOTodoView::setTodoModified( Todo* todo ) |
1242 | { | 1243 | { |
1243 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); | 1244 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); |
1244 | } | 1245 | } |
1245 | void KOTodoView::clearSelection() | 1246 | void KOTodoView::clearSelection() |
1246 | { | 1247 | { |
1247 | mTodoListView->selectAll( false ); | 1248 | mTodoListView->selectAll( false ); |
1248 | } | 1249 | } |
1249 | void KOTodoView::setAllOpen() | 1250 | void KOTodoView::setAllOpen() |
1250 | { | 1251 | { |
1251 | if ( isFlatDisplay ) { | 1252 | if ( isFlatDisplay ) { |
1252 | isFlatDisplay = false; | 1253 | isFlatDisplay = false; |
1253 | mPopupMenu->setItemChecked( 8,false ); | 1254 | mPopupMenu->setItemChecked( 8,false ); |
1254 | updateView(); | 1255 | updateView(); |
1255 | } else { | 1256 | } else { |
1256 | storeCurrentItem(); | 1257 | storeCurrentItem(); |
1257 | } | 1258 | } |
1258 | setOpen(mTodoListView->firstChild(), true); | 1259 | setOpen(mTodoListView->firstChild(), true); |
1259 | resetCurrentItem(); | 1260 | resetCurrentItem(); |
1260 | } | 1261 | } |
1261 | void KOTodoView::setAllClose() | 1262 | void KOTodoView::setAllClose() |
1262 | { | 1263 | { |
1263 | if ( isFlatDisplay ) { | 1264 | if ( isFlatDisplay ) { |
1264 | isFlatDisplay = false; | 1265 | isFlatDisplay = false; |
1265 | mPopupMenu->setItemChecked( 8,false ); | 1266 | mPopupMenu->setItemChecked( 8,false ); |
1266 | updateView(); | 1267 | updateView(); |
1267 | } else { | 1268 | } else { |
1268 | storeCurrentItem(); | 1269 | storeCurrentItem(); |
1269 | } | 1270 | } |
1270 | setOpen(mTodoListView->firstChild(), false); | 1271 | setOpen(mTodoListView->firstChild(), false); |
1271 | resetCurrentItem(); | 1272 | resetCurrentItem(); |
1272 | } | 1273 | } |
1273 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) | 1274 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) |
1274 | { | 1275 | { |
1275 | 1276 | ||
1276 | while ( item ) { | 1277 | while ( item ) { |
1277 | setOpen( item->firstChild(), setOpenI ); | 1278 | setOpen( item->firstChild(), setOpenI ); |
1278 | item->setOpen( setOpenI ); | 1279 | item->setOpen( setOpenI ); |
1279 | item = item->nextSibling(); | 1280 | item = item->nextSibling(); |
1280 | } | 1281 | } |
1281 | } | 1282 | } |
1282 | 1283 | ||
1283 | void KOTodoView::displayAllFlat() | 1284 | void KOTodoView::displayAllFlat() |
1284 | { | 1285 | { |
1285 | pendingSubtodo = 0; | 1286 | pendingSubtodo = 0; |
1286 | if ( mBlockUpdate ) { | 1287 | if ( mBlockUpdate ) { |
1287 | return; | 1288 | return; |
1288 | } | 1289 | } |
1289 | mPopupMenu->setItemChecked( 8,true ); | 1290 | mPopupMenu->setItemChecked( 8,true ); |
1290 | isFlatDisplay = true; | 1291 | isFlatDisplay = true; |
1291 | QPtrList<Todo> todoList = calendar()->todos(); | 1292 | QPtrList<Todo> todoList = calendar()->todos(); |
1292 | mTodoMap.clear(); | 1293 | mTodoMap.clear(); |
1293 | mTodoListView->clear(); | 1294 | mTodoListView->clear(); |
1294 | Todo *todo; | 1295 | Todo *todo; |
1295 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 1296 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
1296 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 1297 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
1297 | mTodoMap.insert(todo,todoItem); | 1298 | mTodoMap.insert(todo,todoItem); |
1298 | } | 1299 | } |
1299 | mTodoListView->setFocus(); | 1300 | mTodoListView->setFocus(); |
1300 | processSelectionChange(); | 1301 | processSelectionChange(); |
1301 | } | 1302 | } |
1302 | 1303 | ||
1303 | void KOTodoView::setAllFlat() | 1304 | void KOTodoView::setAllFlat() |
1304 | { | 1305 | { |
1305 | if ( isFlatDisplay ) { | 1306 | if ( isFlatDisplay ) { |
1306 | isFlatDisplay = false; | 1307 | isFlatDisplay = false; |
1307 | mPopupMenu->setItemChecked( 8,false ); | 1308 | mPopupMenu->setItemChecked( 8,false ); |
1308 | updateView(); | 1309 | updateView(); |
1309 | return; | 1310 | return; |
1310 | } | 1311 | } |
1311 | storeCurrentItem(); | 1312 | storeCurrentItem(); |
1312 | displayAllFlat(); | 1313 | displayAllFlat(); |
1313 | resetCurrentItem(); | 1314 | resetCurrentItem(); |
1314 | } | 1315 | } |
1315 | 1316 | ||
1316 | void KOTodoView::purgeCompleted() | 1317 | void KOTodoView::purgeCompleted() |
1317 | { | 1318 | { |
1318 | emit purgeCompletedSignal(); | 1319 | emit purgeCompletedSignal(); |
1319 | 1320 | ||
1320 | } | 1321 | } |
1321 | void KOTodoView::toggleQuickTodo() | 1322 | void KOTodoView::toggleQuickTodo() |
1322 | { | 1323 | { |
1323 | if ( mQuickAdd->isVisible() ) { | 1324 | if ( mQuickAdd->isVisible() ) { |
1324 | mQuickAdd->hide(); | 1325 | mQuickAdd->hide(); |
1325 | KOPrefs::instance()->mEnableQuickTodo = false; | 1326 | KOPrefs::instance()->mEnableQuickTodo = false; |
1326 | } | 1327 | } |
1327 | else { | 1328 | else { |
1328 | mQuickAdd->show(); | 1329 | mQuickAdd->show(); |
1329 | KOPrefs::instance()->mEnableQuickTodo = true; | 1330 | KOPrefs::instance()->mEnableQuickTodo = true; |
1330 | } | 1331 | } |
1331 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 1332 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
1332 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 1333 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
1333 | } | 1334 | } |
1334 | 1335 | ||
1335 | void KOTodoView::toggleRunning() | 1336 | void KOTodoView::toggleRunning() |
1336 | { | 1337 | { |
1337 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; | 1338 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; |
1338 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 1339 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
1339 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 1340 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
1340 | updateView(); | 1341 | updateView(); |
1341 | } | 1342 | } |
1342 | 1343 | ||
1343 | void KOTodoView::toggleCompleted() | 1344 | void KOTodoView::toggleCompleted() |
1344 | { | 1345 | { |
1345 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; | 1346 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; |
1346 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 1347 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
1347 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 1348 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
1348 | updateView(); | 1349 | updateView(); |
1349 | } | 1350 | } |
1350 | 1351 | ||
1351 | void KOTodoView::addQuickTodo() | 1352 | void KOTodoView::addQuickTodo() |
1352 | { | 1353 | { |
1353 | Todo *todo = new Todo(); | 1354 | Todo *todo = new Todo(); |
1354 | todo->setSummary(mQuickAdd->text()); | 1355 | todo->setSummary(mQuickAdd->text()); |
1355 | todo->setOrganizer(KOPrefs::instance()->email()); | 1356 | todo->setOrganizer(KOPrefs::instance()->email()); |
1356 | CalFilter * cf = mCalendar->filter(); | 1357 | CalFilter * cf = mCalendar->filter(); |
1357 | if ( cf ) { | 1358 | if ( cf ) { |
1358 | if ( cf->isEnabled()&& cf->showCategories()) { | 1359 | if ( cf->isEnabled()&& cf->showCategories()) { |
1359 | todo->setCategories(cf->categoryList()); | 1360 | todo->setCategories(cf->categoryList()); |
1360 | } | 1361 | } |
1361 | if ( cf->isEnabled() ) | 1362 | if ( cf->isEnabled() ) |
1362 | todo->setSecrecy( cf->getSecrecy()); | 1363 | todo->setSecrecy( cf->getSecrecy()); |
1363 | } | 1364 | } |
1364 | mCalendar->addTodo(todo); | 1365 | mCalendar->addTodo(todo); |
1365 | mQuickAdd->setText(""); | 1366 | mQuickAdd->setText(""); |
1366 | todoModified (todo, KOGlobals::EVENTADDED ); | 1367 | todoModified (todo, KOGlobals::EVENTADDED ); |
1367 | updateView(); | 1368 | updateView(); |
1368 | } | 1369 | } |
1369 | 1370 | ||
1370 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) | 1371 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) |
1371 | { | 1372 | { |
1372 | // e->ignore(); | 1373 | // e->ignore(); |
1373 | //return; | 1374 | //return; |
1374 | //qDebug("KOTodoView::keyPressEvent "); | 1375 | //qDebug("KOTodoView::keyPressEvent "); |
1375 | switch ( e->key() ) { | 1376 | switch ( e->key() ) { |
1376 | case Qt::Key_Down: | 1377 | case Qt::Key_Down: |
1377 | case Qt::Key_Up: | 1378 | case Qt::Key_Up: |
1378 | QWidget::keyPressEvent ( e ); | 1379 | QWidget::keyPressEvent ( e ); |
1379 | break; | 1380 | break; |
1380 | 1381 | ||
1381 | case Qt::Key_Q: | 1382 | case Qt::Key_Q: |
1382 | toggleQuickTodo(); | 1383 | toggleQuickTodo(); |
1383 | break; | 1384 | break; |
1384 | case Qt::Key_U: | 1385 | case Qt::Key_U: |
1385 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1386 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1386 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1387 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1387 | unparentTodo(); | 1388 | unparentTodo(); |
1388 | e->accept(); | 1389 | e->accept(); |
1389 | } else | 1390 | } else |
1390 | e->ignore(); | 1391 | e->ignore(); |
1391 | break; | 1392 | break; |
1392 | case Qt::Key_S: | 1393 | case Qt::Key_S: |
1393 | if ( e->state() == Qt::ControlButton ) { | 1394 | if ( e->state() == Qt::ControlButton ) { |
1394 | e->ignore(); | 1395 | e->ignore(); |
1395 | break; | 1396 | break; |
1396 | } | 1397 | } |
1397 | if ( e->state() == Qt::ShiftButton ) { | 1398 | if ( e->state() == Qt::ShiftButton ) { |
1398 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1399 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1399 | reparentTodo(); | 1400 | reparentTodo(); |
1400 | e->accept(); | 1401 | e->accept(); |
1401 | } else | 1402 | } else |
1402 | e->ignore(); | 1403 | e->ignore(); |
1403 | break; | 1404 | break; |
1404 | case Qt::Key_P: | 1405 | case Qt::Key_P: |
1405 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1406 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1406 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1407 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1407 | if ( pendingSubtodo ) | 1408 | if ( pendingSubtodo ) |
1408 | itemClicked(mActiveItem); | 1409 | itemClicked(mActiveItem); |
1409 | e->accept(); | 1410 | e->accept(); |
1410 | } else | 1411 | } else |
1411 | e->ignore(); | 1412 | e->ignore(); |
1412 | break; | 1413 | break; |
1413 | case Qt::Key_Escape: | 1414 | case Qt::Key_Escape: |
1414 | if ( pendingSubtodo ) { | 1415 | if ( pendingSubtodo ) { |
1415 | itemClicked(0); | 1416 | itemClicked(0); |
1416 | e->accept(); | 1417 | e->accept(); |
1417 | } else | 1418 | } else |
1418 | e->ignore(); | 1419 | e->ignore(); |
1419 | break; | 1420 | break; |
1420 | default: | 1421 | default: |
1421 | e->ignore(); | 1422 | e->ignore(); |
1422 | } | 1423 | } |
1423 | 1424 | ||
1424 | if ( true ) { | 1425 | if ( true ) { |
1425 | if ( e->key() == Qt::Key_I ) { | 1426 | if ( e->key() == Qt::Key_I ) { |
1426 | KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); | 1427 | KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); |
1427 | if ( cn ) { | 1428 | if ( cn ) { |
1428 | mActiveItem = cn; | 1429 | mActiveItem = cn; |
1429 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 1430 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
1430 | if ( ci ){ | 1431 | if ( ci ){ |
1431 | showTodo(); | 1432 | showTodo(); |
1432 | cn = (KOTodoViewItem*)cn->itemBelow(); | 1433 | cn = (KOTodoViewItem*)cn->itemBelow(); |
1433 | if ( cn ) { | 1434 | if ( cn ) { |
1434 | mTodoListView->setCurrentItem ( cn ); | 1435 | mTodoListView->setCurrentItem ( cn ); |
1435 | mTodoListView->ensureItemVisible ( cn ); | 1436 | mTodoListView->ensureItemVisible ( cn ); |
1436 | } | 1437 | } |
1437 | 1438 | ||
1438 | } | 1439 | } |
1439 | } | 1440 | } |
1440 | e->accept(); | 1441 | e->accept(); |
1441 | 1442 | ||
1442 | } | 1443 | } |
1443 | 1444 | ||
1444 | } | 1445 | } |
1445 | 1446 | ||
1446 | } | 1447 | } |
1447 | void KOTodoView::updateTodo( Todo * t, int type ) | 1448 | void KOTodoView::updateTodo( Todo * t, int type ) |
1448 | { | 1449 | { |
1449 | if ( mBlockUpdate) | 1450 | if ( mBlockUpdate) |
1450 | return; | 1451 | return; |
1451 | 1452 | ||
1452 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 1453 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
1453 | itemIterator = mTodoMap.find(t); | 1454 | itemIterator = mTodoMap.find(t); |
1454 | if (itemIterator != mTodoMap.end()) { | 1455 | if (itemIterator != mTodoMap.end()) { |
1455 | (*itemIterator)->construct(); | 1456 | (*itemIterator)->construct(); |
1456 | } else { | 1457 | } else { |
1457 | if ( type == KOGlobals::EVENTADDED ) { | 1458 | if ( type == KOGlobals::EVENTADDED ) { |
1458 | insertTodoItem( t ); | 1459 | insertTodoItem( t ); |
1459 | } | 1460 | } |
1460 | } | 1461 | } |
1461 | 1462 | ||
1462 | } | 1463 | } |
1463 | 1464 | ||
1464 | void KOTodoView::todoModified(Todo * t , int p ) | 1465 | void KOTodoView::todoModified(Todo * t , int p ) |
1465 | { | 1466 | { |
1466 | mBlockUpdate = true; | 1467 | mBlockUpdate = true; |
1467 | emit todoModifiedSignal ( t, p ); | 1468 | emit todoModifiedSignal ( t, p ); |
1468 | mBlockUpdate = false; | 1469 | mBlockUpdate = false; |
1469 | } | 1470 | } |