-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,1426 +1,1427 @@ | |||
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; |
915 | mStartCellY = gy; | 916 | mStartCellY = gy; |
916 | mCurrentCellX = gx; | 917 | mCurrentCellX = gx; |
917 | mCurrentCellY = gy; | 918 | mCurrentCellY = gy; |
918 | 919 | ||
919 | if (mAllDayMode) { | 920 | if (mAllDayMode) { |
920 | int gridDistanceX = (x - gx * mGridSpacingX); | 921 | int gridDistanceX = (x - gx * mGridSpacingX); |
921 | if (gridDistanceX < mResizeBorderWidth && | 922 | if (gridDistanceX < mResizeBorderWidth && |
922 | mActionItem->cellX() == mCurrentCellX) { | 923 | mActionItem->cellX() == mCurrentCellX) { |
923 | mActionType = RESIZELEFT; | 924 | mActionType = RESIZELEFT; |
924 | setCursor(sizeHorCursor); | 925 | setCursor(sizeHorCursor); |
925 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && | 926 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && |
926 | mActionItem->cellXWidth() == mCurrentCellX) { | 927 | mActionItem->cellXWidth() == mCurrentCellX) { |
927 | mActionType = RESIZERIGHT; | 928 | mActionType = RESIZERIGHT; |
928 | setCursor(sizeHorCursor); | 929 | setCursor(sizeHorCursor); |
929 | } else { | 930 | } else { |
930 | mActionType = MOVE; | 931 | mActionType = MOVE; |
931 | mActionItem->startMove(); | 932 | mActionItem->startMove(); |
932 | setCursor(sizeAllCursor); | 933 | setCursor(sizeAllCursor); |
933 | } | 934 | } |
934 | } else { | 935 | } else { |
935 | int gridDistanceY = (y - gy * mGridSpacingY); | 936 | int gridDistanceY = (y - gy * mGridSpacingY); |
936 | bool allowResize = ( mActionItem->incidence()->type() != "Todo" ); | 937 | bool allowResize = ( mActionItem->incidence()->type() != "Todo" ); |
937 | if (allowResize && gridDistanceY < mResizeBorderWidth && | 938 | if (allowResize && gridDistanceY < mResizeBorderWidth && |
938 | mActionItem->cellYTop() == mCurrentCellY && | 939 | mActionItem->cellYTop() == mCurrentCellY && |
939 | !mActionItem->firstMultiItem()) { | 940 | !mActionItem->firstMultiItem()) { |
940 | mActionType = RESIZETOP; | 941 | mActionType = RESIZETOP; |
941 | setCursor(sizeVerCursor); | 942 | setCursor(sizeVerCursor); |
942 | } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth && | 943 | } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth && |
943 | mActionItem->cellYBottom() == mCurrentCellY && | 944 | mActionItem->cellYBottom() == mCurrentCellY && |
944 | !mActionItem->lastMultiItem()) { | 945 | !mActionItem->lastMultiItem()) { |
945 | mActionType = RESIZEBOTTOM; | 946 | mActionType = RESIZEBOTTOM; |
946 | setCursor(sizeVerCursor); | 947 | setCursor(sizeVerCursor); |
947 | } else { | 948 | } else { |
948 | mActionType = MOVE; | 949 | mActionType = MOVE; |
949 | mActionItem->startMove(); | 950 | mActionItem->startMove(); |
950 | setCursor(sizeAllCursor); | 951 | setCursor(sizeAllCursor); |
951 | } | 952 | } |
952 | } | 953 | } |
953 | } | 954 | } |
954 | 955 | ||
955 | void KOAgenda::performItemAction(QPoint viewportPos) | 956 | void KOAgenda::performItemAction(QPoint viewportPos) |
956 | { | 957 | { |
957 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; | 958 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; |
958 | // QPoint point = viewport()->mapToGlobal(viewportPos); | 959 | // QPoint point = viewport()->mapToGlobal(viewportPos); |
959 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; | 960 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; |
960 | // point = clipper()->mapFromGlobal(point); | 961 | // point = clipper()->mapFromGlobal(point); |
961 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; | 962 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; |
962 | // kdDebug() << "visible height: " << visibleHeight() << endl; | 963 | // kdDebug() << "visible height: " << visibleHeight() << endl; |
963 | int x,y; | 964 | int x,y; |
964 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 965 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
965 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; | 966 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; |
966 | int gx,gy; | 967 | int gx,gy; |
967 | contentsToGrid(x,y,gx,gy); | 968 | contentsToGrid(x,y,gx,gy); |
968 | QPoint clipperPos = clipper()-> | 969 | QPoint clipperPos = clipper()-> |
969 | mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | 970 | mapFromGlobal(viewport()->mapToGlobal(viewportPos)); |
970 | 971 | ||
971 | // Cursor left active agenda area. | 972 | // Cursor left active agenda area. |
972 | // This starts a drag. | 973 | // This starts a drag. |
973 | if ( /*clipperPos.y() < 0 || clipperPos.y() > visibleHeight() ||*/ | 974 | if ( /*clipperPos.y() < 0 || clipperPos.y() > visibleHeight() ||*/ |
974 | clipperPos.x() < 0 || clipperPos.x() > visibleWidth() ) { | 975 | clipperPos.x() < 0 || clipperPos.x() > visibleWidth() ) { |
975 | if ( mActionType == MOVE ) { | 976 | if ( mActionType == MOVE ) { |
976 | mScrollUpTimer.stop(); | 977 | mScrollUpTimer.stop(); |
977 | mScrollDownTimer.stop(); | 978 | mScrollDownTimer.stop(); |
978 | mActionItem->resetMove(); | 979 | mActionItem->resetMove(); |
979 | placeSubCells( mActionItem ); | 980 | placeSubCells( mActionItem ); |
980 | // emit startDragSignal( mActionItem->incidence() ); | 981 | // emit startDragSignal( mActionItem->incidence() ); |
981 | setCursor( arrowCursor ); | 982 | setCursor( arrowCursor ); |
982 | mActionItem = 0; | 983 | mActionItem = 0; |
983 | mActionType = NOP; | 984 | mActionType = NOP; |
984 | mItemMoved = 0; | 985 | mItemMoved = 0; |
985 | return; | 986 | return; |
986 | } | 987 | } |
987 | } else { | 988 | } else { |
988 | switch ( mActionType ) { | 989 | switch ( mActionType ) { |
989 | case MOVE: | 990 | case MOVE: |
990 | setCursor( sizeAllCursor ); | 991 | setCursor( sizeAllCursor ); |
991 | break; | 992 | break; |
992 | case RESIZETOP: | 993 | case RESIZETOP: |
993 | case RESIZEBOTTOM: | 994 | case RESIZEBOTTOM: |
994 | setCursor( sizeVerCursor ); | 995 | setCursor( sizeVerCursor ); |
995 | break; | 996 | break; |
996 | case RESIZELEFT: | 997 | case RESIZELEFT: |
997 | case RESIZERIGHT: | 998 | case RESIZERIGHT: |
998 | setCursor( sizeHorCursor ); | 999 | setCursor( sizeHorCursor ); |
999 | break; | 1000 | break; |
1000 | default: | 1001 | default: |
1001 | setCursor( arrowCursor ); | 1002 | setCursor( arrowCursor ); |
1002 | } | 1003 | } |
1003 | } | 1004 | } |
1004 | 1005 | ||
1005 | // Scroll if item was moved to upper or lower end of agenda. | 1006 | // Scroll if item was moved to upper or lower end of agenda. |
1006 | if (clipperPos.y() < mScrollBorderWidth) { | 1007 | if (clipperPos.y() < mScrollBorderWidth) { |
1007 | mScrollUpTimer.start(mScrollDelay); | 1008 | mScrollUpTimer.start(mScrollDelay); |
1008 | } else if (visibleHeight() - clipperPos.y() < | 1009 | } else if (visibleHeight() - clipperPos.y() < |
1009 | mScrollBorderWidth) { | 1010 | mScrollBorderWidth) { |
1010 | mScrollDownTimer.start(mScrollDelay); | 1011 | mScrollDownTimer.start(mScrollDelay); |
1011 | } else { | 1012 | } else { |
1012 | mScrollUpTimer.stop(); | 1013 | mScrollUpTimer.stop(); |
1013 | mScrollDownTimer.stop(); | 1014 | mScrollDownTimer.stop(); |
1014 | } | 1015 | } |
1015 | 1016 | ||
1016 | // Move or resize item if necessary | 1017 | // Move or resize item if necessary |
1017 | if (mCurrentCellX != gx || mCurrentCellY != gy) { | 1018 | if (mCurrentCellX != gx || mCurrentCellY != gy) { |
1018 | mItemMoved = true; | 1019 | mItemMoved = true; |
1019 | mActionItem->raise(); | 1020 | mActionItem->raise(); |
1020 | if (mActionType == MOVE) { | 1021 | if (mActionType == MOVE) { |
1021 | // Move all items belonging to a multi item | 1022 | // Move all items belonging to a multi item |
1022 | KOAgendaItem *moveItem = mActionItem->firstMultiItem(); | 1023 | KOAgendaItem *moveItem = mActionItem->firstMultiItem(); |
1023 | bool isMultiItem = (moveItem || mActionItem->lastMultiItem()); | 1024 | bool isMultiItem = (moveItem || mActionItem->lastMultiItem()); |
1024 | if (!moveItem) moveItem = mActionItem; | 1025 | if (!moveItem) moveItem = mActionItem; |
1025 | while (moveItem) { | 1026 | while (moveItem) { |
1026 | int dy; | 1027 | int dy; |
1027 | if (isMultiItem) dy = 0; | 1028 | if (isMultiItem) dy = 0; |
1028 | else dy = gy - mCurrentCellY; | 1029 | else dy = gy - mCurrentCellY; |
1029 | moveItem->moveRelative(gx - mCurrentCellX,dy); | 1030 | moveItem->moveRelative(gx - mCurrentCellX,dy); |
1030 | int x,y; | 1031 | int x,y; |
1031 | gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y); | 1032 | gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y); |
1032 | moveItem->resize(mGridSpacingX * moveItem->cellWidth(), | 1033 | moveItem->resize(mGridSpacingX * moveItem->cellWidth(), |
1033 | mGridSpacingY * moveItem->cellHeight()); | 1034 | mGridSpacingY * moveItem->cellHeight()); |
1034 | moveChild(moveItem,x,y); | 1035 | moveChild(moveItem,x,y); |
1035 | moveItem = moveItem->nextMultiItem(); | 1036 | moveItem = moveItem->nextMultiItem(); |
1036 | } | 1037 | } |
1037 | } else if (mActionType == RESIZETOP) { | 1038 | } else if (mActionType == RESIZETOP) { |
1038 | if (mCurrentCellY <= mActionItem->cellYBottom()) { | 1039 | if (mCurrentCellY <= mActionItem->cellYBottom()) { |
1039 | mActionItem->expandTop(gy - mCurrentCellY); | 1040 | mActionItem->expandTop(gy - mCurrentCellY); |
1040 | mActionItem->resize(mActionItem->width(), | 1041 | mActionItem->resize(mActionItem->width(), |
1041 | mGridSpacingY * mActionItem->cellHeight()); | 1042 | mGridSpacingY * mActionItem->cellHeight()); |
1042 | int x,y; | 1043 | int x,y; |
1043 | gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y); | 1044 | gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y); |
1044 | //moveChild(mActionItem,childX(mActionItem),y); | 1045 | //moveChild(mActionItem,childX(mActionItem),y); |
1045 | QScrollView::moveChild( mActionItem,childX(mActionItem),y ); | 1046 | QScrollView::moveChild( mActionItem,childX(mActionItem),y ); |
1046 | } | 1047 | } |
1047 | } else if (mActionType == RESIZEBOTTOM) { | 1048 | } else if (mActionType == RESIZEBOTTOM) { |
1048 | if (mCurrentCellY >= mActionItem->cellYTop()) { | 1049 | if (mCurrentCellY >= mActionItem->cellYTop()) { |
1049 | mActionItem->expandBottom(gy - mCurrentCellY); | 1050 | mActionItem->expandBottom(gy - mCurrentCellY); |
1050 | mActionItem->resize(mActionItem->width(), | 1051 | mActionItem->resize(mActionItem->width(), |
1051 | mGridSpacingY * mActionItem->cellHeight()); | 1052 | mGridSpacingY * mActionItem->cellHeight()); |
1052 | } | 1053 | } |
1053 | } else if (mActionType == RESIZELEFT) { | 1054 | } else if (mActionType == RESIZELEFT) { |
1054 | if (mCurrentCellX <= mActionItem->cellXWidth()) { | 1055 | if (mCurrentCellX <= mActionItem->cellXWidth()) { |
1055 | mActionItem->expandLeft(gx - mCurrentCellX); | 1056 | mActionItem->expandLeft(gx - mCurrentCellX); |
1056 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), | 1057 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), |
1057 | mActionItem->height()); | 1058 | mActionItem->height()); |
1058 | int x,y; | 1059 | int x,y; |
1059 | gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y); | 1060 | gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y); |
1060 | moveChild(mActionItem,x,childY(mActionItem)); | 1061 | moveChild(mActionItem,x,childY(mActionItem)); |
1061 | } | 1062 | } |
1062 | } else if (mActionType == RESIZERIGHT) { | 1063 | } else if (mActionType == RESIZERIGHT) { |
1063 | if (mCurrentCellX >= mActionItem->cellX()) { | 1064 | if (mCurrentCellX >= mActionItem->cellX()) { |
1064 | mActionItem->expandRight(gx - mCurrentCellX); | 1065 | mActionItem->expandRight(gx - mCurrentCellX); |
1065 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), | 1066 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), |
1066 | mActionItem->height()); | 1067 | mActionItem->height()); |
1067 | } | 1068 | } |
1068 | } | 1069 | } |
1069 | mCurrentCellX = gx; | 1070 | mCurrentCellX = gx; |
1070 | mCurrentCellY = gy; | 1071 | mCurrentCellY = gy; |
1071 | } | 1072 | } |
1072 | } | 1073 | } |
1073 | 1074 | ||
1074 | void KOAgenda::endItemAction() | 1075 | void KOAgenda::endItemAction() |
1075 | { | 1076 | { |
1076 | 1077 | ||
1077 | if ( mItemMoved ) { | 1078 | if ( mItemMoved ) { |
1078 | KOAgendaItem *placeItem = mActionItem->firstMultiItem(); | 1079 | KOAgendaItem *placeItem = mActionItem->firstMultiItem(); |
1079 | if ( !placeItem ) { | 1080 | if ( !placeItem ) { |
1080 | placeItem = mActionItem; | 1081 | placeItem = mActionItem; |
1081 | } | 1082 | } |
1082 | if ( placeItem->incidence()->recurrence()->doesRecur() ) { | 1083 | if ( placeItem->incidence()->recurrence()->doesRecur() ) { |
1083 | Incidence* oldInc = placeItem->incidence(); | 1084 | Incidence* oldInc = placeItem->incidence(); |
1084 | placeItem->recreateIncidence(); | 1085 | placeItem->recreateIncidence(); |
1085 | emit addToCalSignal(placeItem->incidence(), oldInc ); | 1086 | emit addToCalSignal(placeItem->incidence(), oldInc ); |
1086 | } | 1087 | } |
1087 | int type = mActionType; | 1088 | int type = mActionType; |
1088 | if ( mAllDayMode ) | 1089 | if ( mAllDayMode ) |
1089 | type = -1; | 1090 | type = -1; |
1090 | KOAgendaItem *modifiedItem = placeItem; | 1091 | KOAgendaItem *modifiedItem = placeItem; |
1091 | //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); | 1092 | //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); |
1092 | QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); | 1093 | QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); |
1093 | KOAgendaItem *item; | 1094 | KOAgendaItem *item; |
1094 | 1095 | ||
1095 | if ( placeItem->incidence()->type() == "Todo" ) { | 1096 | if ( placeItem->incidence()->type() == "Todo" ) { |
1096 | mSelectedItem = 0; | 1097 | mSelectedItem = 0; |
1097 | //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); | 1098 | //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); |
1098 | modifiedItem->mLastMoveXPos = mCurrentCellX; | 1099 | modifiedItem->mLastMoveXPos = mCurrentCellX; |
1099 | emit itemModified( modifiedItem, mActionType ); | 1100 | emit itemModified( modifiedItem, mActionType ); |
1100 | } | 1101 | } |
1101 | else { | 1102 | else { |
1102 | #if 0 | 1103 | #if 0 |
1103 | for ( item=oldconflictItems.first(); item != 0; | 1104 | for ( item=oldconflictItems.first(); item != 0; |
1104 | item=oldconflictItems.next() ) { | 1105 | item=oldconflictItems.next() ) { |
1105 | placeSubCells(item); | 1106 | placeSubCells(item); |
1106 | } | 1107 | } |
1107 | while ( placeItem ) { | 1108 | while ( placeItem ) { |
1108 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); | 1109 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); |
1109 | placeSubCells( placeItem ); | 1110 | placeSubCells( placeItem ); |
1110 | placeItem = placeItem->nextMultiItem(); | 1111 | placeItem = placeItem->nextMultiItem(); |
1111 | } | 1112 | } |
1112 | #endif | 1113 | #endif |
1113 | 1114 | ||
1114 | globalFlagBlockAgendaItemPaint = 1; | 1115 | globalFlagBlockAgendaItemPaint = 1; |
1115 | for ( item=oldconflictItems.first(); item != 0; | 1116 | for ( item=oldconflictItems.first(); item != 0; |
1116 | item=oldconflictItems.next() ) { | 1117 | item=oldconflictItems.next() ) { |
1117 | placeSubCells(item); | 1118 | placeSubCells(item); |
1118 | } | 1119 | } |
1119 | while ( placeItem ) { | 1120 | while ( placeItem ) { |
1120 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); | 1121 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); |
1121 | oldconflictItems = placeItem->conflictItems(); | 1122 | oldconflictItems = placeItem->conflictItems(); |
1122 | for ( item=oldconflictItems.first(); item != 0; | 1123 | for ( item=oldconflictItems.first(); item != 0; |
1123 | item=oldconflictItems.next() ) { | 1124 | item=oldconflictItems.next() ) { |
1124 | placeSubCells(item); | 1125 | placeSubCells(item); |
1125 | } | 1126 | } |
1126 | placeSubCells( placeItem ); | 1127 | placeSubCells( placeItem ); |
1127 | placeItem = placeItem->nextMultiItem(); | 1128 | placeItem = placeItem->nextMultiItem(); |
1128 | } | 1129 | } |
1129 | globalFlagBlockAgendaItemPaint = 0; | 1130 | globalFlagBlockAgendaItemPaint = 0; |
1130 | for ( item=oldconflictItems.first(); item != 0; | 1131 | for ( item=oldconflictItems.first(); item != 0; |
1131 | item=oldconflictItems.next() ) { | 1132 | item=oldconflictItems.next() ) { |
1132 | globalFlagBlockAgendaItemUpdate = 0; | 1133 | globalFlagBlockAgendaItemUpdate = 0; |
1133 | item->repaintMe(); | 1134 | item->repaintMe(); |
1134 | globalFlagBlockAgendaItemUpdate = 1; | 1135 | globalFlagBlockAgendaItemUpdate = 1; |
1135 | item->repaint( false ); | 1136 | item->repaint( false ); |
1136 | } | 1137 | } |
1137 | placeItem = modifiedItem; | 1138 | placeItem = modifiedItem; |
1138 | 1139 | ||
1139 | while ( placeItem ) { | 1140 | while ( placeItem ) { |
1140 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); | 1141 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); |
1141 | globalFlagBlockAgendaItemUpdate = 0; | 1142 | globalFlagBlockAgendaItemUpdate = 0; |
1142 | placeItem->repaintMe(); | 1143 | placeItem->repaintMe(); |
1143 | globalFlagBlockAgendaItemUpdate = 1; | 1144 | globalFlagBlockAgendaItemUpdate = 1; |
1144 | placeItem->repaint(false); | 1145 | placeItem->repaint(false); |
1145 | placeItem = placeItem->nextMultiItem(); | 1146 | placeItem = placeItem->nextMultiItem(); |
1146 | } | 1147 | } |
1147 | emit itemModified( modifiedItem, mActionType ); | 1148 | emit itemModified( modifiedItem, mActionType ); |
1148 | 1149 | ||
1149 | 1150 | ||
1150 | placeItem = modifiedItem; | 1151 | placeItem = modifiedItem; |
1151 | while ( placeItem ) { | 1152 | while ( placeItem ) { |
1152 | oldconflictItems = placeItem->conflictItems(); | 1153 | oldconflictItems = placeItem->conflictItems(); |
1153 | for ( item=oldconflictItems.first(); item != 0; | 1154 | for ( item=oldconflictItems.first(); item != 0; |
1154 | item=oldconflictItems.next() ) { | 1155 | item=oldconflictItems.next() ) { |
1155 | placeSubCells(item); | 1156 | placeSubCells(item); |
1156 | } | 1157 | } |
1157 | placeSubCells( placeItem ); | 1158 | placeSubCells( placeItem ); |
1158 | placeItem = placeItem->nextMultiItem(); | 1159 | placeItem = placeItem->nextMultiItem(); |
1159 | 1160 | ||
1160 | } | 1161 | } |
1161 | placeItem = modifiedItem; | 1162 | placeItem = modifiedItem; |
1162 | while ( placeItem ) { | 1163 | while ( placeItem ) { |
1163 | oldconflictItems = placeItem->conflictItems(); | 1164 | oldconflictItems = placeItem->conflictItems(); |
1164 | for ( item=oldconflictItems.first(); item != 0; | 1165 | for ( item=oldconflictItems.first(); item != 0; |
1165 | item=oldconflictItems.next() ) { | 1166 | item=oldconflictItems.next() ) { |
1166 | globalFlagBlockAgendaItemUpdate = 0; | 1167 | globalFlagBlockAgendaItemUpdate = 0; |
1167 | item->repaintMe(); | 1168 | item->repaintMe(); |
1168 | globalFlagBlockAgendaItemUpdate = 1; | 1169 | globalFlagBlockAgendaItemUpdate = 1; |
1169 | item->repaint(false); | 1170 | item->repaint(false); |
1170 | } | 1171 | } |
1171 | placeItem = placeItem->nextMultiItem(); | 1172 | placeItem = placeItem->nextMultiItem(); |
1172 | } | 1173 | } |
1173 | /* | 1174 | /* |
1174 | 1175 | ||
1175 | oldconflictItems = modifiedItem->conflictItems(); | 1176 | oldconflictItems = modifiedItem->conflictItems(); |
1176 | for ( item=oldconflictItems.first(); item != 0; | 1177 | for ( item=oldconflictItems.first(); item != 0; |
1177 | item=oldconflictItems.next() ) { | 1178 | item=oldconflictItems.next() ) { |
1178 | globalFlagBlockAgendaItemUpdate = 0; | 1179 | globalFlagBlockAgendaItemUpdate = 0; |
1179 | item->paintMe(false); | 1180 | item->paintMe(false); |
1180 | globalFlagBlockAgendaItemUpdate = 1; | 1181 | globalFlagBlockAgendaItemUpdate = 1; |
1181 | item->repaint(false); | 1182 | item->repaint(false); |
1182 | } | 1183 | } |
1183 | */ | 1184 | */ |
1184 | 1185 | ||
1185 | 1186 | ||
1186 | } | 1187 | } |
1187 | 1188 | ||
1188 | } | 1189 | } |
1189 | 1190 | ||
1190 | mScrollUpTimer.stop(); | 1191 | mScrollUpTimer.stop(); |
1191 | mScrollDownTimer.stop(); | 1192 | mScrollDownTimer.stop(); |
1192 | setCursor( arrowCursor ); | 1193 | setCursor( arrowCursor ); |
1193 | mActionItem = 0; | 1194 | mActionItem = 0; |
1194 | mActionType = NOP; | 1195 | mActionType = NOP; |
1195 | mItemMoved = 0; | 1196 | mItemMoved = 0; |
1196 | 1197 | ||
1197 | } | 1198 | } |
1198 | 1199 | ||
1199 | void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) | 1200 | void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) |
1200 | { | 1201 | { |
1201 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; | 1202 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; |
1202 | // QPoint point = viewport()->mapToGlobal(viewportPos); | 1203 | // QPoint point = viewport()->mapToGlobal(viewportPos); |
1203 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; | 1204 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; |
1204 | // point = clipper()->mapFromGlobal(point); | 1205 | // point = clipper()->mapFromGlobal(point); |
1205 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; | 1206 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; |
1206 | 1207 | ||
1207 | int x,y; | 1208 | int x,y; |
1208 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 1209 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
1209 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; | 1210 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; |
1210 | int gx,gy; | 1211 | int gx,gy; |
1211 | contentsToGrid(x,y,gx,gy); | 1212 | contentsToGrid(x,y,gx,gy); |
1212 | 1213 | ||
1213 | // Change cursor to resize cursor if appropriate | 1214 | // Change cursor to resize cursor if appropriate |
1214 | if (mAllDayMode) { | 1215 | if (mAllDayMode) { |
1215 | int gridDistanceX = (x - gx * mGridSpacingX); | 1216 | int gridDistanceX = (x - gx * mGridSpacingX); |
1216 | if (gridDistanceX < mResizeBorderWidth && | 1217 | if (gridDistanceX < mResizeBorderWidth && |
1217 | moveItem->cellX() == gx) { | 1218 | moveItem->cellX() == gx) { |
1218 | setCursor(sizeHorCursor); | 1219 | setCursor(sizeHorCursor); |
1219 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && | 1220 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && |
1220 | moveItem->cellXWidth() == gx) { | 1221 | moveItem->cellXWidth() == gx) { |
1221 | setCursor(sizeHorCursor); | 1222 | setCursor(sizeHorCursor); |
1222 | } else { | 1223 | } else { |
1223 | setCursor(arrowCursor); | 1224 | setCursor(arrowCursor); |
1224 | } | 1225 | } |
1225 | } else { | 1226 | } else { |
1226 | int gridDistanceY = (y - gy * mGridSpacingY); | 1227 | int gridDistanceY = (y - gy * mGridSpacingY); |
1227 | if (gridDistanceY < mResizeBorderWidth && | 1228 | if (gridDistanceY < mResizeBorderWidth && |
1228 | moveItem->cellYTop() == gy && | 1229 | moveItem->cellYTop() == gy && |
1229 | !moveItem->firstMultiItem()) { | 1230 | !moveItem->firstMultiItem()) { |
1230 | setCursor(sizeVerCursor); | 1231 | setCursor(sizeVerCursor); |
1231 | } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth && | 1232 | } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth && |
1232 | moveItem->cellYBottom() == gy && | 1233 | moveItem->cellYBottom() == gy && |
1233 | !moveItem->lastMultiItem()) { | 1234 | !moveItem->lastMultiItem()) { |
1234 | setCursor(sizeVerCursor); | 1235 | setCursor(sizeVerCursor); |
1235 | } else { | 1236 | } else { |
1236 | setCursor(arrowCursor); | 1237 | setCursor(arrowCursor); |
1237 | } | 1238 | } |
1238 | } | 1239 | } |
1239 | } | 1240 | } |
1240 | 1241 | ||
1241 | 1242 | ||
1242 | /* | 1243 | /* |
1243 | Place item in cell and take care that multiple items using the same cell do | 1244 | Place item in cell and take care that multiple items using the same cell do |
1244 | not overlap. This method is not yet optimal. It doesn´t use the maximum space | 1245 | not overlap. This method is not yet optimal. It doesn´t use the maximum space |
1245 | it can get in all cases. | 1246 | it can get in all cases. |
1246 | At the moment the method has a bug: When an item is placed only the sub cell | 1247 | At the moment the method has a bug: When an item is placed only the sub cell |
1247 | widths of the items are changed, which are within the Y region the item to | 1248 | widths of the items are changed, which are within the Y region the item to |
1248 | place spans. When the sub cell width change of one of this items affects a | 1249 | place spans. When the sub cell width change of one of this items affects a |
1249 | cell, where other items are, which do not overlap in Y with the item to place, | 1250 | cell, where other items are, which do not overlap in Y with the item to place, |
1250 | the display gets corrupted, although the corruption looks quite nice. | 1251 | the display gets corrupted, although the corruption looks quite nice. |
1251 | */ | 1252 | */ |
1252 | void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | 1253 | void KOAgenda::placeSubCells(KOAgendaItem *placeItem) |
1253 | { | 1254 | { |
1254 | 1255 | ||
1255 | QPtrList<KOAgendaItem> conflictItems; | 1256 | QPtrList<KOAgendaItem> conflictItems; |
1256 | int maxSubCells = 0; | 1257 | int maxSubCells = 0; |
1257 | QIntDict<KOAgendaItem> subCellDict(5); | 1258 | QIntDict<KOAgendaItem> subCellDict(5); |
1258 | 1259 | ||
1259 | KOAgendaItem *item; | 1260 | KOAgendaItem *item; |
1260 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1261 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1261 | if (item != placeItem) { | 1262 | if (item != placeItem) { |
1262 | if (placeItem->cellX() <= item->cellXWidth() && | 1263 | if (placeItem->cellX() <= item->cellXWidth() && |
1263 | placeItem->cellXWidth() >= item->cellX()) { | 1264 | placeItem->cellXWidth() >= item->cellX()) { |
1264 | if ((placeItem->cellYTop() <= item->cellYBottom()) && | 1265 | if ((placeItem->cellYTop() <= item->cellYBottom()) && |
1265 | (placeItem->cellYBottom() >= item->cellYTop())) { | 1266 | (placeItem->cellYBottom() >= item->cellYTop())) { |
1266 | conflictItems.append(item); | 1267 | conflictItems.append(item); |
1267 | if (item->subCells() > maxSubCells) | 1268 | if (item->subCells() > maxSubCells) |
1268 | maxSubCells = item->subCells(); | 1269 | maxSubCells = item->subCells(); |
1269 | subCellDict.insert(item->subCell(),item); | 1270 | subCellDict.insert(item->subCell(),item); |
1270 | } | 1271 | } |
1271 | } | 1272 | } |
1272 | } | 1273 | } |
1273 | } | 1274 | } |
1274 | 1275 | ||
1275 | if (conflictItems.count() > 0) { | 1276 | if (conflictItems.count() > 0) { |
1276 | // Look for unused sub cell and insert item | 1277 | // Look for unused sub cell and insert item |
1277 | int i; | 1278 | int i; |
1278 | for(i=0;i<maxSubCells;++i) { | 1279 | for(i=0;i<maxSubCells;++i) { |
1279 | if (!subCellDict.find(i)) { | 1280 | if (!subCellDict.find(i)) { |
1280 | placeItem->setSubCell(i); | 1281 | placeItem->setSubCell(i); |
1281 | break; | 1282 | break; |
1282 | } | 1283 | } |
1283 | } | 1284 | } |
1284 | if (i == maxSubCells) { | 1285 | if (i == maxSubCells) { |
1285 | placeItem->setSubCell(maxSubCells); | 1286 | placeItem->setSubCell(maxSubCells); |
1286 | maxSubCells++; // add new item to number of sub cells | 1287 | maxSubCells++; // add new item to number of sub cells |
1287 | } | 1288 | } |
1288 | 1289 | ||
1289 | // Prepare for sub cell geometry adjustment | 1290 | // Prepare for sub cell geometry adjustment |
1290 | int newSubCellWidth; | 1291 | int newSubCellWidth; |
1291 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells; | 1292 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells; |
1292 | else newSubCellWidth = mGridSpacingX / maxSubCells; | 1293 | else newSubCellWidth = mGridSpacingX / maxSubCells; |
1293 | conflictItems.append(placeItem); | 1294 | conflictItems.append(placeItem); |
1294 | 1295 | ||
1295 | 1296 | ||
1296 | // Adjust sub cell geometry of all direct conflict items | 1297 | // Adjust sub cell geometry of all direct conflict items |
1297 | for ( item=conflictItems.first(); item != 0; | 1298 | for ( item=conflictItems.first(); item != 0; |
1298 | item=conflictItems.next() ) { | 1299 | item=conflictItems.next() ) { |
1299 | item->setSubCells(maxSubCells); | 1300 | item->setSubCells(maxSubCells); |
1300 | if (mAllDayMode) { | 1301 | if (mAllDayMode) { |
1301 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); | 1302 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); |
1302 | } else { | 1303 | } else { |
1303 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); | 1304 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); |
1304 | } | 1305 | } |
1305 | int x,y; | 1306 | int x,y; |
1306 | gridToContents(item->cellX(),item->cellYTop(),x,y); | 1307 | gridToContents(item->cellX(),item->cellYTop(),x,y); |
1307 | if (mAllDayMode) { | 1308 | if (mAllDayMode) { |
1308 | y += item->subCell() * newSubCellWidth; | 1309 | y += item->subCell() * newSubCellWidth; |
1309 | } else { | 1310 | } else { |
1310 | x += item->subCell() * newSubCellWidth; | 1311 | x += item->subCell() * newSubCellWidth; |
1311 | } | 1312 | } |
1312 | moveChild(item,x,y); | 1313 | moveChild(item,x,y); |
1313 | // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); | 1314 | // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); |
1314 | //item->updateItem(); | 1315 | //item->updateItem(); |
1315 | } | 1316 | } |
1316 | // Adjust sub cell geometry of all conflict items of all conflict items | 1317 | // Adjust sub cell geometry of all conflict items of all conflict items |
1317 | for ( item=conflictItems.first(); item != 0; | 1318 | for ( item=conflictItems.first(); item != 0; |
1318 | item=conflictItems.next() ) { | 1319 | item=conflictItems.next() ) { |
1319 | if ( placeItem != item ) { | 1320 | if ( placeItem != item ) { |
1320 | KOAgendaItem *item2; | 1321 | KOAgendaItem *item2; |
1321 | QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems(); | 1322 | QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems(); |
1322 | for ( item2=conflictItems2.first(); item2 != 0; | 1323 | for ( item2=conflictItems2.first(); item2 != 0; |
1323 | item2=conflictItems2.next() ) { | 1324 | item2=conflictItems2.next() ) { |
1324 | if ( item2->subCells() != maxSubCells) { | 1325 | if ( item2->subCells() != maxSubCells) { |
1325 | item2->setSubCells(maxSubCells); | 1326 | item2->setSubCells(maxSubCells); |
1326 | if (mAllDayMode) { | 1327 | if (mAllDayMode) { |
1327 | item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth); | 1328 | item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth); |
1328 | } else { | 1329 | } else { |
1329 | item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY); | 1330 | item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY); |
1330 | } | 1331 | } |
1331 | int x,y; | 1332 | int x,y; |
1332 | gridToContents(item2->cellX(),item2->cellYTop(),x,y); | 1333 | gridToContents(item2->cellX(),item2->cellYTop(),x,y); |
1333 | if (mAllDayMode) { | 1334 | if (mAllDayMode) { |
1334 | y += item2->subCell() * newSubCellWidth; | 1335 | y += item2->subCell() * newSubCellWidth; |
1335 | } else { | 1336 | } else { |
1336 | x += item2->subCell() * newSubCellWidth; | 1337 | x += item2->subCell() * newSubCellWidth; |
1337 | } | 1338 | } |
1338 | moveChild(item2,x,y); | 1339 | moveChild(item2,x,y); |
1339 | //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() ); | 1340 | //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() ); |
1340 | } | 1341 | } |
1341 | } | 1342 | } |
1342 | } | 1343 | } |
1343 | } | 1344 | } |
1344 | } else { | 1345 | } else { |
1345 | placeItem->setSubCell(0); | 1346 | placeItem->setSubCell(0); |
1346 | placeItem->setSubCells(1); | 1347 | placeItem->setSubCells(1); |
1347 | if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); | 1348 | if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); |
1348 | else placeItem->resize(mGridSpacingX,placeItem->height()); | 1349 | else placeItem->resize(mGridSpacingX,placeItem->height()); |
1349 | int x,y; | 1350 | int x,y; |
1350 | gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); | 1351 | gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); |
1351 | moveChild(placeItem,x,y); | 1352 | moveChild(placeItem,x,y); |
1352 | } | 1353 | } |
1353 | placeItem->setConflictItems(conflictItems); | 1354 | placeItem->setConflictItems(conflictItems); |
1354 | // for ( item=conflictItems.first(); item != 0; | 1355 | // for ( item=conflictItems.first(); item != 0; |
1355 | // item=conflictItems.next() ) { | 1356 | // item=conflictItems.next() ) { |
1356 | // //item->updateItem(); | 1357 | // //item->updateItem(); |
1357 | // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); | 1358 | // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); |
1358 | // } | 1359 | // } |
1359 | // placeItem->updateItem(); | 1360 | // placeItem->updateItem(); |
1360 | } | 1361 | } |
1361 | 1362 | ||
1362 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) | 1363 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) |
1363 | { | 1364 | { |
1364 | if ( globalFlagBlockAgenda ) | 1365 | if ( globalFlagBlockAgenda ) |
1365 | return; | 1366 | return; |
1366 | if ( ! mAllDayMode ) { | 1367 | if ( ! mAllDayMode ) { |
1367 | // currently not working for | 1368 | // currently not working for |
1368 | 1369 | ||
1369 | //qDebug("KOAgenda::drawContents "); | 1370 | //qDebug("KOAgenda::drawContents "); |
1370 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) | 1371 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) |
1371 | ;//drawContentsToPainter(); | 1372 | ;//drawContentsToPainter(); |
1372 | 1373 | ||
1373 | QPaintDevice* pd = p->device(); | 1374 | QPaintDevice* pd = p->device(); |
1374 | p->end(); | 1375 | p->end(); |
1375 | int vx, vy; | 1376 | int vx, vy; |
1376 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1377 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1377 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1378 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1378 | mSelectionCellX * mGridSpacingX; | 1379 | mSelectionCellX * mGridSpacingX; |
1379 | contentsToViewport ( cx, cy, vx,vy); | 1380 | contentsToViewport ( cx, cy, vx,vy); |
1380 | //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ; | 1381 | //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ; |
1381 | 1382 | ||
1382 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) { | 1383 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) { |
1383 | if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1384 | if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1384 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) { | 1385 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) { |
1385 | 1386 | ||
1386 | int vxSel, vySel; | 1387 | int vxSel, vySel; |
1387 | contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel); | 1388 | contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel); |
1388 | int off = mSelectionHeight; | 1389 | int off = mSelectionHeight; |
1389 | if ( vySel < 0 ) | 1390 | if ( vySel < 0 ) |
1390 | off += vySel; | 1391 | off += vySel; |
1391 | //qDebug("OFF %d %d %d", off,vySel, vy ); | 1392 | //qDebug("OFF %d %d %d", off,vySel, vy ); |
1392 | bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP); | 1393 | bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP); |
1393 | } else { | 1394 | } else { |
1394 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); | 1395 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); |
1395 | } | 1396 | } |
1396 | } | 1397 | } |
1397 | if ( mSelectionHeight > 0 ) { | 1398 | if ( mSelectionHeight > 0 ) { |
1398 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); | 1399 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); |
1399 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1400 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1400 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | 1401 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { |
1401 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); | 1402 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); |
1402 | bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); | 1403 | bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); |
1403 | } | 1404 | } |
1404 | } | 1405 | } |
1405 | p->begin( pd ); | 1406 | p->begin( pd ); |
1406 | } else { | 1407 | } else { |
1407 | 1408 | ||
1408 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) | 1409 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) |
1409 | ;//drawContentsToPainter(); | 1410 | ;//drawContentsToPainter(); |
1410 | 1411 | ||
1411 | QPaintDevice* pd = p->device(); | 1412 | QPaintDevice* pd = p->device(); |
1412 | p->end(); | 1413 | p->end(); |
1413 | int vx, vy; | 1414 | int vx, vy; |
1414 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1415 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1415 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1416 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1416 | mSelectionCellX * mGridSpacingX; | 1417 | mSelectionCellX * mGridSpacingX; |
1417 | contentsToViewport ( cx, cy, vx,vy); | 1418 | contentsToViewport ( cx, cy, vx,vy); |
1418 | // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; | 1419 | // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; |
1419 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) | 1420 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) |
1420 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); | 1421 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); |
1421 | 1422 | ||
1422 | if ( mSelectionHeight > 0 ) { | 1423 | if ( mSelectionHeight > 0 ) { |
1423 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); | 1424 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); |
1424 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1425 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1425 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | 1426 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { |
1426 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); | 1427 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); |
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,1449 +1,1457 @@ | |||
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); |
938 | 946 | ||
939 | 947 | ||
940 | topFrame = addPage(i18n("View Options"),0,0); | 948 | topFrame = addPage(i18n("View Options"),0,0); |
941 | 949 | ||
942 | topLayout = new QGridLayout(topFrame,4,1); | 950 | topLayout = new QGridLayout(topFrame,4,1); |
943 | topLayout->setSpacing(mSpacingHint); | 951 | topLayout->setSpacing(mSpacingHint); |
944 | topLayout->setMargin(mMarginHint); | 952 | topLayout->setMargin(mMarginHint); |
945 | ii = 0; | 953 | ii = 0; |
946 | lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); | 954 | lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); |
947 | topLayout->addWidget(lab ,ii++,0); | 955 | topLayout->addWidget(lab ,ii++,0); |
948 | 956 | ||
949 | dummy = addWidBool(i18n("Details"), | 957 | dummy = addWidBool(i18n("Details"), |
950 | &(KOPrefs::instance()->mEVshowDetails),topFrame); | 958 | &(KOPrefs::instance()->mEVshowDetails),topFrame); |
951 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 959 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
952 | dummy = addWidBool(i18n("Created time"), | 960 | dummy = addWidBool(i18n("Created time"), |
953 | &(KOPrefs::instance()->mEVshowCreated),topFrame); | 961 | &(KOPrefs::instance()->mEVshowCreated),topFrame); |
954 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 962 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
955 | dummy = addWidBool(i18n("Last modified time"), | 963 | dummy = addWidBool(i18n("Last modified time"), |
956 | &(KOPrefs::instance()->mEVshowChanged),topFrame); | 964 | &(KOPrefs::instance()->mEVshowChanged),topFrame); |
957 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 965 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
958 | 966 | ||
959 | 967 | ||
960 | lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame); | 968 | lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame); |
961 | topLayout->addWidget(lab ,ii++,0); | 969 | topLayout->addWidget(lab ,ii++,0); |
962 | 970 | ||
963 | dummy = addWidBool(i18n("Details"), | 971 | dummy = addWidBool(i18n("Details"), |
964 | &(KOPrefs::instance()->mWTshowDetails),topFrame); | 972 | &(KOPrefs::instance()->mWTshowDetails),topFrame); |
965 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 973 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
966 | dummy = addWidBool(i18n("Created time"), | 974 | dummy = addWidBool(i18n("Created time"), |
967 | &(KOPrefs::instance()->mWTshowCreated),topFrame); | 975 | &(KOPrefs::instance()->mWTshowCreated),topFrame); |
968 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 976 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
969 | dummy = addWidBool(i18n("Last modified time"), | 977 | dummy = addWidBool(i18n("Last modified time"), |
970 | &(KOPrefs::instance()->mWTshowChanged),topFrame); | 978 | &(KOPrefs::instance()->mWTshowChanged),topFrame); |
971 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 979 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
972 | 980 | ||
973 | 981 | ||
974 | topFrame = addPage(i18n("Alarm"),0,0); | 982 | topFrame = addPage(i18n("Alarm"),0,0); |
975 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 983 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
976 | 984 | ||
977 | topLayout = new QGridLayout(topFrame,2,1); | 985 | topLayout = new QGridLayout(topFrame,2,1); |
978 | topLayout->setSpacing(mSpacingHint); | 986 | topLayout->setSpacing(mSpacingHint); |
979 | topLayout->setMargin(mMarginHint); | 987 | topLayout->setMargin(mMarginHint); |
980 | int iii = 0; | 988 | int iii = 0; |
981 | 989 | ||
982 | dummy = | 990 | dummy = |
983 | addWidBool(i18n("Use internal alarm notification"), | 991 | addWidBool(i18n("Use internal alarm notification"), |
984 | &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); | 992 | &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); |
985 | topLayout->addWidget(dummy->checkBox(),iii++,0); | 993 | topLayout->addWidget(dummy->checkBox(),iii++,0); |
986 | lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); | 994 | lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); |
987 | 995 | ||
988 | topLayout->addWidget(lab ,iii++,0); | 996 | topLayout->addWidget(lab ,iii++,0); |
989 | #ifndef DESKTOP_VERSION | 997 | #ifndef DESKTOP_VERSION |
990 | lab->setAlignment( AlignLeft|WordBreak|AlignTop); | 998 | lab->setAlignment( AlignLeft|WordBreak|AlignTop); |
991 | #else | 999 | #else |
992 | lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 1000 | lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
993 | lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | 1001 | lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); |
994 | #endif | 1002 | #endif |
995 | 1003 | ||
996 | QHBox* dummyBox = new QHBox(topFrame); | 1004 | QHBox* dummyBox = new QHBox(topFrame); |
997 | new QLabel(i18n("Play beeps count:"),dummyBox); | 1005 | new QLabel(i18n("Play beeps count:"),dummyBox); |
998 | mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); | 1006 | mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); |
999 | topLayout->addWidget(dummyBox,iii++,0); | 1007 | topLayout->addWidget(dummyBox,iii++,0); |
1000 | 1008 | ||
1001 | dummyBox = new QHBox(topFrame); | 1009 | dummyBox = new QHBox(topFrame); |
1002 | new QLabel(i18n("Beeps interval in sec:"),dummyBox); | 1010 | new QLabel(i18n("Beeps interval in sec:"),dummyBox); |
1003 | mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); | 1011 | mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); |
1004 | topLayout->addWidget(dummyBox,iii++,0); | 1012 | topLayout->addWidget(dummyBox,iii++,0); |
1005 | 1013 | ||
1006 | dummyBox = new QHBox(topFrame); | 1014 | dummyBox = new QHBox(topFrame); |
1007 | new QLabel(i18n("Default suspend time in min:"),dummyBox); | 1015 | new QLabel(i18n("Default suspend time in min:"),dummyBox); |
1008 | mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); | 1016 | mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); |
1009 | topLayout->addWidget(dummyBox,iii++,0); | 1017 | topLayout->addWidget(dummyBox,iii++,0); |
1010 | 1018 | ||
1011 | dummyBox = new QHBox(topFrame); | 1019 | dummyBox = new QHBox(topFrame); |
1012 | new QLabel(i18n("Auto suspend count:"),dummyBox); | 1020 | new QLabel(i18n("Auto suspend count:"),dummyBox); |
1013 | mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); | 1021 | mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); |
1014 | topLayout->addWidget(dummyBox,iii++,0); | 1022 | topLayout->addWidget(dummyBox,iii++,0); |
1015 | 1023 | ||
1016 | 1024 | ||
1017 | 1025 | ||
1018 | 1026 | ||
1019 | 1027 | ||
1020 | 1028 | ||
1021 | 1029 | ||
1022 | QHBox* hbo = new QHBox ( topFrame ); | 1030 | QHBox* hbo = new QHBox ( topFrame ); |
1023 | mDefaultAlarmFile = new QLineEdit(hbo); | 1031 | mDefaultAlarmFile = new QLineEdit(hbo); |
1024 | QPushButton * loadTemplate = new QPushButton(hbo); | 1032 | QPushButton * loadTemplate = new QPushButton(hbo); |
1025 | QPixmap icon; | 1033 | QPixmap icon; |
1026 | if ( QApplication::desktop()->width() < 321 ) | 1034 | if ( QApplication::desktop()->width() < 321 ) |
1027 | icon = SmallIcon("fileimport16"); | 1035 | icon = SmallIcon("fileimport16"); |
1028 | else | 1036 | else |
1029 | icon = SmallIcon("fileimport"); | 1037 | icon = SmallIcon("fileimport"); |
1030 | loadTemplate->setIconSet (icon ) ; | 1038 | loadTemplate->setIconSet (icon ) ; |
1031 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); | 1039 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); |
1032 | int size = loadTemplate->sizeHint().height(); | 1040 | int size = loadTemplate->sizeHint().height(); |
1033 | loadTemplate->setFixedSize( size, size ); | 1041 | loadTemplate->setFixedSize( size, size ); |
1034 | //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); | 1042 | //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); |
1035 | // topLayout->addWidget(lab ,iii++,0); | 1043 | // topLayout->addWidget(lab ,iii++,0); |
1036 | lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); | 1044 | lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); |
1037 | topLayout->addWidget(lab ,iii++,0); | 1045 | topLayout->addWidget(lab ,iii++,0); |
1038 | topLayout->addWidget(hbo,iii++,0); | 1046 | topLayout->addWidget(hbo,iii++,0); |
1039 | // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); | 1047 | // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); |
1040 | 1048 | ||
1041 | // topLayout->addWidget(lab ,iii++,0); | 1049 | // topLayout->addWidget(lab ,iii++,0); |
1042 | // #ifndef DESKTOP_VERSION | 1050 | // #ifndef DESKTOP_VERSION |
1043 | // lab->setAlignment( AlignLeft|WordBreak|AlignTop); | 1051 | // lab->setAlignment( AlignLeft|WordBreak|AlignTop); |
1044 | // #else | 1052 | // #else |
1045 | // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 1053 | // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
1046 | // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | 1054 | // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); |
1047 | // #endif | 1055 | // #endif |
1048 | 1056 | ||
1049 | 1057 | ||
1050 | } | 1058 | } |
1051 | 1059 | ||
1052 | void KOPrefsDialog::selectSoundFile() | 1060 | void KOPrefsDialog::selectSoundFile() |
1053 | { | 1061 | { |
1054 | QString fileName = mDefaultAlarmFile->text(); | 1062 | QString fileName = mDefaultAlarmFile->text(); |
1055 | fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); | 1063 | fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); |
1056 | if ( fileName.length() > 0 ) | 1064 | if ( fileName.length() > 0 ) |
1057 | mDefaultAlarmFile->setText( fileName ); | 1065 | mDefaultAlarmFile->setText( fileName ); |
1058 | } | 1066 | } |
1059 | void KOPrefsDialog::setupFontsTab() | 1067 | void KOPrefsDialog::setupFontsTab() |
1060 | { | 1068 | { |
1061 | 1069 | ||
1062 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); | 1070 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); |
1063 | // DesktopIcon("fonts",KIcon::SizeMedium)); | 1071 | // DesktopIcon("fonts",KIcon::SizeMedium)); |
1064 | 1072 | ||
1065 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); | 1073 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); |
1066 | topLayout->setSpacing(1); | 1074 | topLayout->setSpacing(1); |
1067 | topLayout->setMargin(3); | 1075 | topLayout->setMargin(3); |
1068 | KPrefsDialogWidFont * tVFont; | 1076 | KPrefsDialogWidFont * tVFont; |
1069 | int i = 0; | 1077 | int i = 0; |
1070 | KPrefsDialogWidFont *timeLabelsFont = | 1078 | KPrefsDialogWidFont *timeLabelsFont = |
1071 | addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), | 1079 | addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), |
1072 | &(KOPrefs::instance()->mDateNavigatorFont),topFrame); | 1080 | &(KOPrefs::instance()->mDateNavigatorFont),topFrame); |
1073 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 1081 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
1074 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 1082 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
1075 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 1083 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
1076 | ++i; | 1084 | ++i; |
1077 | 1085 | ||
1078 | 1086 | ||
1079 | timeLabelsFont = | 1087 | timeLabelsFont = |
1080 | addWidFont(i18n("Mon 15"),i18n("Date Labels:"), | 1088 | addWidFont(i18n("Mon 15"),i18n("Date Labels:"), |
1081 | &(KOPrefs::instance()->mTimeLabelsFont),topFrame); | 1089 | &(KOPrefs::instance()->mTimeLabelsFont),topFrame); |
1082 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 1090 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
1083 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 1091 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
1084 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 1092 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
1085 | ++i; | 1093 | ++i; |
1086 | 1094 | ||
1087 | KPrefsDialogWidFont *timeBarFont = | 1095 | KPrefsDialogWidFont *timeBarFont = |
1088 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), | 1096 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), |
1089 | &(KOPrefs::instance()->mTimeBarFont),topFrame); | 1097 | &(KOPrefs::instance()->mTimeBarFont),topFrame); |
1090 | topLayout->addWidget(timeBarFont->label(),i,0); | 1098 | topLayout->addWidget(timeBarFont->label(),i,0); |
1091 | topLayout->addWidget(timeBarFont->preview(),i,1); | 1099 | topLayout->addWidget(timeBarFont->preview(),i,1); |
1092 | topLayout->addWidget(timeBarFont->button(),i,2); | 1100 | topLayout->addWidget(timeBarFont->button(),i,2); |
1093 | ++i; | 1101 | ++i; |
1094 | 1102 | ||
1095 | 1103 | ||
1096 | KPrefsDialogWidFont *marcusBainsFont = | 1104 | KPrefsDialogWidFont *marcusBainsFont = |
1097 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), | 1105 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), |
1098 | &(KOPrefs::instance()->mMarcusBainsFont),topFrame); | 1106 | &(KOPrefs::instance()->mMarcusBainsFont),topFrame); |
1099 | topLayout->addWidget(marcusBainsFont->label(),i,0); | 1107 | topLayout->addWidget(marcusBainsFont->label(),i,0); |
1100 | topLayout->addWidget(marcusBainsFont->preview(),i,1); | 1108 | topLayout->addWidget(marcusBainsFont->preview(),i,1); |
1101 | topLayout->addWidget(marcusBainsFont->button(),i,2); | 1109 | topLayout->addWidget(marcusBainsFont->button(),i,2); |
1102 | ++i; | 1110 | ++i; |
1103 | 1111 | ||
1104 | tVFont = | 1112 | tVFont = |
1105 | addWidFont(i18n("Summary"),i18n("Event Viewer:"), | 1113 | addWidFont(i18n("Summary"),i18n("Event Viewer:"), |
1106 | &(KOPrefs::instance()->mEventViewFont),topFrame); | 1114 | &(KOPrefs::instance()->mEventViewFont),topFrame); |
1107 | topLayout->addWidget(tVFont->label(),i,0); | 1115 | topLayout->addWidget(tVFont->label(),i,0); |
1108 | topLayout->addWidget(tVFont->preview(),i,1); | 1116 | topLayout->addWidget(tVFont->preview(),i,1); |
1109 | topLayout->addWidget(tVFont->button(),i,2); | 1117 | topLayout->addWidget(tVFont->button(),i,2); |
1110 | ++i; | 1118 | ++i; |
1111 | 1119 | ||
1112 | 1120 | ||
1113 | 1121 | ||
1114 | tVFont = | 1122 | tVFont = |
1115 | addWidFont(i18n("Details"),i18n("EditorBox:"), | 1123 | addWidFont(i18n("Details"),i18n("EditorBox:"), |
1116 | &(KOPrefs::instance()->mEditBoxFont),topFrame); | 1124 | &(KOPrefs::instance()->mEditBoxFont),topFrame); |
1117 | topLayout->addWidget(tVFont->label(),i,0); | 1125 | topLayout->addWidget(tVFont->label(),i,0); |
1118 | topLayout->addWidget(tVFont->preview(),i,1); | 1126 | topLayout->addWidget(tVFont->preview(),i,1); |
1119 | topLayout->addWidget(tVFont->button(),i,2); | 1127 | topLayout->addWidget(tVFont->button(),i,2); |
1120 | ++i; | 1128 | ++i; |
1121 | 1129 | ||
1122 | 1130 | ||
1123 | 1131 | ||
1124 | topLayout->setColStretch(1,1); | 1132 | topLayout->setColStretch(1,1); |
1125 | topLayout->setRowStretch(4,1); | 1133 | topLayout->setRowStretch(4,1); |
1126 | 1134 | ||
1127 | 1135 | ||
1128 | i = 0; | 1136 | i = 0; |
1129 | topFrame = addPage(i18n("View Fonts"),0, | 1137 | topFrame = addPage(i18n("View Fonts"),0, |
1130 | DesktopIcon("fonts",KIcon::SizeMedium)); | 1138 | DesktopIcon("fonts",KIcon::SizeMedium)); |
1131 | 1139 | ||
1132 | topLayout = new QGridLayout(topFrame,7,3); | 1140 | topLayout = new QGridLayout(topFrame,7,3); |
1133 | topLayout->setSpacing(1); | 1141 | topLayout->setSpacing(1); |
1134 | topLayout->setMargin(3); | 1142 | topLayout->setMargin(3); |
1135 | 1143 | ||
1136 | tVFont = | 1144 | tVFont = |
1137 | addWidFont(i18n("Configure KO"),i18n("What's Next View:"), | 1145 | addWidFont(i18n("Configure KO"),i18n("What's Next View:"), |
1138 | &(KOPrefs::instance()->mWhatsNextFont),topFrame); | 1146 | &(KOPrefs::instance()->mWhatsNextFont),topFrame); |
1139 | topLayout->addWidget(tVFont->label(),i,0); | 1147 | topLayout->addWidget(tVFont->label(),i,0); |
1140 | topLayout->addWidget(tVFont->preview(),i,1); | 1148 | topLayout->addWidget(tVFont->preview(),i,1); |
1141 | topLayout->addWidget(tVFont->button(),i,2); | 1149 | topLayout->addWidget(tVFont->button(),i,2); |
1142 | ++i; | 1150 | ++i; |
1143 | KPrefsDialogWidFont *agendaViewFont = | 1151 | KPrefsDialogWidFont *agendaViewFont = |
1144 | addWidFont(i18n("Event text"),i18n("Agenda view:"), | 1152 | addWidFont(i18n("Event text"),i18n("Agenda view:"), |
1145 | &(KOPrefs::instance()->mAgendaViewFont),topFrame); | 1153 | &(KOPrefs::instance()->mAgendaViewFont),topFrame); |
1146 | topLayout->addWidget(agendaViewFont->label(),i,0); | 1154 | topLayout->addWidget(agendaViewFont->label(),i,0); |
1147 | topLayout->addWidget(agendaViewFont->preview(),i,1); | 1155 | topLayout->addWidget(agendaViewFont->preview(),i,1); |
1148 | topLayout->addWidget(agendaViewFont->button(),i,2); | 1156 | topLayout->addWidget(agendaViewFont->button(),i,2); |
1149 | ++i; | 1157 | ++i; |
1150 | 1158 | ||
1151 | 1159 | ||
1152 | KPrefsDialogWidFont *monthViewFont = | 1160 | KPrefsDialogWidFont *monthViewFont = |
1153 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), | 1161 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), |
1154 | i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); | 1162 | i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); |
1155 | topLayout->addWidget(monthViewFont->label(),i,0); | 1163 | topLayout->addWidget(monthViewFont->label(),i,0); |
1156 | topLayout->addWidget(monthViewFont->preview(),i,1); | 1164 | topLayout->addWidget(monthViewFont->preview(),i,1); |
1157 | topLayout->addWidget(monthViewFont->button(),i,2); | 1165 | topLayout->addWidget(monthViewFont->button(),i,2); |
1158 | ++i; | 1166 | ++i; |
1159 | 1167 | ||
1160 | 1168 | ||
1161 | KPrefsDialogWidFont *lVFont = | 1169 | KPrefsDialogWidFont *lVFont = |
1162 | addWidFont(i18n("Event"),i18n("List View:"), | 1170 | addWidFont(i18n("Event"),i18n("List View:"), |
1163 | &(KOPrefs::instance()->mListViewFont),topFrame); | 1171 | &(KOPrefs::instance()->mListViewFont),topFrame); |
1164 | topLayout->addWidget(lVFont->label(),i,0); | 1172 | topLayout->addWidget(lVFont->label(),i,0); |
1165 | topLayout->addWidget(lVFont->preview(),i,1); | 1173 | topLayout->addWidget(lVFont->preview(),i,1); |
1166 | topLayout->addWidget(lVFont->button(),i,2); | 1174 | topLayout->addWidget(lVFont->button(),i,2); |
1167 | ++i; | 1175 | ++i; |
1168 | 1176 | ||
1169 | 1177 | ||
1170 | tVFont = | 1178 | tVFont = |
1171 | addWidFont(i18n("ToDo"),i18n("ToDoView:"), | 1179 | addWidFont(i18n("ToDo"),i18n("ToDoView:"), |
1172 | &(KOPrefs::instance()->mTodoViewFont),topFrame); | 1180 | &(KOPrefs::instance()->mTodoViewFont),topFrame); |
1173 | topLayout->addWidget(tVFont->label(),i,0); | 1181 | topLayout->addWidget(tVFont->label(),i,0); |
1174 | topLayout->addWidget(tVFont->preview(),i,1); | 1182 | topLayout->addWidget(tVFont->preview(),i,1); |
1175 | topLayout->addWidget(tVFont->button(),i,2); | 1183 | topLayout->addWidget(tVFont->button(),i,2); |
1176 | ++i; | 1184 | ++i; |
1177 | 1185 | ||
1178 | 1186 | ||
1179 | tVFont = | 1187 | tVFont = |
1180 | addWidFont(i18n("Today"),i18n("JournalView:"), | 1188 | addWidFont(i18n("Today"),i18n("JournalView:"), |
1181 | &(KOPrefs::instance()->mJornalViewFont),topFrame); | 1189 | &(KOPrefs::instance()->mJornalViewFont),topFrame); |
1182 | topLayout->addWidget(tVFont->label(),i,0); | 1190 | topLayout->addWidget(tVFont->label(),i,0); |
1183 | topLayout->addWidget(tVFont->preview(),i,1); | 1191 | topLayout->addWidget(tVFont->preview(),i,1); |
1184 | topLayout->addWidget(tVFont->button(),i,2); | 1192 | topLayout->addWidget(tVFont->button(),i,2); |
1185 | ++i; | 1193 | ++i; |
1186 | 1194 | ||
1187 | 1195 | ||
1188 | 1196 | ||
1189 | 1197 | ||
1190 | topLayout->setColStretch(1,1); | 1198 | topLayout->setColStretch(1,1); |
1191 | topLayout->setRowStretch(4,1); | 1199 | topLayout->setRowStretch(4,1); |
1192 | 1200 | ||
1193 | 1201 | ||
1194 | 1202 | ||
1195 | 1203 | ||
1196 | } | 1204 | } |
1197 | 1205 | ||
1198 | void KOPrefsDialog::setupColorsTab() | 1206 | void KOPrefsDialog::setupColorsTab() |
1199 | { | 1207 | { |
1200 | QFrame *topFrame = addPage(i18n("Colors"),0,0); | 1208 | QFrame *topFrame = addPage(i18n("Colors"),0,0); |
1201 | // DesktopIcon("colorize",KIcon::SizeMedium)); | 1209 | // DesktopIcon("colorize",KIcon::SizeMedium)); |
1202 | 1210 | ||
1203 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | 1211 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); |
1204 | // topLayout->setSpacing(mSpacingHint); | 1212 | // topLayout->setSpacing(mSpacingHint); |
1205 | // topLayout->setMargin(mMarginHint); | 1213 | // topLayout->setMargin(mMarginHint); |
1206 | 1214 | ||
1207 | topLayout->setSpacing(2); | 1215 | topLayout->setSpacing(2); |
1208 | topLayout->setMargin(3); | 1216 | topLayout->setMargin(3); |
1209 | 1217 | ||
1210 | int ii = 1; | 1218 | int ii = 1; |
1211 | QGroupBox *categoryGroup ; | 1219 | QGroupBox *categoryGroup ; |
1212 | 1220 | ||
1213 | categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), | 1221 | categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), |
1214 | topFrame); | 1222 | topFrame); |
1215 | topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); | 1223 | topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); |
1216 | 1224 | ||
1217 | mCategoryCombo = new QComboBox(categoryGroup); | 1225 | mCategoryCombo = new QComboBox(categoryGroup); |
1218 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); | 1226 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); |
1219 | connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); | 1227 | connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); |
1220 | 1228 | ||
1221 | mCategoryButton = new KColorButton(categoryGroup); | 1229 | mCategoryButton = new KColorButton(categoryGroup); |
1222 | connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); | 1230 | connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); |
1223 | updateCategoryColor(); | 1231 | updateCategoryColor(); |
1224 | 1232 | ||
1225 | 1233 | ||
1226 | // Holiday Color | 1234 | // Holiday Color |
1227 | 1235 | ||
1228 | KPrefsDialogWidColor *holidayColor = | 1236 | KPrefsDialogWidColor *holidayColor = |
1229 | addWidColor(i18n("Holiday color:"), | 1237 | addWidColor(i18n("Holiday color:"), |
1230 | &(KOPrefs::instance()->mHolidayColor),topFrame); | 1238 | &(KOPrefs::instance()->mHolidayColor),topFrame); |
1231 | topLayout->addWidget(holidayColor->label(),ii,0); | 1239 | topLayout->addWidget(holidayColor->label(),ii,0); |
1232 | topLayout->addWidget(holidayColor->button(),ii++,1); | 1240 | topLayout->addWidget(holidayColor->button(),ii++,1); |
1233 | 1241 | ||
1234 | // Highlight Color | 1242 | // Highlight Color |
1235 | KPrefsDialogWidColor *highlightColor = | 1243 | KPrefsDialogWidColor *highlightColor = |
1236 | addWidColor(i18n("Highlight color:"), | 1244 | addWidColor(i18n("Highlight color:"), |
1237 | &(KOPrefs::instance()->mHighlightColor),topFrame); | 1245 | &(KOPrefs::instance()->mHighlightColor),topFrame); |
1238 | topLayout->addWidget(highlightColor->label(),ii,0); | 1246 | topLayout->addWidget(highlightColor->label(),ii,0); |
1239 | topLayout->addWidget(highlightColor->button(),ii++,1); | 1247 | topLayout->addWidget(highlightColor->button(),ii++,1); |
1240 | 1248 | ||
1241 | // Event color | 1249 | // Event color |
1242 | KPrefsDialogWidColor *eventColor = | 1250 | KPrefsDialogWidColor *eventColor = |
1243 | addWidColor(i18n("Default event color:"), | 1251 | addWidColor(i18n("Default event color:"), |
1244 | &(KOPrefs::instance()->mEventColor),topFrame); | 1252 | &(KOPrefs::instance()->mEventColor),topFrame); |
1245 | topLayout->addWidget(eventColor->label(),ii,0); | 1253 | topLayout->addWidget(eventColor->label(),ii,0); |
1246 | topLayout->addWidget(eventColor->button(),ii++,1); | 1254 | topLayout->addWidget(eventColor->button(),ii++,1); |
1247 | eventColor = | 1255 | eventColor = |
1248 | addWidColor(i18n("Default todo done color:"), | 1256 | addWidColor(i18n("Default todo done color:"), |
1249 | &(KOPrefs::instance()->mTodoDoneColor),topFrame); | 1257 | &(KOPrefs::instance()->mTodoDoneColor),topFrame); |
1250 | topLayout->addWidget(eventColor->label(),ii,0); | 1258 | topLayout->addWidget(eventColor->label(),ii,0); |
1251 | topLayout->addWidget(eventColor->button(),ii++,1); | 1259 | topLayout->addWidget(eventColor->button(),ii++,1); |
1252 | 1260 | ||
1253 | 1261 | ||
1254 | // agenda view background color | 1262 | // agenda view background color |
1255 | KPrefsDialogWidColor *agendaBgColor = | 1263 | KPrefsDialogWidColor *agendaBgColor = |
1256 | addWidColor(i18n("Agenda view background color:"), | 1264 | addWidColor(i18n("Agenda view background color:"), |
1257 | &(KOPrefs::instance()->mAgendaBgColor),topFrame); | 1265 | &(KOPrefs::instance()->mAgendaBgColor),topFrame); |
1258 | topLayout->addWidget(agendaBgColor->label(),ii,0); | 1266 | topLayout->addWidget(agendaBgColor->label(),ii,0); |
1259 | topLayout->addWidget(agendaBgColor->button(),ii++,1); | 1267 | topLayout->addWidget(agendaBgColor->button(),ii++,1); |
1260 | 1268 | ||
1261 | // working hours color | 1269 | // working hours color |
1262 | KPrefsDialogWidColor *workingHoursColor = | 1270 | KPrefsDialogWidColor *workingHoursColor = |
1263 | addWidColor(i18n("Working hours color:"), | 1271 | addWidColor(i18n("Working hours color:"), |
1264 | &(KOPrefs::instance()->mWorkingHoursColor),topFrame); | 1272 | &(KOPrefs::instance()->mWorkingHoursColor),topFrame); |
1265 | topLayout->addWidget(workingHoursColor->label(),ii,0); | 1273 | topLayout->addWidget(workingHoursColor->label(),ii,0); |
1266 | topLayout->addWidget(workingHoursColor->button(),ii++,1); | 1274 | topLayout->addWidget(workingHoursColor->button(),ii++,1); |
1267 | 1275 | ||
1268 | KPrefsDialogWidBool *sb = | 1276 | KPrefsDialogWidBool *sb = |
1269 | addWidBool(i18n("Use colors for application:"), | 1277 | addWidBool(i18n("Use colors for application:"), |
1270 | &(KOPrefs::instance()->mUseAppColors),topFrame); | 1278 | &(KOPrefs::instance()->mUseAppColors),topFrame); |
1271 | topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); | 1279 | topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); |
1272 | 1280 | ||
1273 | ii++; | 1281 | ii++; |
1274 | KPrefsDialogWidColor * workingHoursColor1 = | 1282 | KPrefsDialogWidColor * workingHoursColor1 = |
1275 | addWidColor(i18n("Buttons, menus, etc.:"), | 1283 | addWidColor(i18n("Buttons, menus, etc.:"), |
1276 | &(KOPrefs::instance()->mAppColor1),topFrame); | 1284 | &(KOPrefs::instance()->mAppColor1),topFrame); |
1277 | topLayout->addWidget(workingHoursColor1->label(),ii,0); | 1285 | topLayout->addWidget(workingHoursColor1->label(),ii,0); |
1278 | topLayout->addWidget(workingHoursColor1->button(),ii++,1); | 1286 | topLayout->addWidget(workingHoursColor1->button(),ii++,1); |
1279 | 1287 | ||
1280 | KPrefsDialogWidColor * workingHoursColor2 = | 1288 | KPrefsDialogWidColor * workingHoursColor2 = |
1281 | addWidColor(i18n("Frames, labels, etc.:"), | 1289 | addWidColor(i18n("Frames, labels, etc.:"), |
1282 | &(KOPrefs::instance()->mAppColor2),topFrame); | 1290 | &(KOPrefs::instance()->mAppColor2),topFrame); |
1283 | topLayout->addWidget(workingHoursColor2->label(),ii,0); | 1291 | topLayout->addWidget(workingHoursColor2->label(),ii,0); |
1284 | topLayout->addWidget(workingHoursColor2->button(),ii++,1); | 1292 | topLayout->addWidget(workingHoursColor2->button(),ii++,1); |
1285 | 1293 | ||
1286 | 1294 | ||
1287 | 1295 | ||
1288 | } | 1296 | } |
1289 | 1297 | ||
1290 | void KOPrefsDialog::setCategoryColor() | 1298 | void KOPrefsDialog::setCategoryColor() |
1291 | { | 1299 | { |
1292 | mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); | 1300 | mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); |
1293 | } | 1301 | } |
1294 | 1302 | ||
1295 | void KOPrefsDialog::updateCategoryColor() | 1303 | void KOPrefsDialog::updateCategoryColor() |
1296 | { | 1304 | { |
1297 | QString cat = mCategoryCombo->currentText(); | 1305 | QString cat = mCategoryCombo->currentText(); |
1298 | QColor *color = mCategoryDict.find(cat); | 1306 | QColor *color = mCategoryDict.find(cat); |
1299 | if (!color) { | 1307 | if (!color) { |
1300 | color = KOPrefs::instance()->categoryColor(cat); | 1308 | color = KOPrefs::instance()->categoryColor(cat); |
1301 | } | 1309 | } |
1302 | if (color) { | 1310 | if (color) { |
1303 | mCategoryButton->setColor(*color); | 1311 | mCategoryButton->setColor(*color); |
1304 | } | 1312 | } |
1305 | } | 1313 | } |
1306 | 1314 | ||
1307 | void KOPrefsDialog::setupPrinterTab() | 1315 | void KOPrefsDialog::setupPrinterTab() |
1308 | { | 1316 | { |
1309 | mPrinterTab = addPage(i18n("Printing"),0, | 1317 | mPrinterTab = addPage(i18n("Printing"),0, |
1310 | DesktopIcon("fileprint",KIcon::SizeMedium)); | 1318 | DesktopIcon("fileprint",KIcon::SizeMedium)); |
1311 | 1319 | ||
1312 | QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); | 1320 | QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); |
1313 | topLayout->setSpacing(mSpacingHint); | 1321 | topLayout->setSpacing(mSpacingHint); |
1314 | topLayout->setMargin(mMarginHint); | 1322 | topLayout->setMargin(mMarginHint); |
1315 | 1323 | ||
1316 | topLayout->setRowStretch(4,1); | 1324 | topLayout->setRowStretch(4,1); |
1317 | } | 1325 | } |
1318 | 1326 | ||
1319 | void KOPrefsDialog::setupGroupSchedulingTab() | 1327 | void KOPrefsDialog::setupGroupSchedulingTab() |
1320 | { | 1328 | { |
1321 | #if 0 | 1329 | #if 0 |
1322 | QFrame *topFrame = addPage(i18n("Group Scheduling"),0, | 1330 | QFrame *topFrame = addPage(i18n("Group Scheduling"),0, |
1323 | DesktopIcon("personal",KIcon::SizeMedium)); | 1331 | DesktopIcon("personal",KIcon::SizeMedium)); |
1324 | 1332 | ||
1325 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 1333 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
1326 | topLayout->setSpacing(mSpacingHint); | 1334 | topLayout->setSpacing(mSpacingHint); |
1327 | topLayout->setMargin(mMarginHint); | 1335 | topLayout->setMargin(mMarginHint); |
1328 | 1336 | ||
1329 | #if 0 | 1337 | #if 0 |
1330 | KPrefsDialogWidRadios *schedulerGroup = | 1338 | KPrefsDialogWidRadios *schedulerGroup = |
1331 | addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), | 1339 | addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), |
1332 | topFrame); | 1340 | topFrame); |
1333 | schedulerGroup->addRadio("Dummy"); // Only for debugging | 1341 | schedulerGroup->addRadio("Dummy"); // Only for debugging |
1334 | schedulerGroup->addRadio(i18n("Mail client")); | 1342 | schedulerGroup->addRadio(i18n("Mail client")); |
1335 | 1343 | ||
1336 | topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); | 1344 | topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); |
1337 | #endif | 1345 | #endif |
1338 | 1346 | ||
1339 | KPrefsDialogWidRadios *sendGroup = | 1347 | KPrefsDialogWidRadios *sendGroup = |
1340 | addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), | 1348 | addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), |
1341 | topFrame); | 1349 | topFrame); |
1342 | sendGroup->addRadio(i18n("Send to outbox")); | 1350 | sendGroup->addRadio(i18n("Send to outbox")); |
1343 | sendGroup->addRadio(i18n("Send directly")); | 1351 | sendGroup->addRadio(i18n("Send directly")); |
1344 | 1352 | ||
1345 | topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); | 1353 | topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); |
1346 | 1354 | ||
1347 | topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); | 1355 | topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); |
1348 | mAMails = new QListView(topFrame); | 1356 | mAMails = new QListView(topFrame); |
1349 | mAMails->addColumn(i18n("Email"),300); | 1357 | mAMails->addColumn(i18n("Email"),300); |
1350 | topLayout->addMultiCellWidget(mAMails,3,3,0,1); | 1358 | topLayout->addMultiCellWidget(mAMails,3,3,0,1); |
1351 | 1359 | ||
1352 | topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); | 1360 | topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); |
1353 | aEmailsEdit = new QLineEdit(topFrame); | 1361 | aEmailsEdit = new QLineEdit(topFrame); |
1354 | aEmailsEdit->setEnabled(false); | 1362 | aEmailsEdit->setEnabled(false); |
1355 | topLayout->addWidget(aEmailsEdit,4,1); | 1363 | topLayout->addWidget(aEmailsEdit,4,1); |
1356 | 1364 | ||
1357 | QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); | 1365 | QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); |
1358 | topLayout->addWidget(add,5,0); | 1366 | topLayout->addWidget(add,5,0); |
1359 | QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); | 1367 | QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); |
1360 | topLayout->addWidget(del,5,1); | 1368 | topLayout->addWidget(del,5,1); |
1361 | 1369 | ||
1362 | //topLayout->setRowStretch(2,1); | 1370 | //topLayout->setRowStretch(2,1); |
1363 | connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); | 1371 | connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); |
1364 | connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); | 1372 | connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); |
1365 | connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); | 1373 | connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); |
1366 | connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); | 1374 | connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); |
1367 | #endif | 1375 | #endif |
1368 | } | 1376 | } |
1369 | 1377 | ||
1370 | void KOPrefsDialog::setupGroupAutomationTab() | 1378 | void KOPrefsDialog::setupGroupAutomationTab() |
1371 | { | 1379 | { |
1372 | return; | 1380 | return; |
1373 | QFrame *topFrame = addPage(i18n("Group Automation"),0, | 1381 | QFrame *topFrame = addPage(i18n("Group Automation"),0, |
1374 | DesktopIcon("personal",KIcon::SizeMedium)); | 1382 | DesktopIcon("personal",KIcon::SizeMedium)); |
1375 | 1383 | ||
1376 | QGridLayout *topLayout = new QGridLayout(topFrame,5,1); | 1384 | QGridLayout *topLayout = new QGridLayout(topFrame,5,1); |
1377 | topLayout->setSpacing(mSpacingHint); | 1385 | topLayout->setSpacing(mSpacingHint); |
1378 | topLayout->setMargin(mMarginHint); | 1386 | topLayout->setMargin(mMarginHint); |
1379 | 1387 | ||
1380 | KPrefsDialogWidRadios *autoRefreshGroup = | 1388 | KPrefsDialogWidRadios *autoRefreshGroup = |
1381 | addWidRadios(i18n("Auto Send Refresh"), | 1389 | addWidRadios(i18n("Auto Send Refresh"), |
1382 | &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); | 1390 | &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); |
1383 | autoRefreshGroup->addRadio(i18n("Never")); | 1391 | autoRefreshGroup->addRadio(i18n("Never")); |
1384 | autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); | 1392 | autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); |
1385 | //autoRefreshGroup->addRadio(i18n("selected emails")); | 1393 | //autoRefreshGroup->addRadio(i18n("selected emails")); |
1386 | topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); | 1394 | topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); |
1387 | 1395 | ||
1388 | KPrefsDialogWidRadios *autoInsertGroup = | 1396 | KPrefsDialogWidRadios *autoInsertGroup = |
1389 | addWidRadios(i18n("Auto Insert IMIP Replies"), | 1397 | addWidRadios(i18n("Auto Insert IMIP Replies"), |
1390 | &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); | 1398 | &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); |
1391 | autoInsertGroup->addRadio(i18n("Never")); | 1399 | autoInsertGroup->addRadio(i18n("Never")); |
1392 | autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); | 1400 | autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); |
1393 | //autoInsertGroup->addRadio(i18n("selected emails")); | 1401 | //autoInsertGroup->addRadio(i18n("selected emails")); |
1394 | topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); | 1402 | topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); |
1395 | 1403 | ||
1396 | KPrefsDialogWidRadios *autoRequestGroup = | 1404 | KPrefsDialogWidRadios *autoRequestGroup = |
1397 | addWidRadios(i18n("Auto Insert IMIP Requests"), | 1405 | addWidRadios(i18n("Auto Insert IMIP Requests"), |
1398 | &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); | 1406 | &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); |
1399 | autoRequestGroup->addRadio(i18n("Never")); | 1407 | autoRequestGroup->addRadio(i18n("Never")); |
1400 | autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); | 1408 | autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); |
1401 | //autoInsertGroup->addRadio(i18n("selected emails")); | 1409 | //autoInsertGroup->addRadio(i18n("selected emails")); |
1402 | topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); | 1410 | topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); |
1403 | 1411 | ||
1404 | KPrefsDialogWidRadios *autoFreeBusyGroup = | 1412 | KPrefsDialogWidRadios *autoFreeBusyGroup = |
1405 | addWidRadios(i18n("Auto Send FreeBusy Information"), | 1413 | addWidRadios(i18n("Auto Send FreeBusy Information"), |
1406 | &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); | 1414 | &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); |
1407 | autoFreeBusyGroup->addRadio(i18n("Never")); | 1415 | autoFreeBusyGroup->addRadio(i18n("Never")); |
1408 | autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); | 1416 | autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); |
1409 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); | 1417 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); |
1410 | topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); | 1418 | topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); |
1411 | 1419 | ||
1412 | KPrefsDialogWidRadios *autoFreeBusyReplyGroup = | 1420 | KPrefsDialogWidRadios *autoFreeBusyReplyGroup = |
1413 | addWidRadios(i18n("Auto Save FreeBusy Replies"), | 1421 | addWidRadios(i18n("Auto Save FreeBusy Replies"), |
1414 | &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); | 1422 | &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); |
1415 | autoFreeBusyReplyGroup->addRadio(i18n("Never")); | 1423 | autoFreeBusyReplyGroup->addRadio(i18n("Never")); |
1416 | autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); | 1424 | autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); |
1417 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); | 1425 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); |
1418 | topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); | 1426 | topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); |
1419 | } | 1427 | } |
1420 | 1428 | ||
1421 | void KOPrefsDialog::showPrinterTab() | 1429 | void KOPrefsDialog::showPrinterTab() |
1422 | { | 1430 | { |
1423 | showPage(pageIndex(mPrinterTab)); | 1431 | showPage(pageIndex(mPrinterTab)); |
1424 | } | 1432 | } |
1425 | 1433 | ||
1426 | 1434 | ||
1427 | void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, | 1435 | void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, |
1428 | const QStringList *tags) | 1436 | const QStringList *tags) |
1429 | { | 1437 | { |
1430 | if (tags) { | 1438 | if (tags) { |
1431 | int i = tags->findIndex(text); | 1439 | int i = tags->findIndex(text); |
1432 | if (i > 0) combo->setCurrentItem(i); | 1440 | if (i > 0) combo->setCurrentItem(i); |
1433 | } else { | 1441 | } else { |
1434 | for(int i=0;i<combo->count();++i) { | 1442 | for(int i=0;i<combo->count();++i) { |
1435 | if (combo->text(i) == text) { | 1443 | if (combo->text(i) == text) { |
1436 | combo->setCurrentItem(i); | 1444 | combo->setCurrentItem(i); |
1437 | break; | 1445 | break; |
1438 | } | 1446 | } |
1439 | } | 1447 | } |
1440 | } | 1448 | } |
1441 | } | 1449 | } |
1442 | 1450 | ||
1443 | void KOPrefsDialog::usrReadConfig() | 1451 | void KOPrefsDialog::usrReadConfig() |
1444 | { | 1452 | { |
1445 | kdelibcfg->readConfig(); | 1453 | kdelibcfg->readConfig(); |
1446 | mNameEdit->setText(KOPrefs::instance()->fullName()); | 1454 | mNameEdit->setText(KOPrefs::instance()->fullName()); |
1447 | mEmailEdit->setText(KOPrefs::instance()->email()); | 1455 | mEmailEdit->setText(KOPrefs::instance()->email()); |
1448 | 1456 | ||
1449 | mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); | 1457 | mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 9b5d4ce..7817a75 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -74,1396 +74,1397 @@ private: | |||
74 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, | 74 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, |
75 | const char *name) : | 75 | const char *name) : |
76 | KListView(parent,name) | 76 | KListView(parent,name) |
77 | { | 77 | { |
78 | mName = QString ( name ); | 78 | mName = QString ( name ); |
79 | mCalendar = calendar; | 79 | mCalendar = calendar; |
80 | #ifndef DESKTOP_VERSION | 80 | #ifndef DESKTOP_VERSION |
81 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 81 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
82 | #endif | 82 | #endif |
83 | mOldCurrent = 0; | 83 | mOldCurrent = 0; |
84 | mMousePressed = false; | 84 | mMousePressed = false; |
85 | 85 | ||
86 | setAcceptDrops(true); | 86 | setAcceptDrops(true); |
87 | viewport()->setAcceptDrops(true); | 87 | viewport()->setAcceptDrops(true); |
88 | int size = 16; | 88 | int size = 16; |
89 | if (qApp->desktop()->width() < 300 ) | 89 | if (qApp->desktop()->width() < 300 ) |
90 | size = 12; | 90 | size = 12; |
91 | setTreeStepSize( size + 6 ); | 91 | setTreeStepSize( size + 6 ); |
92 | 92 | ||
93 | } | 93 | } |
94 | 94 | ||
95 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) | 95 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) |
96 | { | 96 | { |
97 | #ifndef KORG_NODND | 97 | #ifndef KORG_NODND |
98 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; | 98 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; |
99 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 99 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
100 | !QTextDrag::canDecode( e ) ) { | 100 | !QTextDrag::canDecode( e ) ) { |
101 | e->ignore(); | 101 | e->ignore(); |
102 | return; | 102 | return; |
103 | } | 103 | } |
104 | 104 | ||
105 | mOldCurrent = currentItem(); | 105 | mOldCurrent = currentItem(); |
106 | #endif | 106 | #endif |
107 | } | 107 | } |
108 | 108 | ||
109 | 109 | ||
110 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) | 110 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) |
111 | { | 111 | { |
112 | #ifndef KORG_NODND | 112 | #ifndef KORG_NODND |
113 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; | 113 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; |
114 | 114 | ||
115 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 115 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
116 | !QTextDrag::canDecode( e ) ) { | 116 | !QTextDrag::canDecode( e ) ) { |
117 | e->ignore(); | 117 | e->ignore(); |
118 | return; | 118 | return; |
119 | } | 119 | } |
120 | 120 | ||
121 | e->accept(); | 121 | e->accept(); |
122 | #endif | 122 | #endif |
123 | } | 123 | } |
124 | 124 | ||
125 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) | 125 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) |
126 | { | 126 | { |
127 | #ifndef KORG_NODND | 127 | #ifndef KORG_NODND |
128 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; | 128 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; |
129 | 129 | ||
130 | setCurrentItem(mOldCurrent); | 130 | setCurrentItem(mOldCurrent); |
131 | setSelected(mOldCurrent,true); | 131 | setSelected(mOldCurrent,true); |
132 | #endif | 132 | #endif |
133 | } | 133 | } |
134 | 134 | ||
135 | void KOTodoListView::contentsDropEvent(QDropEvent *e) | 135 | void KOTodoListView::contentsDropEvent(QDropEvent *e) |
136 | { | 136 | { |
137 | #ifndef KORG_NODND | 137 | #ifndef KORG_NODND |
138 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; | 138 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; |
139 | 139 | ||
140 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 140 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
141 | !QTextDrag::canDecode( e ) ) { | 141 | !QTextDrag::canDecode( e ) ) { |
142 | e->ignore(); | 142 | e->ignore(); |
143 | return; | 143 | return; |
144 | } | 144 | } |
145 | 145 | ||
146 | DndFactory factory( mCalendar ); | 146 | DndFactory factory( mCalendar ); |
147 | Todo *todo = factory.createDropTodo(e); | 147 | Todo *todo = factory.createDropTodo(e); |
148 | 148 | ||
149 | if (todo) { | 149 | if (todo) { |
150 | e->acceptAction(); | 150 | e->acceptAction(); |
151 | 151 | ||
152 | KOTodoViewItem *destination = | 152 | KOTodoViewItem *destination = |
153 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); | 153 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); |
154 | Todo *destinationEvent = 0; | 154 | Todo *destinationEvent = 0; |
155 | if (destination) destinationEvent = destination->todo(); | 155 | if (destination) destinationEvent = destination->todo(); |
156 | 156 | ||
157 | Todo *existingTodo = mCalendar->todo(todo->uid()); | 157 | Todo *existingTodo = mCalendar->todo(todo->uid()); |
158 | 158 | ||
159 | if(existingTodo) { | 159 | if(existingTodo) { |
160 | Incidence *to = destinationEvent; | 160 | Incidence *to = destinationEvent; |
161 | while(to) { | 161 | while(to) { |
162 | if (to->uid() == todo->uid()) { | 162 | if (to->uid() == todo->uid()) { |
163 | KMessageBox::sorry(this, | 163 | KMessageBox::sorry(this, |
164 | i18n("Cannot move To-Do to itself\nor a child of itself"), | 164 | i18n("Cannot move To-Do to itself\nor a child of itself"), |
165 | i18n("Drop To-Do")); | 165 | i18n("Drop To-Do")); |
166 | delete todo; | 166 | delete todo; |
167 | return; | 167 | return; |
168 | } | 168 | } |
169 | to = to->relatedTo(); | 169 | to = to->relatedTo(); |
170 | } | 170 | } |
171 | internalDrop = true; | 171 | internalDrop = true; |
172 | if ( destinationEvent ) | 172 | if ( destinationEvent ) |
173 | reparentTodoSignal( destinationEvent, existingTodo ); | 173 | reparentTodoSignal( destinationEvent, existingTodo ); |
174 | else | 174 | else |
175 | unparentTodoSignal(existingTodo); | 175 | unparentTodoSignal(existingTodo); |
176 | delete todo; | 176 | delete todo; |
177 | } else { | 177 | } else { |
178 | mCalendar->addTodo(todo); | 178 | mCalendar->addTodo(todo); |
179 | emit todoDropped(todo, KOGlobals::EVENTADDED); | 179 | emit todoDropped(todo, KOGlobals::EVENTADDED); |
180 | if ( destinationEvent ) | 180 | if ( destinationEvent ) |
181 | reparentTodoSignal( destinationEvent, todo ); | 181 | reparentTodoSignal( destinationEvent, todo ); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | else { | 184 | else { |
185 | QString text; | 185 | QString text; |
186 | if (QTextDrag::decode(e,text)) { | 186 | if (QTextDrag::decode(e,text)) { |
187 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); | 187 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); |
188 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); | 188 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); |
189 | qDebug("Dropped : " + text); | 189 | qDebug("Dropped : " + text); |
190 | QStringList emails = QStringList::split(",",text); | 190 | QStringList emails = QStringList::split(",",text); |
191 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 191 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
192 | int pos = (*it).find("<"); | 192 | int pos = (*it).find("<"); |
193 | QString name = (*it).left(pos); | 193 | QString name = (*it).left(pos); |
194 | QString email = (*it).mid(pos); | 194 | QString email = (*it).mid(pos); |
195 | if (!email.isEmpty() && todoi) { | 195 | if (!email.isEmpty() && todoi) { |
196 | todoi->todo()->addAttendee(new Attendee(name,email)); | 196 | todoi->todo()->addAttendee(new Attendee(name,email)); |
197 | } | 197 | } |
198 | } | 198 | } |
199 | } | 199 | } |
200 | else { | 200 | else { |
201 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); | 201 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); |
202 | e->ignore(); | 202 | e->ignore(); |
203 | } | 203 | } |
204 | } | 204 | } |
205 | #endif | 205 | #endif |
206 | } | 206 | } |
207 | void KOTodoListView::wheelEvent (QWheelEvent *e) | 207 | void KOTodoListView::wheelEvent (QWheelEvent *e) |
208 | { | 208 | { |
209 | QListView::wheelEvent (e); | 209 | QListView::wheelEvent (e); |
210 | } | 210 | } |
211 | 211 | ||
212 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | 212 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) |
213 | { | 213 | { |
214 | 214 | ||
215 | QPoint p(contentsToViewport(e->pos())); | 215 | QPoint p(contentsToViewport(e->pos())); |
216 | QListViewItem *i = itemAt(p); | 216 | QListViewItem *i = itemAt(p); |
217 | bool rootClicked = true; | 217 | bool rootClicked = true; |
218 | if (i) { | 218 | if (i) { |
219 | // if the user clicked into the root decoration of the item, don't | 219 | // if the user clicked into the root decoration of the item, don't |
220 | // try to start a drag! | 220 | // try to start a drag! |
221 | int X = p.x(); | 221 | int X = p.x(); |
222 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); | 222 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); |
223 | if (X > header()->sectionPos(0) + | 223 | if (X > header()->sectionPos(0) + |
224 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + | 224 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + |
225 | itemMargin() +i->height()|| | 225 | itemMargin() +i->height()|| |
226 | X < header()->sectionPos(0)) { | 226 | X < header()->sectionPos(0)) { |
227 | rootClicked = false; | 227 | rootClicked = false; |
228 | } | 228 | } |
229 | } else { | 229 | } else { |
230 | rootClicked = false; | 230 | rootClicked = false; |
231 | } | 231 | } |
232 | #ifndef KORG_NODND | 232 | #ifndef KORG_NODND |
233 | mMousePressed = false; | 233 | mMousePressed = false; |
234 | if (! rootClicked && !( e->button() == RightButton) ) { | 234 | if (! rootClicked && !( e->button() == RightButton) ) { |
235 | mPressPos = e->pos(); | 235 | mPressPos = e->pos(); |
236 | mMousePressed = true; | 236 | mMousePressed = true; |
237 | } else { | 237 | } else { |
238 | mMousePressed = false; | 238 | mMousePressed = false; |
239 | } | 239 | } |
240 | #endif | 240 | #endif |
241 | //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); | 241 | //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); |
242 | #ifndef DESKTOP_VERSION | 242 | #ifndef DESKTOP_VERSION |
243 | if (!( e->button() == RightButton && rootClicked) ) | 243 | if (!( e->button() == RightButton && rootClicked) ) |
244 | QListView::contentsMousePressEvent(e); | 244 | QListView::contentsMousePressEvent(e); |
245 | #else | 245 | #else |
246 | QListView::contentsMousePressEvent(e); | 246 | QListView::contentsMousePressEvent(e); |
247 | #endif | 247 | #endif |
248 | } | 248 | } |
249 | void KOTodoListView::paintEvent(QPaintEvent* e) | 249 | void KOTodoListView::paintEvent(QPaintEvent* e) |
250 | { | 250 | { |
251 | emit paintNeeded(); | 251 | emit paintNeeded(); |
252 | QListView::paintEvent( e); | 252 | QListView::paintEvent( e); |
253 | } | 253 | } |
254 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) | 254 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) |
255 | { | 255 | { |
256 | 256 | ||
257 | #ifndef KORG_NODND | 257 | #ifndef KORG_NODND |
258 | //QListView::contentsMouseMoveEvent(e); | 258 | //QListView::contentsMouseMoveEvent(e); |
259 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > | 259 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > |
260 | QApplication::startDragDistance()*3) { | 260 | QApplication::startDragDistance()*3) { |
261 | mMousePressed = false; | 261 | mMousePressed = false; |
262 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); | 262 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); |
263 | if (item) { | 263 | if (item) { |
264 | DndFactory factory( mCalendar ); | 264 | DndFactory factory( mCalendar ); |
265 | ICalDrag *vd = factory.createDrag( | 265 | ICalDrag *vd = factory.createDrag( |
266 | ((KOTodoViewItem *)item)->todo(),viewport()); | 266 | ((KOTodoViewItem *)item)->todo(),viewport()); |
267 | internalDrop = false; | 267 | internalDrop = false; |
268 | // we cannot do any senseful here, because the DnD is still broken in Qt | 268 | // we cannot do any senseful here, because the DnD is still broken in Qt |
269 | if (vd->drag()) { | 269 | if (vd->drag()) { |
270 | if ( !internalDrop ) { | 270 | if ( !internalDrop ) { |
271 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); | 271 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); |
272 | qDebug("Dnd: External move: Delete drag source "); | 272 | qDebug("Dnd: External move: Delete drag source "); |
273 | } else | 273 | } else |
274 | qDebug("Dnd: Internal move "); | 274 | qDebug("Dnd: Internal move "); |
275 | 275 | ||
276 | } else { | 276 | } else { |
277 | if ( !internalDrop ) { | 277 | if ( !internalDrop ) { |
278 | qDebug("Dnd: External Copy"); | 278 | qDebug("Dnd: External Copy"); |
279 | } else | 279 | } else |
280 | qDebug("DnD: Internal copy: Copy pending"); | 280 | qDebug("DnD: Internal copy: Copy pending"); |
281 | } | 281 | } |
282 | } | 282 | } |
283 | } | 283 | } |
284 | #endif | 284 | #endif |
285 | } | 285 | } |
286 | void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) | 286 | void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) |
287 | { | 287 | { |
288 | if ( !e->isAutoRepeat() ) { | 288 | if ( !e->isAutoRepeat() ) { |
289 | mFlagKeyPressed = false; | 289 | mFlagKeyPressed = false; |
290 | } | 290 | } |
291 | } | 291 | } |
292 | 292 | ||
293 | 293 | ||
294 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | 294 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) |
295 | { | 295 | { |
296 | qApp->processEvents(); | 296 | qApp->processEvents(); |
297 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 297 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
298 | e->ignore(); | 298 | e->ignore(); |
299 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 299 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
300 | return; | 300 | return; |
301 | } | 301 | } |
302 | if (! e->isAutoRepeat() ) | 302 | if (! e->isAutoRepeat() ) |
303 | mFlagKeyPressed = true; | 303 | mFlagKeyPressed = true; |
304 | QListViewItem* cn; | 304 | QListViewItem* cn; |
305 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { | 305 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { |
306 | cn = currentItem(); | 306 | cn = currentItem(); |
307 | if ( cn ) { | 307 | if ( cn ) { |
308 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 308 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
309 | if ( ci ){ | 309 | if ( ci ){ |
310 | if ( e->state() == ShiftButton ) | 310 | if ( e->state() == ShiftButton ) |
311 | ci->setOn( false ); | 311 | ci->setOn( false ); |
312 | else | 312 | else |
313 | ci->setOn( true ); | 313 | ci->setOn( true ); |
314 | cn = cn->itemBelow(); | 314 | cn = cn->itemBelow(); |
315 | if ( cn ) { | 315 | if ( cn ) { |
316 | setCurrentItem ( cn ); | 316 | setCurrentItem ( cn ); |
317 | ensureItemVisible ( cn ); | 317 | ensureItemVisible ( cn ); |
318 | } | 318 | } |
319 | 319 | ||
320 | } | 320 | } |
321 | } | 321 | } |
322 | 322 | ||
323 | return; | 323 | return; |
324 | } | 324 | } |
325 | 325 | ||
326 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 326 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
327 | switch ( e->key() ) { | 327 | switch ( e->key() ) { |
328 | case Qt::Key_Down: | 328 | case Qt::Key_Down: |
329 | case Qt::Key_Up: | 329 | case Qt::Key_Up: |
330 | QListView::keyPressEvent ( e ); | 330 | QListView::keyPressEvent ( e ); |
331 | break; | 331 | break; |
332 | case Qt::Key_Left: | 332 | case Qt::Key_Left: |
333 | case Qt::Key_Right: | 333 | case Qt::Key_Right: |
334 | QListView::keyPressEvent ( e ); | 334 | QListView::keyPressEvent ( e ); |
335 | e->accept(); | 335 | e->accept(); |
336 | return; | 336 | return; |
337 | break; | 337 | break; |
338 | default: | 338 | default: |
339 | e->ignore(); | 339 | e->ignore(); |
340 | break; | 340 | break; |
341 | } | 341 | } |
342 | return; | 342 | return; |
343 | } | 343 | } |
344 | e->ignore(); | 344 | e->ignore(); |
345 | } | 345 | } |
346 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) | 346 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) |
347 | { | 347 | { |
348 | QListView::contentsMouseReleaseEvent(e); | 348 | QListView::contentsMouseReleaseEvent(e); |
349 | mMousePressed = false; | 349 | mMousePressed = false; |
350 | } | 350 | } |
351 | 351 | ||
352 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 352 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
353 | { | 353 | { |
354 | if (!e) return; | 354 | if (!e) return; |
355 | 355 | ||
356 | QPoint vp = contentsToViewport(e->pos()); | 356 | QPoint vp = contentsToViewport(e->pos()); |
357 | 357 | ||
358 | QListViewItem *item = itemAt(vp); | 358 | QListViewItem *item = itemAt(vp); |
359 | 359 | ||
360 | emit double_Clicked(item); | 360 | emit double_Clicked(item); |
361 | if (!item) return; | 361 | if (!item) return; |
362 | 362 | ||
363 | emit doubleClicked(item,vp,0); | 363 | emit doubleClicked(item,vp,0); |
364 | } | 364 | } |
365 | 365 | ||
366 | ///////////////////////////////////////////////////////////////////////////// | 366 | ///////////////////////////////////////////////////////////////////////////// |
367 | 367 | ||
368 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 368 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
369 | QLineEdit(parent) | 369 | QLineEdit(parent) |
370 | { | 370 | { |
371 | setText(i18n("Click to add a new Todo")); | 371 | setText(i18n("Click to add a new Todo")); |
372 | } | 372 | } |
373 | 373 | ||
374 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 374 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
375 | { | 375 | { |
376 | if ( text()==i18n("Click to add a new Todo") ) | 376 | if ( text()==i18n("Click to add a new Todo") ) |
377 | setText(""); | 377 | setText(""); |
378 | QLineEdit::focusInEvent(ev); | 378 | QLineEdit::focusInEvent(ev); |
379 | } | 379 | } |
380 | 380 | ||
381 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 381 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
382 | { | 382 | { |
383 | setText(i18n("Click to add a new Todo")); | 383 | setText(i18n("Click to add a new Todo")); |
384 | QLineEdit::focusOutEvent(ev); | 384 | QLineEdit::focusOutEvent(ev); |
385 | } | 385 | } |
386 | 386 | ||
387 | ///////////////////////////////////////////////////////////////////////////// | 387 | ///////////////////////////////////////////////////////////////////////////// |
388 | 388 | ||
389 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 389 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
390 | KOrg::BaseView(calendar,parent,name) | 390 | KOrg::BaseView(calendar,parent,name) |
391 | { | 391 | { |
392 | mPendingUpdateBeforeRepaint = false; | 392 | mPendingUpdateBeforeRepaint = false; |
393 | isFlatDisplay = false; | 393 | isFlatDisplay = false; |
394 | mNavigator = 0; | 394 | mNavigator = 0; |
395 | QBoxLayout *topLayout = new QVBoxLayout(this); | 395 | QBoxLayout *topLayout = new QVBoxLayout(this); |
396 | mName = QString ( name ); | 396 | mName = QString ( name ); |
397 | mBlockUpdate = false; | 397 | mBlockUpdate = false; |
398 | mQuickAdd = new KOQuickTodo(this); | 398 | mQuickAdd = new KOQuickTodo(this); |
399 | topLayout->addWidget(mQuickAdd); | 399 | topLayout->addWidget(mQuickAdd); |
400 | 400 | ||
401 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); | 401 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); |
402 | 402 | ||
403 | mTodoListView = new KOTodoListView(calendar,this, name ); | 403 | mTodoListView = new KOTodoListView(calendar,this, name ); |
404 | topLayout->addWidget(mTodoListView); | 404 | topLayout->addWidget(mTodoListView); |
405 | //mTodoListView->header()->setMaximumHeight(30); | 405 | //mTodoListView->header()->setMaximumHeight(30); |
406 | mTodoListView->setRootIsDecorated(true); | 406 | mTodoListView->setRootIsDecorated(true); |
407 | mTodoListView->setAllColumnsShowFocus(true); | 407 | mTodoListView->setAllColumnsShowFocus(true); |
408 | 408 | ||
409 | mTodoListView->setShowSortIndicator(true); | 409 | mTodoListView->setShowSortIndicator(true); |
410 | 410 | ||
411 | mTodoListView->addColumn(i18n("Todo")); | 411 | mTodoListView->addColumn(i18n("Todo")); |
412 | mTodoListView->addColumn(i18n("Prio")); | 412 | mTodoListView->addColumn(i18n("Prio")); |
413 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 413 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
414 | mTodoListView->addColumn(i18n("Complete")); | 414 | mTodoListView->addColumn(i18n("Complete")); |
415 | mTodoListView->setColumnAlignment(2,AlignCenter); | 415 | mTodoListView->setColumnAlignment(2,AlignCenter); |
416 | 416 | ||
417 | mTodoListView->addColumn(i18n("Due Date")); | 417 | mTodoListView->addColumn(i18n("Due Date")); |
418 | mTodoListView->setColumnAlignment(3,AlignLeft); | 418 | mTodoListView->setColumnAlignment(3,AlignLeft); |
419 | mTodoListView->addColumn(i18n("Due Time")); | 419 | mTodoListView->addColumn(i18n("Due Time")); |
420 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 420 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
421 | 421 | ||
422 | mTodoListView->addColumn(i18n("Start Date")); | 422 | mTodoListView->addColumn(i18n("Start Date")); |
423 | mTodoListView->setColumnAlignment(5,AlignLeft); | 423 | mTodoListView->setColumnAlignment(5,AlignLeft); |
424 | mTodoListView->addColumn(i18n("Start Time")); | 424 | mTodoListView->addColumn(i18n("Start Time")); |
425 | mTodoListView->setColumnAlignment(6,AlignHCenter); | 425 | mTodoListView->setColumnAlignment(6,AlignHCenter); |
426 | 426 | ||
427 | mTodoListView->addColumn(i18n("Cancelled")); | 427 | mTodoListView->addColumn(i18n("Cancelled")); |
428 | mTodoListView->addColumn(i18n("Categories")); | 428 | mTodoListView->addColumn(i18n("Categories")); |
429 | #if 0 | 429 | #if 0 |
430 | mTodoListView->addColumn(i18n("Sort Id")); | 430 | mTodoListView->addColumn(i18n("Sort Id")); |
431 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 431 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
432 | #endif | 432 | #endif |
433 | 433 | ||
434 | mTodoListView->setMinimumHeight( 60 ); | 434 | mTodoListView->setMinimumHeight( 60 ); |
435 | mTodoListView->setItemsRenameable( true ); | 435 | mTodoListView->setItemsRenameable( true ); |
436 | mTodoListView->setRenameable( 0 ); | 436 | mTodoListView->setRenameable( 0 ); |
437 | mTodoListView->setColumnWidth( 0, 120 ); | 437 | mTodoListView->setColumnWidth( 0, 120 ); |
438 | mTodoListView->setColumnWidthMode(0, QListView::Manual); | 438 | mTodoListView->setColumnWidthMode(0, QListView::Manual); |
439 | mTodoListView->setColumnWidthMode(1, QListView::Manual); | 439 | mTodoListView->setColumnWidthMode(1, QListView::Manual); |
440 | mTodoListView->setColumnWidthMode(2, QListView::Manual); | 440 | mTodoListView->setColumnWidthMode(2, QListView::Manual); |
441 | mTodoListView->setColumnWidthMode(3, QListView::Manual); | 441 | mTodoListView->setColumnWidthMode(3, QListView::Manual); |
442 | mTodoListView->setColumnWidthMode(4, QListView::Manual); | 442 | mTodoListView->setColumnWidthMode(4, QListView::Manual); |
443 | mTodoListView->setColumnWidthMode(5, QListView::Manual); | 443 | mTodoListView->setColumnWidthMode(5, QListView::Manual); |
444 | mTodoListView->setColumnWidthMode(6, QListView::Manual); | 444 | mTodoListView->setColumnWidthMode(6, QListView::Manual); |
445 | mTodoListView->setColumnWidthMode(7, QListView::Manual); | 445 | mTodoListView->setColumnWidthMode(7, QListView::Manual); |
446 | mTodoListView->setColumnWidthMode(8, QListView::Manual); | 446 | mTodoListView->setColumnWidthMode(8, QListView::Manual); |
447 | 447 | ||
448 | 448 | ||
449 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); | 449 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); |
450 | 450 | ||
451 | mPriorityPopupMenu = new QPopupMenu(this); | 451 | mPriorityPopupMenu = new QPopupMenu(this); |
452 | for (int i = 1; i <= 5; i++) { | 452 | for (int i = 1; i <= 5; i++) { |
453 | QString label = QString ("%1").arg (i); | 453 | QString label = QString ("%1").arg (i); |
454 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 454 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
455 | } | 455 | } |
456 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 456 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
457 | 457 | ||
458 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 458 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
459 | for (int i = 0; i <= 100; i+=20) { | 459 | for (int i = 0; i <= 100; i+=20) { |
460 | QString label = QString ("%1 %").arg (i); | 460 | QString label = QString ("%1 %").arg (i); |
461 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 461 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
462 | } | 462 | } |
463 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 463 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
464 | 464 | ||
465 | 465 | ||
466 | 466 | ||
467 | mItemPopupMenu = new QPopupMenu(this); | 467 | mItemPopupMenu = new QPopupMenu(this); |
468 | mItemPopupMenu->insertItem(i18n("Show..."), this, | 468 | mItemPopupMenu->insertItem(i18n("Show..."), this, |
469 | SLOT (showTodo())); | 469 | SLOT (showTodo())); |
470 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 470 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
471 | SLOT (editTodo())); | 471 | SLOT (editTodo())); |
472 | mItemPopupMenu->insertItem( i18n("Delete"), this, | 472 | mItemPopupMenu->insertItem( i18n("Delete"), this, |
473 | SLOT (deleteTodo())); | 473 | SLOT (deleteTodo())); |
474 | mItemPopupMenu->insertItem( i18n("Clone..."), this, | 474 | mItemPopupMenu->insertItem( i18n("Clone..."), this, |
475 | SLOT (cloneTodo())); | 475 | SLOT (cloneTodo())); |
476 | mItemPopupMenu->insertItem( i18n("Move..."), this, | 476 | mItemPopupMenu->insertItem( i18n("Move..."), this, |
477 | SLOT (moveTodo())); | 477 | SLOT (moveTodo())); |
478 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 478 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |
479 | SLOT (beamTodo())); | 479 | SLOT (beamTodo())); |
480 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 480 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
481 | SLOT (cancelTodo())); | 481 | SLOT (cancelTodo())); |
482 | mItemPopupMenu->insertSeparator(); | 482 | mItemPopupMenu->insertSeparator(); |
483 | 483 | ||
484 | mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, | 484 | mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, |
485 | SLOT (toggleRunningItem())); | 485 | SLOT (toggleRunningItem())); |
486 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, | 486 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, |
487 | SLOT (newTodo())); | 487 | SLOT (newTodo())); |
488 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, | 488 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, |
489 | SLOT (newSubTodo())); | 489 | SLOT (newSubTodo())); |
490 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 490 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
491 | SLOT (unparentTodo()),0,21); | 491 | SLOT (unparentTodo()),0,21); |
492 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, | 492 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, |
493 | SLOT (reparentTodo()),0,22); | 493 | SLOT (reparentTodo()),0,22); |
494 | mItemPopupMenu->insertSeparator(); | 494 | mItemPopupMenu->insertSeparator(); |
495 | #if 0 | 495 | #if 0 |
496 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), | 496 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), |
497 | this, SLOT( purgeCompleted() ) ); | 497 | this, SLOT( purgeCompleted() ) ); |
498 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 498 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
499 | this, SLOT( toggleCompleted() ),0, 33 ); | 499 | this, SLOT( toggleCompleted() ),0, 33 ); |
500 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 500 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
501 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 501 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
502 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 502 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
503 | this, SLOT( toggleRunning() ),0, 35 ); | 503 | this, SLOT( toggleRunning() ),0, 35 ); |
504 | 504 | ||
505 | #endif | 505 | #endif |
506 | mPopupMenu = new QPopupMenu(this); | 506 | mPopupMenu = new QPopupMenu(this); |
507 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 507 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
508 | SLOT (newTodo()),0,1); | 508 | SLOT (newTodo()),0,1); |
509 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), | 509 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), |
510 | this, SLOT(purgeCompleted()),0,2); | 510 | this, SLOT(purgeCompleted()),0,2); |
511 | mPopupMenu->insertItem(i18n("Show Completed"), | 511 | mPopupMenu->insertItem(i18n("Show Completed"), |
512 | this, SLOT( toggleCompleted() ),0,3 ); | 512 | this, SLOT( toggleCompleted() ),0,3 ); |
513 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 513 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
514 | this, SLOT( toggleQuickTodo() ),0,4 ); | 514 | this, SLOT( toggleQuickTodo() ),0,4 ); |
515 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 515 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
516 | this, SLOT( toggleRunning() ),0,5 ); | 516 | this, SLOT( toggleRunning() ),0,5 ); |
517 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), | 517 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), |
518 | this, SLOT( setAllOpen() ),0,6 ); | 518 | this, SLOT( setAllOpen() ),0,6 ); |
519 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), | 519 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), |
520 | this, SLOT( setAllClose() ),0,7 ); | 520 | this, SLOT( setAllClose() ),0,7 ); |
521 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), | 521 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), |
522 | this, SLOT( setAllFlat() ),0,8 ); | 522 | this, SLOT( setAllFlat() ),0,8 ); |
523 | mDocPrefs = new DocPrefs( name ); | 523 | mDocPrefs = new DocPrefs( name ); |
524 | 524 | ||
525 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); | 525 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); |
526 | mPopupMenu->setCheckable( true ); | 526 | mPopupMenu->setCheckable( true ); |
527 | mItemPopupMenu->setCheckable( true ); | 527 | mItemPopupMenu->setCheckable( true ); |
528 | 528 | ||
529 | 529 | ||
530 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 530 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
531 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 531 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
532 | 532 | ||
533 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 533 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
534 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 534 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
535 | 535 | ||
536 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 536 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
537 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 537 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
538 | 538 | ||
539 | 539 | ||
540 | // Double clicking conflicts with opening/closing the subtree | 540 | // Double clicking conflicts with opening/closing the subtree |
541 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 541 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), |
542 | SLOT( editItem( QListViewItem *) ) ); | 542 | SLOT( editItem( QListViewItem *) ) ); |
543 | /* | 543 | /* |
544 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 544 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
545 | const QPoint &,int ) ), | 545 | const QPoint &,int ) ), |
546 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 546 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
547 | */ | 547 | */ |
548 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, | 548 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, |
549 | const QPoint &,int ) ), | 549 | const QPoint &,int ) ), |
550 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 550 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
551 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 551 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), |
552 | SLOT( itemClicked( QListViewItem * ) ) ); | 552 | SLOT( itemClicked( QListViewItem * ) ) ); |
553 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 553 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), |
554 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 554 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); |
555 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 555 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
556 | SLOT( updateView() ) ); | 556 | SLOT( updateView() ) ); |
557 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 557 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
558 | SLOT( todoModified(Todo *, int) ) ); | 558 | SLOT( todoModified(Todo *, int) ) ); |
559 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 559 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), |
560 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 560 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
561 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 561 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
562 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 562 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
563 | connect( mTodoListView, SIGNAL( paintNeeded() ), | 563 | connect( mTodoListView, SIGNAL( paintNeeded() ), |
564 | SLOT( paintNeeded()) ); | 564 | SLOT( paintNeeded()) ); |
565 | 565 | ||
566 | #if 0 | 566 | #if 0 |
567 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 567 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
568 | SLOT(selectionChanged(QListViewItem *))); | 568 | SLOT(selectionChanged(QListViewItem *))); |
569 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 569 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), |
570 | SLOT(selectionChanged(QListViewItem *))); | 570 | SLOT(selectionChanged(QListViewItem *))); |
571 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 571 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), |
572 | SLOT(selectionChanged(QListViewItem *))); | 572 | SLOT(selectionChanged(QListViewItem *))); |
573 | #endif | 573 | #endif |
574 | 574 | ||
575 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); | 575 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); |
576 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); | 576 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); |
577 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); | 577 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); |
578 | 578 | ||
579 | connect( mTodoListView, SIGNAL(selectionChanged() ), | 579 | connect( mTodoListView, SIGNAL(selectionChanged() ), |
580 | SLOT( processSelectionChange() ) ); | 580 | SLOT( processSelectionChange() ) ); |
581 | connect( mQuickAdd, SIGNAL( returnPressed () ), | 581 | connect( mQuickAdd, SIGNAL( returnPressed () ), |
582 | SLOT( addQuickTodo() ) ); | 582 | SLOT( addQuickTodo() ) ); |
583 | 583 | ||
584 | } | 584 | } |
585 | 585 | ||
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 | } |