summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-26 13:13:04 (UTC)
committer zautrix <zautrix>2005-03-26 13:13:04 (UTC)
commit93d1be2c6eead07300e7f90f3b417fcef0f109d3 (patch) (unidiff)
treecdcac27cfa1e02c6fa388c252287ed9818b95847
parentbc8929ccca1ad8cd04f61366c78254803d9c1565 (diff)
downloadkdepimpi-93d1be2c6eead07300e7f90f3b417fcef0f109d3.zip
kdepimpi-93d1be2c6eead07300e7f90f3b417fcef0f109d3.tar.gz
kdepimpi-93d1be2c6eead07300e7f90f3b417fcef0f109d3.tar.bz2
icons added
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/1leftrightarrow.pngbin0 -> 148 bytes
-rw-r--r--bin/kdepim/korganizer/1updownarrow.pngbin0 -> 164 bytes
-rw-r--r--bin/kdepim/korganizer/3leftarrow.pngbin0 -> 151 bytes
-rw-r--r--bin/kdepim/korganizer/3leftarrowB.pngbin0 -> 668 bytes
-rw-r--r--bin/kdepim/korganizer/3rightarrow.pngbin0 -> 147 bytes
-rw-r--r--bin/kdepim/korganizer/3rightarrowB.pngbin0 -> 673 bytes
-rw-r--r--bin/kdepim/pwmanager/icons22/decrypted.pngbin1117 -> 988 bytes
-rw-r--r--korganizer/koagendaview.cpp2
-rw-r--r--korganizer/koeditorgeneral.cpp4
9 files changed, 5 insertions, 1 deletions
diff --git a/bin/kdepim/korganizer/1leftrightarrow.png b/bin/kdepim/korganizer/1leftrightarrow.png
new file mode 100644
index 0000000..867f1f0
--- a/dev/null
+++ b/bin/kdepim/korganizer/1leftrightarrow.png
Binary files differ
diff --git a/bin/kdepim/korganizer/1updownarrow.png b/bin/kdepim/korganizer/1updownarrow.png
new file mode 100644
index 0000000..8171ec1
--- a/dev/null
+++ b/bin/kdepim/korganizer/1updownarrow.png
Binary files differ
diff --git a/bin/kdepim/korganizer/3leftarrow.png b/bin/kdepim/korganizer/3leftarrow.png
new file mode 100644
index 0000000..32ceec1
--- a/dev/null
+++ b/bin/kdepim/korganizer/3leftarrow.png
Binary files differ
diff --git a/bin/kdepim/korganizer/3leftarrowB.png b/bin/kdepim/korganizer/3leftarrowB.png
new file mode 100644
index 0000000..5f8fc82
--- a/dev/null
+++ b/bin/kdepim/korganizer/3leftarrowB.png
Binary files differ
diff --git a/bin/kdepim/korganizer/3rightarrow.png b/bin/kdepim/korganizer/3rightarrow.png
new file mode 100644
index 0000000..a1db245
--- a/dev/null
+++ b/bin/kdepim/korganizer/3rightarrow.png
Binary files differ
diff --git a/bin/kdepim/korganizer/3rightarrowB.png b/bin/kdepim/korganizer/3rightarrowB.png
new file mode 100644
index 0000000..7fc4b0c
--- a/dev/null
+++ b/bin/kdepim/korganizer/3rightarrowB.png
Binary files differ
diff --git a/bin/kdepim/pwmanager/icons22/decrypted.png b/bin/kdepim/pwmanager/icons22/decrypted.png
index ea770ea..de67872 100644
--- a/bin/kdepim/pwmanager/icons22/decrypted.png
+++ b/bin/kdepim/pwmanager/icons22/decrypted.png
Binary files differ
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index b9c7dec..8001c8f 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1,649 +1,651 @@
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 <qhbox.h> 24#include <qhbox.h>
25#include <qvbox.h> 25#include <qvbox.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qframe.h> 27#include <qframe.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#ifndef KORG_NOSPLITTER 29#ifndef KORG_NOSPLITTER
30#include <qsplitter.h> 30#include <qsplitter.h>
31#endif 31#endif
32#include <qfont.h> 32#include <qfont.h>
33#include <qfontmetrics.h> 33#include <qfontmetrics.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <qtooltip.h> 35#include <qtooltip.h>
36#include <qpainter.h> 36#include <qpainter.h>
37#include <qpushbutton.h> 37#include <qpushbutton.h>
38#include <qapplication.h> 38#include <qapplication.h>
39 39
40#include <kapplication.h> 40#include <kapplication.h>
41#include <KDGanttMinimizeSplitter.h> 41#include <KDGanttMinimizeSplitter.h>
42#include <kdebug.h> 42#include <kdebug.h>
43#include <kstandarddirs.h> 43#include <kstandarddirs.h>
44#include <kiconloader.h> 44#include <kiconloader.h>
45#include <klocale.h> 45#include <klocale.h>
46#include <kconfig.h> 46#include <kconfig.h>
47#include <kglobal.h> 47#include <kglobal.h>
48#include "calendarview.h" 48#include "calendarview.h"
49#include "koviewmanager.h" 49#include "koviewmanager.h"
50 50
51#include <libkcal/calendar.h> 51#include <libkcal/calendar.h>
52#include <libkcal/icaldrag.h> 52#include <libkcal/icaldrag.h>
53#include <libkcal/dndfactory.h> 53#include <libkcal/dndfactory.h>
54 54
55#include <kcalendarsystem.h> 55#include <kcalendarsystem.h>
56 56
57#include "koglobals.h" 57#include "koglobals.h"
58#ifndef KORG_NOPLUGINS 58#ifndef KORG_NOPLUGINS
59#include "kocore.h" 59#include "kocore.h"
60#endif 60#endif
61#include "koprefs.h" 61#include "koprefs.h"
62#include "koagenda.h" 62#include "koagenda.h"
63#include "koagendaitem.h" 63#include "koagendaitem.h"
64#ifndef KORG_NOPRINTER 64#ifndef KORG_NOPRINTER
65#include "calprinter.h" 65#include "calprinter.h"
66#endif 66#endif
67 67
68#include "koagendaview.h" 68#include "koagendaview.h"
69//#include "koagendaview.moc" 69//#include "koagendaview.moc"
70 70
71//extern bool globalFlagBlockPainting; 71//extern bool globalFlagBlockPainting;
72extern int globalFlagBlockAgenda; 72extern int globalFlagBlockAgenda;
73extern int globalFlagBlockStartup; 73extern int globalFlagBlockStartup;
74extern int globalFlagBlockAgendaItemPaint; 74extern int globalFlagBlockAgendaItemPaint;
75extern int globalFlagBlockAgendaItemUpdate; 75extern int globalFlagBlockAgendaItemUpdate;
76extern int globalFlagBlockLabel; 76extern int globalFlagBlockLabel;
77using namespace KOrg; 77using namespace KOrg;
78 78
79 79
80 80
81TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : 81TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) :
82 QScrollView(parent,name,f) 82 QScrollView(parent,name,f)
83{ 83{
84 mRows = rows; 84 mRows = rows;
85 85
86 setMinimumHeight( 20 ); 86 setMinimumHeight( 20 );
87 mCellHeight = KOPrefs::instance()->mHourSize*4; 87 mCellHeight = KOPrefs::instance()->mHourSize*4;
88 88
89 enableClipper(true); 89 enableClipper(true);
90 90
91 setHScrollBarMode(AlwaysOff); 91 setHScrollBarMode(AlwaysOff);
92 setVScrollBarMode(AlwaysOff); 92 setVScrollBarMode(AlwaysOff);
93 93
94 resizeContents(50,mRows * mCellHeight); 94 resizeContents(50,mRows * mCellHeight);
95 95
96 viewport()->setBackgroundMode( PaletteBackground ); 96 viewport()->setBackgroundMode( PaletteBackground );
97} 97}
98 98
99void TimeLabels::setCellHeight(int height) 99void TimeLabels::setCellHeight(int height)
100{ 100{
101 mCellHeight = height; 101 mCellHeight = height;
102} 102}
103 103
104/* 104/*
105 Optimization so that only the "dirty" portion of the scroll view 105 Optimization so that only the "dirty" portion of the scroll view
106 is redrawn. Unfortunately, this is not called by default paintEvent() method. 106 is redrawn. Unfortunately, this is not called by default paintEvent() method.
107*/ 107*/
108void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) 108void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
109{ 109{
110 110
111 // if ( globalFlagBlockAgenda ) 111 // if ( globalFlagBlockAgenda )
112 // return; 112 // return;
113 // bug: the parameters cx, cy, cw, ch are the areas that need to be 113 // bug: the parameters cx, cy, cw, ch are the areas that need to be
114 // redrawn, not the area of the widget. unfortunately, this 114 // redrawn, not the area of the widget. unfortunately, this
115 // code assumes the latter... 115 // code assumes the latter...
116 116
117 // now, for a workaround... 117 // now, for a workaround...
118 // these two assignments fix the weird redraw bug 118 // these two assignments fix the weird redraw bug
119 cx = contentsX() + 2; 119 cx = contentsX() + 2;
120 cw = contentsWidth() - 2; 120 cw = contentsWidth() - 2;
121 // end of workaround 121 // end of workaround
122 122
123 int cell = ((int)(cy/mCellHeight)); 123 int cell = ((int)(cy/mCellHeight));
124 int y = cell * mCellHeight; 124 int y = cell * mCellHeight;
125 QFontMetrics fm = fontMetrics(); 125 QFontMetrics fm = fontMetrics();
126 QString hour; 126 QString hour;
127 QString suffix; 127 QString suffix;
128 QString fullTime; 128 QString fullTime;
129 int tW = fm.width("24:00i"); 129 int tW = fm.width("24:00i");
130 int timeHeight = fm.height(); 130 int timeHeight = fm.height();
131 timeHeight -= (timeHeight/4-2); 131 timeHeight -= (timeHeight/4-2);
132 int borderWidth = 2; 132 int borderWidth = 2;
133 QFont nFont = p->font(); 133 QFont nFont = p->font();
134 QFont sFont = nFont; 134 QFont sFont = nFont;
135 sFont.setPointSize( sFont.pointSize()/2+2 ); 135 sFont.setPointSize( sFont.pointSize()/2+2 );
136 if (!KGlobal::locale()->use12Clock()) 136 if (!KGlobal::locale()->use12Clock())
137 suffix = "00"; 137 suffix = "00";
138 else
139 borderWidth = 0;
138 QFontMetrics fmS( sFont ); 140 QFontMetrics fmS( sFont );
139 int sHei = fmS.height(); 141 int sHei = fmS.height();
140 if ( timeHeight > mCellHeight ) { 142 if ( timeHeight > mCellHeight ) {
141 timeHeight = mCellHeight-1; 143 timeHeight = mCellHeight-1;
142 sHei -= 2; 144 sHei -= 2;
143 } 145 }
144 146
145 while (y < cy + ch) { 147 while (y < cy + ch) {
146 p->drawLine(cx,y,cx+tW,y); 148 p->drawLine(cx,y,cx+tW,y);
147 hour.setNum(cell); 149 hour.setNum(cell);
148 150
149 // handle 24h and am/pm time formats 151 // handle 24h and am/pm time formats
150 if (KGlobal::locale()->use12Clock()) { 152 if (KGlobal::locale()->use12Clock()) {
151 if (cell > 11) suffix = "pm"; 153 if (cell > 11) suffix = "pm";
152 else 154 else
153 suffix = "am"; 155 suffix = "am";
154 if (cell == 0) hour.setNum(12); 156 if (cell == 0) hour.setNum(12);
155 if (cell > 12) hour.setNum(cell - 12); 157 if (cell > 12) hour.setNum(cell - 12);
156 } 158 }
157 159
158 // create string in format of "XX:XX" or "XXpm/am" 160 // create string in format of "XX:XX" or "XXpm/am"
159 fullTime = hour;// + suffix; 161 fullTime = hour;// + suffix;
160 162
161 // center and draw the time label 163 // center and draw the time label
162 int timeWidth = fm.width(fullTime+"i"); 164 int timeWidth = fm.width(fullTime+"i");
163 int tw2 = fm.width(suffix); 165 int tw2 = fm.width(suffix);
164 int offset = this->width() - timeWidth - tw2; 166 int offset = this->width() - timeWidth - tw2;
165 p->setFont( nFont ); 167 p->setFont( nFont );
166 p->drawText(cx - borderWidth + offset, y+ timeHeight, fullTime); 168 p->drawText(cx - borderWidth + offset, y+ timeHeight, fullTime);
167 p->setFont( sFont ); 169 p->setFont( sFont );
168 offset += timeWidth; 170 offset += timeWidth;
169 p->drawText(cx - borderWidth + offset, y+ sHei, suffix); 171 p->drawText(cx - borderWidth + offset, y+ sHei, suffix);
170 172
171 // increment indices 173 // increment indices
172 y += mCellHeight; 174 y += mCellHeight;
173 cell++; 175 cell++;
174 } 176 }
175} 177}
176 178
177/** 179/**
178 Calculates the minimum width. 180 Calculates the minimum width.
179*/ 181*/
180int TimeLabels::minimumWidth() const 182int TimeLabels::minimumWidth() const
181{ 183{
182 return mMiniWidth; 184 return mMiniWidth;
183} 185}
184 186
185/** updates widget's internal state */ 187/** updates widget's internal state */
186void TimeLabels::updateConfig() 188void TimeLabels::updateConfig()
187{ 189{
188 // set the font 190 // set the font
189 // config->setGroup("Fonts"); 191 // config->setGroup("Fonts");
190 // QFont font = config->readFontEntry("TimeBar Font"); 192 // QFont font = config->readFontEntry("TimeBar Font");
191 setFont(KOPrefs::instance()->mTimeBarFont); 193 setFont(KOPrefs::instance()->mTimeBarFont);
192 mMiniWidth = fontMetrics().width("88:88") + 2 ; 194 mMiniWidth = fontMetrics().width("88:88") + 2 ;
193 // update geometry restrictions based on new settings 195 // update geometry restrictions based on new settings
194 setFixedWidth(minimumWidth()); 196 setFixedWidth(minimumWidth());
195 197
196 // update HourSize 198 // update HourSize
197 mCellHeight = KOPrefs::instance()->mHourSize*4; 199 mCellHeight = KOPrefs::instance()->mHourSize*4;
198 resizeContents(50,mRows * mCellHeight); 200 resizeContents(50,mRows * mCellHeight);
199} 201}
200 202
201/** update time label positions */ 203/** update time label positions */
202void TimeLabels::positionChanged() 204void TimeLabels::positionChanged()
203{ 205{
204 int adjustment = mAgenda->contentsY(); 206 int adjustment = mAgenda->contentsY();
205 setContentsPos(0, adjustment); 207 setContentsPos(0, adjustment);
206} 208}
207 209
208/** */ 210/** */
209void TimeLabels::setAgenda(KOAgenda* agenda) 211void TimeLabels::setAgenda(KOAgenda* agenda)
210{ 212{
211 mAgenda = agenda; 213 mAgenda = agenda;
212} 214}
213 215
214void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) 216void TimeLabels::contentsMousePressEvent ( QMouseEvent * e)
215{ 217{
216 mMouseDownY = e->pos().y(); 218 mMouseDownY = e->pos().y();
217 mOrgCap = topLevelWidget()->caption(); 219 mOrgCap = topLevelWidget()->caption();
218} 220}
219 221
220void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) 222void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e )
221{ 223{
222 int diff = mMouseDownY - e->pos().y(); 224 int diff = mMouseDownY - e->pos().y();
223 if ( diff < 10 && diff > -10 ) 225 if ( diff < 10 && diff > -10 )
224 return; 226 return;
225 int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; 227 int tSize = KOPrefs::instance()->mHourSize + (diff/10) ;
226 if ( tSize < 4 ) 228 if ( tSize < 4 )
227 tSize = 4; 229 tSize = 4;
228 if ( tSize > 22 ) 230 if ( tSize > 22 )
229 tSize = 22; 231 tSize = 22;
230 tSize = (tSize-2)/2; 232 tSize = (tSize-2)/2;
231 topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); 233 topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize));
232 234
233} 235}
234void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) 236void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e )
235{ 237{
236 topLevelWidget()->setCaption( mOrgCap ); 238 topLevelWidget()->setCaption( mOrgCap );
237 int diff = mMouseDownY - e->pos().y(); 239 int diff = mMouseDownY - e->pos().y();
238 if ( diff < 10 && diff > -10 ) 240 if ( diff < 10 && diff > -10 )
239 return; 241 return;
240 int tSize = KOPrefs::instance()->mHourSize + (diff/10); 242 int tSize = KOPrefs::instance()->mHourSize + (diff/10);
241 if ( tSize < 4 ) 243 if ( tSize < 4 )
242 tSize = 4; 244 tSize = 4;
243 if ( tSize > 22 ) 245 if ( tSize > 22 )
244 tSize = 22; 246 tSize = 22;
245 tSize = (tSize/2)*2; 247 tSize = (tSize/2)*2;
246 if ( tSize == KOPrefs::instance()->mHourSize ) 248 if ( tSize == KOPrefs::instance()->mHourSize )
247 return; 249 return;
248 KOPrefs::instance()->mHourSize = tSize; 250 KOPrefs::instance()->mHourSize = tSize;
249 emit scaleChanged(); 251 emit scaleChanged();
250} 252}
251 253
252/** This is called in response to repaint() */ 254/** This is called in response to repaint() */
253void TimeLabels::paintEvent(QPaintEvent*) 255void TimeLabels::paintEvent(QPaintEvent*)
254{ 256{
255 257
256 // kdDebug() << "paintevent..." << endl; 258 // kdDebug() << "paintevent..." << endl;
257 // this is another hack! 259 // this is another hack!
258 // QPainter painter(this); 260 // QPainter painter(this);
259 //QString c 261 //QString c
260 repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); 262 repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight());
261} 263}
262 264
263//////////////////////////////////////////////////////////////////////////// 265////////////////////////////////////////////////////////////////////////////
264 266
265EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) 267EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name)
266 : QFrame(parent,name) 268 : QFrame(parent,name)
267{ 269{
268 mColumns = 1; 270 mColumns = 1;
269 mTopBox = 0; 271 mTopBox = 0;
270 mLocation = loc; 272 mLocation = loc;
271 mTopLayout = 0; 273 mTopLayout = 0;
272 mPaintWidget = 0; 274 mPaintWidget = 0;
273 mXOffset = 0; 275 mXOffset = 0;
274 if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); 276 if (mLocation == Top) mPixmap = SmallIcon("1uparrow");
275 else mPixmap = SmallIcon("1downarrow"); 277 else mPixmap = SmallIcon("1downarrow");
276 mEnabled.resize(mColumns); 278 mEnabled.resize(mColumns);
277 mEnabled.fill( false ); 279 mEnabled.fill( false );
278 setMinimumHeight(mPixmap.height()); 280 setMinimumHeight(mPixmap.height());
279} 281}
280 282
281EventIndicator::~EventIndicator() 283EventIndicator::~EventIndicator()
282{ 284{
283} 285}
284 286
285void EventIndicator::drawContents(QPainter *p) 287void EventIndicator::drawContents(QPainter *p)
286{ 288{
287 289
288 // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; 290 // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl;
289 KDGanttSplitterHandle* han = 0; 291 KDGanttSplitterHandle* han = 0;
290 if ( mPaintWidget ) 292 if ( mPaintWidget )
291 han = mPaintWidget->firstHandle(); 293 han = mPaintWidget->firstHandle();
292 if ( ! han ) { 294 if ( ! han ) {
293 int i; 295 int i;
294 for(i=0;i<mColumns;++i) { 296 for(i=0;i<mColumns;++i) {
295 if (mEnabled[i]) { 297 if (mEnabled[i]) {
296 int cellWidth = contentsRect().right()/mColumns; 298 int cellWidth = contentsRect().right()/mColumns;
297 int xOffset = KOGlobals::self()->reverseLayout() ? 299 int xOffset = KOGlobals::self()->reverseLayout() ?
298 (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 : 300 (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 :
299 i*cellWidth + (cellWidth -mPixmap.width()) /2; 301 i*cellWidth + (cellWidth -mPixmap.width()) /2;
300 p->drawPixmap(QPoint(1+xOffset,0),mPixmap); 302 p->drawPixmap(QPoint(1+xOffset,0),mPixmap);
301 } 303 }
302 } 304 }
303 } else { 305 } else {
304 han->repaint(); 306 han->repaint();
305 //mPaintWidget->setBackgroundColor( red ); 307 //mPaintWidget->setBackgroundColor( red );
306 308
307 QPainter pa( han ); 309 QPainter pa( han );
308 int i; 310 int i;
309 bool setColor = false; 311 bool setColor = false;
310 for(i=0;i<mColumns;++i) { 312 for(i=0;i<mColumns;++i) {
311 if (mEnabled[i]) { 313 if (mEnabled[i]) {
312 setColor = true; 314 setColor = true;
313 315
314 int cellWidth = contentsRect().right()/mColumns; 316 int cellWidth = contentsRect().right()/mColumns;
315 int xOffset = KOGlobals::self()->reverseLayout() ? 317 int xOffset = KOGlobals::self()->reverseLayout() ?
316 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : 318 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 :
317 i*cellWidth + cellWidth/2 -mPixmap.width()/2; 319 i*cellWidth + cellWidth/2 -mPixmap.width()/2;
318 pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); 320 pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap);
319 //qDebug("222draw pix %d ",xOffset ); 321 //qDebug("222draw pix %d ",xOffset );
320 322
321 } 323 }
322 324
323 } 325 }
324 pa.end(); 326 pa.end();
325 327
326 } 328 }
327} 329}
328 330
329void EventIndicator::setXOffset( int x ) 331void EventIndicator::setXOffset( int x )
330{ 332{
331 mXOffset = x; 333 mXOffset = x;
332} 334}
333void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) 335void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w )
334{ 336{
335 mPaintWidget = w; 337 mPaintWidget = w;
336 setMaximumHeight(0); 338 setMaximumHeight(0);
337 setMinimumHeight(0); 339 setMinimumHeight(0);
338} 340}
339void EventIndicator::changeColumns(int columns) 341void EventIndicator::changeColumns(int columns)
340{ 342{
341 mColumns = columns; 343 mColumns = columns;
342 mEnabled.resize(mColumns); 344 mEnabled.resize(mColumns);
343 345
344 update(); 346 update();
345} 347}
346 348
347void EventIndicator::enableColumn(int column, bool enable) 349void EventIndicator::enableColumn(int column, bool enable)
348{ 350{
349 mEnabled[column] = enable; 351 mEnabled[column] = enable;
350} 352}
351 353
352 354
353//////////////////////////////////////////////////////////////////////////// 355////////////////////////////////////////////////////////////////////////////
354//////////////////////////////////////////////////////////////////////////// 356////////////////////////////////////////////////////////////////////////////
355//////////////////////////////////////////////////////////////////////////// 357////////////////////////////////////////////////////////////////////////////
356 358
357KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : 359KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
358 KOEventView (cal,parent,name) 360 KOEventView (cal,parent,name)
359{ 361{
360 mBlockUpdating = true; 362 mBlockUpdating = true;
361 mStartHour = 8; 363 mStartHour = 8;
362 mSelectedDates.append(QDate::currentDate()); 364 mSelectedDates.append(QDate::currentDate());
363 365
364 mLayoutDayLabels = 0; 366 mLayoutDayLabels = 0;
365 mDayLabelsFrame = 0; 367 mDayLabelsFrame = 0;
366 mDayLabels = 0; 368 mDayLabels = 0;
367 bool isRTL = KOGlobals::self()->reverseLayout(); 369 bool isRTL = KOGlobals::self()->reverseLayout();
368 370
369 if ( KOPrefs::instance()->mVerticalScreen ) { 371 if ( KOPrefs::instance()->mVerticalScreen ) {
370 mExpandedPixmap = SmallIcon( "1downarrow" ); 372 mExpandedPixmap = SmallIcon( "1downarrow" );
371 mNotExpandedPixmap = SmallIcon( "1uparrow" ); 373 mNotExpandedPixmap = SmallIcon( "1uparrow" );
372 } else { 374 } else {
373 mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); 375 mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" );
374 mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); 376 mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" );
375 } 377 }
376 378
377 QBoxLayout *topLayout = new QVBoxLayout(this); 379 QBoxLayout *topLayout = new QVBoxLayout(this);
378 380
379 // Create day name labels for agenda columns 381 // Create day name labels for agenda columns
380 // Create agenda splitter 382 // Create agenda splitter
381 383
382 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); 384 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this);
383 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 385 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
384 topLayout->addWidget( mSplitterAgenda ); 386 topLayout->addWidget( mSplitterAgenda );
385 mAllDayFrame = new QHBox(mSplitterAgenda); 387 mAllDayFrame = new QHBox(mSplitterAgenda);
386 mAllDayFrame->setFocusPolicy(NoFocus); 388 mAllDayFrame->setFocusPolicy(NoFocus);
387 QWidget *agendaFrame = new QWidget(mSplitterAgenda); 389 QWidget *agendaFrame = new QWidget(mSplitterAgenda);
388 agendaFrame->setFocusPolicy(NoFocus); 390 agendaFrame->setFocusPolicy(NoFocus);
389 391
390 // Create all-day agenda widget 392 // Create all-day agenda widget
391 mDummyAllDayLeft = new QVBox( mAllDayFrame ); 393 mDummyAllDayLeft = new QVBox( mAllDayFrame );
392 394
393 mExpandButton = new QPushButton(mDummyAllDayLeft); 395 mExpandButton = new QPushButton(mDummyAllDayLeft);
394 mExpandButton->setPixmap( mNotExpandedPixmap ); 396 mExpandButton->setPixmap( mNotExpandedPixmap );
395 int widebut = mExpandButton->sizeHint().width(); 397 int widebut = mExpandButton->sizeHint().width();
396 if ( QApplication::desktop()->width() < 480 ) 398 if ( QApplication::desktop()->width() < 480 )
397 widebut = widebut*2; 399 widebut = widebut*2;
398 else 400 else
399 widebut = (widebut*3) / 2; 401 widebut = (widebut*3) / 2;
400 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, 402 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed,
401 // QSizePolicy::Fixed ) ); 403 // QSizePolicy::Fixed ) );
402 mExpandButton->setFixedSize( widebut, widebut); 404 mExpandButton->setFixedSize( widebut, widebut);
403 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); 405 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) );
404 mExpandButton->setFocusPolicy(NoFocus); 406 mExpandButton->setFocusPolicy(NoFocus);
405 mAllDayAgenda = new KOAgenda(1,mAllDayFrame); 407 mAllDayAgenda = new KOAgenda(1,mAllDayFrame);
406 mAllDayAgenda->setFocusPolicy(NoFocus); 408 mAllDayAgenda->setFocusPolicy(NoFocus);
407 QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); 409 QLabel *dummyAllDayRight = new QLabel (mAllDayFrame);
408 410
409 // Create event context menu for all day agenda 411 // Create event context menu for all day agenda
410 mAllDayAgendaPopup = eventPopup(); 412 mAllDayAgendaPopup = eventPopup();
411 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 413 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
412 mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 414 mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
413 415
414 // Create agenda frame 416 // Create agenda frame
415 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); 417 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3);
416 // QHBox *agendaFrame = new QHBox(splitterAgenda); 418 // QHBox *agendaFrame = new QHBox(splitterAgenda);
417 419
418 // create event indicator bars 420 // create event indicator bars
419 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); 421 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame);
420#ifndef DESKTOP_VERSION 422#ifndef DESKTOP_VERSION
421 // FIX 423 // FIX
422 mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); 424 mEventIndicatorTop->setPaintWidget( mSplitterAgenda );
423#endif 425#endif
424 mDayLabelsFrame = new QHBox(agendaFrame); 426 mDayLabelsFrame = new QHBox(agendaFrame);
425 //topLayout->addWidget(mDayLabelsFrame); 427 //topLayout->addWidget(mDayLabelsFrame);
426 mDayLabels = new QFrame (mDayLabelsFrame); 428 mDayLabels = new QFrame (mDayLabelsFrame);
427 mLayoutDayLabels = new QHBoxLayout(mDayLabels); 429 mLayoutDayLabels = new QHBoxLayout(mDayLabels);
428 agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); 430 agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2);
429 agendaLayout->addWidget(mEventIndicatorTop,1,1); 431 agendaLayout->addWidget(mEventIndicatorTop,1,1);
430 432
431 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, 433 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom,
432 agendaFrame); 434 agendaFrame);
433 agendaLayout->addWidget(mEventIndicatorBottom,3,1); 435 agendaLayout->addWidget(mEventIndicatorBottom,3,1);
434 QWidget *dummyAgendaRight = new QWidget(agendaFrame); 436 QWidget *dummyAgendaRight = new QWidget(agendaFrame);
435 agendaLayout->addWidget(dummyAgendaRight,1,2); 437 agendaLayout->addWidget(dummyAgendaRight,1,2);
436 438
437 // Create time labels 439 // Create time labels
438 mTimeLabels = new TimeLabels(24,agendaFrame); 440 mTimeLabels = new TimeLabels(24,agendaFrame);
439 agendaLayout->addWidget(mTimeLabels,2,0); 441 agendaLayout->addWidget(mTimeLabels,2,0);
440 connect(mTimeLabels,SIGNAL( scaleChanged()), 442 connect(mTimeLabels,SIGNAL( scaleChanged()),
441 this,SLOT(updateConfig())); 443 this,SLOT(updateConfig()));
442 444
443 // Create agenda 445 // Create agenda
444 mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); 446 mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame);
445 agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); 447 agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2);
446 agendaLayout->setColStretch(1,1); 448 agendaLayout->setColStretch(1,1);
447 mAgenda->setFocusPolicy(NoFocus); 449 mAgenda->setFocusPolicy(NoFocus);
448 // Create event context menu for agenda 450 // Create event context menu for agenda
449 mAgendaPopup = eventPopup(); 451 mAgendaPopup = eventPopup();
450 452
451 mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), 453 mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")),
452 i18n("Toggle Alarm"),mAgenda, 454 i18n("Toggle Alarm"),mAgenda,
453 SLOT(popupAlarm()),true); 455 SLOT(popupAlarm()),true);
454 456
455 457
456 connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 458 connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
457 mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 459 mAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
458 460
459 // make connections between dependent widgets 461 // make connections between dependent widgets
460 mTimeLabels->setAgenda(mAgenda); 462 mTimeLabels->setAgenda(mAgenda);
461 463
462 // Update widgets to reflect user preferences 464 // Update widgets to reflect user preferences
463 // updateConfig(); 465 // updateConfig();
464 466
465 // createDayLabels(); 467 // createDayLabels();
466 468
467 // these blank widgets make the All Day Event box line up with the agenda 469 // these blank widgets make the All Day Event box line up with the agenda
468 dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); 470 dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
469 dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); 471 dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
470 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); 472 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
471 473
472 // Scrolling 474 // Scrolling
473 connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), 475 connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)),
474 mTimeLabels, SLOT(positionChanged())); 476 mTimeLabels, SLOT(positionChanged()));
475 connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), 477 connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)),
476 SLOT(setContentsPos(int))); 478 SLOT(setContentsPos(int)));
477 479
478 connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); 480 connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate )));
479 connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); 481 connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate )));
480 482
481 // Create/Show/Edit/Delete Event 483 // Create/Show/Edit/Delete Event
482 connect(mAgenda,SIGNAL(newEventSignal(int,int)), 484 connect(mAgenda,SIGNAL(newEventSignal(int,int)),
483 SLOT(newEvent(int,int))); 485 SLOT(newEvent(int,int)));
484 connect(mAgenda,SIGNAL(newTodoSignal(int,int)), 486 connect(mAgenda,SIGNAL(newTodoSignal(int,int)),
485 SLOT(newTodo(int,int))); 487 SLOT(newTodo(int,int)));
486 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), 488 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)),
487 SLOT(newEvent(int,int,int,int))); 489 SLOT(newEvent(int,int,int,int)));
488 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), 490 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)),
489 SLOT(newEventAllDay(int,int))); 491 SLOT(newEventAllDay(int,int)));
490 connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), 492 connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)),
491 SLOT(newTodoAllDay(int,int))); 493 SLOT(newTodoAllDay(int,int)));
492 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), 494 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)),
493 SLOT(newEventAllDay(int,int))); 495 SLOT(newEventAllDay(int,int)));
494 connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), 496 connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
495 SLOT(newTimeSpanSelected(int,int,int,int))); 497 SLOT(newTimeSpanSelected(int,int,int,int)));
496 connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), 498 connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
497 SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); 499 SLOT(newTimeSpanSelectedAllDay(int,int,int,int)));
498 connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); 500 connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
499 connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); 501 connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
500 502
501 connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), 503 connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
502 SIGNAL(editIncidenceSignal(Incidence *))); 504 SIGNAL(editIncidenceSignal(Incidence *)));
503 connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), 505 connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
504 SIGNAL(editIncidenceSignal(Incidence *))); 506 SIGNAL(editIncidenceSignal(Incidence *)));
505 connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), 507 connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)),
506 SIGNAL(showIncidenceSignal(Incidence *))); 508 SIGNAL(showIncidenceSignal(Incidence *)));
507 connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), 509 connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)),
508 SIGNAL(showIncidenceSignal(Incidence *))); 510 SIGNAL(showIncidenceSignal(Incidence *)));
509 connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), 511 connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)),
510 SIGNAL(deleteIncidenceSignal(Incidence *))); 512 SIGNAL(deleteIncidenceSignal(Incidence *)));
511 connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), 513 connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)),
512 SIGNAL(deleteIncidenceSignal(Incidence *))); 514 SIGNAL(deleteIncidenceSignal(Incidence *)));
513 515
514 connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), 516 connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )),
515 SLOT(updateEventDates(KOAgendaItem *, int ))); 517 SLOT(updateEventDates(KOAgendaItem *, int )));
516 connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), 518 connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )),
517 SLOT(updateEventDates(KOAgendaItem *, int))); 519 SLOT(updateEventDates(KOAgendaItem *, int)));
518 520
519 // event indicator update 521 // event indicator update
520 connect(mAgenda,SIGNAL(lowerYChanged(int)), 522 connect(mAgenda,SIGNAL(lowerYChanged(int)),
521 SLOT(updateEventIndicatorTop(int))); 523 SLOT(updateEventIndicatorTop(int)));
522 connect(mAgenda,SIGNAL(upperYChanged(int)), 524 connect(mAgenda,SIGNAL(upperYChanged(int)),
523 SLOT(updateEventIndicatorBottom(int))); 525 SLOT(updateEventIndicatorBottom(int)));
524 // drag signals 526 // drag signals
525 /* 527 /*
526 connect(mAgenda,SIGNAL(startDragSignal(Event *)), 528 connect(mAgenda,SIGNAL(startDragSignal(Event *)),
527 SLOT(startDrag(Event *))); 529 SLOT(startDrag(Event *)));
528 connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), 530 connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)),
529 SLOT(startDrag(Event *))); 531 SLOT(startDrag(Event *)));
530 */ 532 */
531 // synchronize selections 533 // synchronize selections
532 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 534 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
533 mAllDayAgenda, SLOT( deselectItem() ) ); 535 mAllDayAgenda, SLOT( deselectItem() ) );
534 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 536 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
535 mAgenda, SLOT( deselectItem() ) ); 537 mAgenda, SLOT( deselectItem() ) );
536 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 538 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
537 SIGNAL( incidenceSelected( Incidence * ) ) ); 539 SIGNAL( incidenceSelected( Incidence * ) ) );
538 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 540 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
539 SIGNAL( incidenceSelected( Incidence * ) ) ); 541 SIGNAL( incidenceSelected( Incidence * ) ) );
540 connect( mAgenda, SIGNAL( resizedSignal() ), 542 connect( mAgenda, SIGNAL( resizedSignal() ),
541 SLOT( updateConfig( ) ) ); 543 SLOT( updateConfig( ) ) );
542 connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), 544 connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ),
543 SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); 545 SLOT( addToCalSlot(Incidence *, Incidence * ) ) );
544 connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), 546 connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ),
545 SLOT( addToCalSlot(Incidence * , Incidence *) ) ); 547 SLOT( addToCalSlot(Incidence * , Incidence *) ) );
546 // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 548 // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
547 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 549 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
548 550
549 551
550} 552}
551 553
552void KOAgendaView::toggleAllDay() 554void KOAgendaView::toggleAllDay()
553{ 555{
554 if ( mSplitterAgenda->firstHandle() ) 556 if ( mSplitterAgenda->firstHandle() )
555 mSplitterAgenda->firstHandle()->toggle(); 557 mSplitterAgenda->firstHandle()->toggle();
556} 558}
557void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) 559void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld )
558{ 560{
559 calendar()->addIncidence( inc ); 561 calendar()->addIncidence( inc );
560 562
561 if ( incOld ) { 563 if ( incOld ) {
562 if ( incOld->type() == "Todo" ) 564 if ( incOld->type() == "Todo" )
563 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); 565 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED );
564 else 566 else
565 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); 567 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED);
566 } 568 }
567 569
568} 570}
569 571
570KOAgendaView::~KOAgendaView() 572KOAgendaView::~KOAgendaView()
571{ 573{
572 delete mAgendaPopup; 574 delete mAgendaPopup;
573 delete mAllDayAgendaPopup; 575 delete mAllDayAgendaPopup;
574 delete KOAgendaItem::paintPix(); 576 delete KOAgendaItem::paintPix();
575 delete KOAgendaItem::paintPixSel(); 577 delete KOAgendaItem::paintPixSel();
576} 578}
577void KOAgendaView::resizeEvent( QResizeEvent* e ) 579void KOAgendaView::resizeEvent( QResizeEvent* e )
578{ 580{
579 //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); 581 //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width());
580 bool uc = false; 582 bool uc = false;
581 int ow = e->oldSize().width(); 583 int ow = e->oldSize().width();
582 int oh = e->oldSize().height(); 584 int oh = e->oldSize().height();
583 int w = e->size().width(); 585 int w = e->size().width();
584 int h = e->size().height(); 586 int h = e->size().height();
585 if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { 587 if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) {
586 if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) 588 if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda )
587 uc = true; 589 uc = true;
588 //qDebug("view changed %d %d %d %d ", ow, oh , w , h); 590 //qDebug("view changed %d %d %d %d ", ow, oh , w , h);
589 } 591 }
590 mUpcomingWidth = e->size().width() ; 592 mUpcomingWidth = e->size().width() ;
591 if ( mBlockUpdating || uc ) { 593 if ( mBlockUpdating || uc ) {
592 mBlockUpdating = false; 594 mBlockUpdating = false;
593 //mAgenda->setMinimumSize(800 , 600 ); 595 //mAgenda->setMinimumSize(800 , 600 );
594 //qDebug("mAgenda->resize+++++++++++++++ "); 596 //qDebug("mAgenda->resize+++++++++++++++ ");
595 updateConfig(); 597 updateConfig();
596 //qDebug("KOAgendaView::Updating now possible "); 598 //qDebug("KOAgendaView::Updating now possible ");
597 } else 599 } else
598 createDayLabels(); 600 createDayLabels();
599 //qDebug("resizeEvent end "); 601 //qDebug("resizeEvent end ");
600 602
601} 603}
602void KOAgendaView::slotDaylabelClicked( int num ) 604void KOAgendaView::slotDaylabelClicked( int num )
603{ 605{
604 606
605 QDate firstDate = mSelectedDates.first(); 607 QDate firstDate = mSelectedDates.first();
606 if ( num == -1 ) 608 if ( num == -1 )
607 emit showDateView( 6, firstDate ); 609 emit showDateView( 6, firstDate );
608 else if (num >= 0 ) { 610 else if (num >= 0 ) {
609 if ( mSelectedDates.count() == 1) 611 if ( mSelectedDates.count() == 1)
610 emit showDateView( 9, firstDate.addDays( num ) ); 612 emit showDateView( 9, firstDate.addDays( num ) );
611 else 613 else
612 emit showDateView( 3, firstDate.addDays( num ) ); 614 emit showDateView( 3, firstDate.addDays( num ) );
613 } 615 }
614 else 616 else
615 showDateView( 10, firstDate.addDays(1) ); 617 showDateView( 10, firstDate.addDays(1) );
616} 618}
617 619
618KOAgendaButton* KOAgendaView::getNewDaylabel() 620KOAgendaButton* KOAgendaView::getNewDaylabel()
619{ 621{
620 622
621 KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); 623 KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels);
622 connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); 624 connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) );
623 mDayLabelsList.append( dayLabel ); 625 mDayLabelsList.append( dayLabel );
624 mLayoutDayLabels->addWidget(dayLabel); 626 mLayoutDayLabels->addWidget(dayLabel);
625 return dayLabel ; 627 return dayLabel ;
626} 628}
627 629
628void KOAgendaView::createDayLabels() 630void KOAgendaView::createDayLabels()
629{ 631{
630 632
631 if ( mBlockUpdating || globalFlagBlockLabel == 1) { 633 if ( mBlockUpdating || globalFlagBlockLabel == 1) {
632 // qDebug(" KOAgendaView::createDayLabels() blocked "); 634 // qDebug(" KOAgendaView::createDayLabels() blocked ");
633 return; 635 return;
634 636
635 } 637 }
636 int newHight; 638 int newHight;
637 639
638 // ### Before deleting and recreating we could check if mSelectedDates changed... 640 // ### Before deleting and recreating we could check if mSelectedDates changed...
639 // It would remove some flickering and gain speed (since this is called by 641 // It would remove some flickering and gain speed (since this is called by
640 // each updateView() call) 642 // each updateView() call)
641 643
642 int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; 644 int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2;
643 mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); 645 mDayLabelsFrame->setMaximumWidth( mUpcomingWidth );
644 if ( maxWid < 0 ) 646 if ( maxWid < 0 )
645 maxWid = 20; 647 maxWid = 20;
646 648
647 QFont dlf = KOPrefs::instance()->mTimeLabelsFont; 649 QFont dlf = KOPrefs::instance()->mTimeLabelsFont;
648 QFontMetrics fm ( dlf ); 650 QFontMetrics fm ( dlf );
649 int selCount = mSelectedDates.count(); 651 int selCount = mSelectedDates.count();
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index cf0d4ae..92fcd1c 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -1,512 +1,514 @@
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 <qwidget.h> 24#include <qwidget.h>
25#include <qtooltip.h> 25#include <qtooltip.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qbuttongroup.h> 28#include <qbuttongroup.h>
29#include <qvgroupbox.h> 29#include <qvgroupbox.h>
30#include <qwidgetstack.h> 30#include <qwidgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qfile.h> 32#include <qfile.h>
33 33
34 34
35#include <kglobal.h> 35#include <kglobal.h>
36#include <kdebug.h> 36#include <kdebug.h>
37#include <klocale.h> 37#include <klocale.h>
38#include <kiconloader.h> 38#include <kiconloader.h>
39#include <kmessagebox.h> 39#include <kmessagebox.h>
40#include <kfiledialog.h> 40#include <kfiledialog.h>
41#include <kstandarddirs.h> 41#include <kstandarddirs.h>
42 42
43#include <libkcal/todo.h> 43#include <libkcal/todo.h>
44#include <libkcal/event.h> 44#include <libkcal/event.h>
45#include <libkdepim/categoryselectdialog.h> 45#include <libkdepim/categoryselectdialog.h>
46#include <libkdepim/kdateedit.h> 46#include <libkdepim/kdateedit.h>
47 47
48#include "koprefs.h" 48#include "koprefs.h"
49#include "koglobals.h" 49#include "koglobals.h"
50 50
51#include "koeditorgeneral.h" 51#include "koeditorgeneral.h"
52#include "kolocationbox.h" 52#include "kolocationbox.h"
53#ifndef DESKTOP_VERSION 53#ifndef DESKTOP_VERSION
54#include <qpe/qpeapplication.h> 54#include <qpe/qpeapplication.h>
55#else 55#else
56#include <qapplication.h> 56#include <qapplication.h>
57#endif 57#endif
58 58
59KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : 59KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) :
60 QObject( parent, name) 60 QObject( parent, name)
61{ 61{
62} 62}
63 63
64KOEditorGeneral::~KOEditorGeneral() 64KOEditorGeneral::~KOEditorGeneral()
65{ 65{
66} 66}
67 67
68void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) 68void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
69{ 69{
70 QGridLayout *headerLayout = new QGridLayout(topLayout); 70 QGridLayout *headerLayout = new QGridLayout(topLayout);
71 71
72#if 0 72#if 0
73 mOwnerLabel = new QLabel(i18n("Owner:"),parent); 73 mOwnerLabel = new QLabel(i18n("Owner:"),parent);
74 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); 74 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1);
75#endif 75#endif
76 76
77 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); 77 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent);
78 headerLayout->addWidget(summaryLabel,1,0); 78 headerLayout->addWidget(summaryLabel,1,0);
79 79
80 mSummaryEdit = new KOLocationBox(TRUE,parent, 10); 80 mSummaryEdit = new KOLocationBox(TRUE,parent, 10);
81 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 81 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
82 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); 82 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) );
83 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); 83 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() );
84 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; 84 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2;
85 if ( QApplication::desktop()->width() > 320 ) 85 if ( QApplication::desktop()->width() > 320 )
86 mSummaryEdit->setMaximumHeight( hei +6 ); 86 mSummaryEdit->setMaximumHeight( hei +6 );
87 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); 87 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding );
88 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } 88 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink }
89 // mSummaryEdit = new QLineEdit(parent); 89 // mSummaryEdit = new QLineEdit(parent);
90 headerLayout->addWidget(mSummaryEdit,1,1); 90 headerLayout->addWidget(mSummaryEdit,1,1);
91 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 91 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
92 92
93 QLabel *locationLabel = new QLabel(i18n("Location:"),parent); 93 QLabel *locationLabel = new QLabel(i18n("Location:"),parent);
94 headerLayout->addWidget(locationLabel,2,0); 94 headerLayout->addWidget(locationLabel,2,0);
95 95
96 mLocationEdit = new KOLocationBox(TRUE,parent,10); 96 mLocationEdit = new KOLocationBox(TRUE,parent,10);
97 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 97 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
98 if ( QApplication::desktop()->width() > 320 ) 98 if ( QApplication::desktop()->width() > 320 )
99 mLocationEdit->setMaximumHeight( hei + 6); 99 mLocationEdit->setMaximumHeight( hei + 6);
100 100
101 // mLocationEdit = new QLineEdit(parent); 101 // mLocationEdit = new QLineEdit(parent);
102 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 102 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
103 headerLayout->addWidget(mLocationEdit,2,1); 103 headerLayout->addWidget(mLocationEdit,2,1);
104 headerLayout->setColStretch( 1, 10); 104 headerLayout->setColStretch( 1, 10);
105} 105}
106void KOEditorGeneral::setFocusOn( int i ) 106void KOEditorGeneral::setFocusOn( int i )
107{ 107{
108 qApp->processEvents(); 108 qApp->processEvents();
109 if ( i == 1 ) { 109 if ( i == 1 ) {
110 mDescriptionEdit->setFocus(); 110 mDescriptionEdit->setFocus();
111 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); 111 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333);
112 } 112 }
113 if ( i == 2 ) { 113 if ( i == 2 ) {
114 mSummaryEdit->setFocus(); 114 mSummaryEdit->setFocus();
115 } 115 }
116 116
117} 117}
118void KOEditorGeneral::editCategories() 118void KOEditorGeneral::editCategories()
119{ 119{
120 // qDebug("KOEditorGeneral::editCategories() "); 120 // qDebug("KOEditorGeneral::editCategories() ");
121 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 121 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
122 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); 122 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &)));
123 //KOGlobals::fitDialogToScreen( csd ); 123 //KOGlobals::fitDialogToScreen( csd );
124 csd->setColorEnabled(); 124 csd->setColorEnabled();
125 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); 125 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) );
126 csd->exec(); 126 csd->exec();
127 delete csd; 127 delete csd;
128} 128}
129void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) 129void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout)
130{ 130{
131 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); 131 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout );
132 132
133 mCategoriesButton = new QPushButton(parent); 133 mCategoriesButton = new QPushButton(parent);
134 mCategoriesButton->setText(i18n("Categories...")); 134 mCategoriesButton->setText(i18n("Categories..."));
135 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 135 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
136 categoriesLayout->addWidget(mCategoriesButton); 136 categoriesLayout->addWidget(mCategoriesButton);
137 137
138 mCategoriesLabel = new QLabel(parent); 138 mCategoriesLabel = new QLabel(parent);
139 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); 139 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
140 categoriesLayout->addWidget(mCategoriesLabel,1); 140 categoriesLayout->addWidget(mCategoriesLabel,1);
141} 141}
142 142
143void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) 143void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout)
144{ 144{
145 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); 145 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout );
146 146
147 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); 147 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent);
148 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); 148 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent);
149 secrecyLayout->addWidget(mCancelBox); 149 secrecyLayout->addWidget(mCancelBox);
150 secrecyLayout->addWidget(secrecyLabel); 150 secrecyLayout->addWidget(secrecyLabel);
151 151
152 mSecrecyCombo = new QComboBox(parent); 152 mSecrecyCombo = new QComboBox(parent);
153 mSecrecyCombo->insertStringList(Incidence::secrecyList()); 153 mSecrecyCombo->insertStringList(Incidence::secrecyList());
154 secrecyLayout->addWidget(mSecrecyCombo); 154 secrecyLayout->addWidget(mSecrecyCombo);
155} 155}
156 156
157void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) 157void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout)
158{ 158{
159 mDescriptionEdit = new KTextEdit(parent); 159 mDescriptionEdit = new KTextEdit(parent);
160 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); 160 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont );
161 mDescriptionEdit->append(""); 161 mDescriptionEdit->append("");
162 mDescriptionEdit->setReadOnly(false); 162 mDescriptionEdit->setReadOnly(false);
163 mDescriptionEdit->setOverwriteMode(false); 163 mDescriptionEdit->setOverwriteMode(false);
164 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); 164 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth );
165 topLayout->addWidget(mDescriptionEdit); 165 topLayout->addWidget(mDescriptionEdit);
166#ifndef DESKTOP_VERSION 166#ifndef DESKTOP_VERSION
167 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); 167 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold );
168#endif 168#endif
169 169
170} 170}
171 171
172void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) 172void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout)
173{ 173{
174 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); 174 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout);
175 175
176 //mAlarmBell = new QLabel(parent); 176 //mAlarmBell = new QLabel(parent);
177 //mAlarmBell->setPixmap(SmallIcon("bell")); 177 //mAlarmBell->setPixmap(SmallIcon("bell"));
178 //alarmLayout->addWidget(mAlarmBell); 178 //alarmLayout->addWidget(mAlarmBell);
179 if ( QApplication::desktop()->width() < 320 ) 179 if ( QApplication::desktop()->width() < 320 )
180 mAlarmButton = new QCheckBox(i18n("Rem."),parent); 180 mAlarmButton = new QCheckBox(i18n("Rem."),parent);
181 else 181 else
182 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); 182 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent);
183 183
184 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); 184 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool)));
185 alarmLayout->addWidget(mAlarmButton); 185 alarmLayout->addWidget(mAlarmButton);
186 186
187 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; 187 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
188 alarmLayout->addWidget(mAlarmTimeEdit); 188 alarmLayout->addWidget(mAlarmTimeEdit);
189 mAlarmIncrCombo = new QComboBox(false, parent); 189 mAlarmIncrCombo = new QComboBox(false, parent);
190 if ( QApplication::desktop()->width() < 320 ) { 190 if ( QApplication::desktop()->width() < 320 ) {
191 mAlarmIncrCombo->insertItem(i18n("min")); 191 mAlarmIncrCombo->insertItem(i18n("min"));
192 mAlarmIncrCombo->insertItem(i18n("hou")); 192 mAlarmIncrCombo->insertItem(i18n("hou"));
193 mAlarmIncrCombo->insertItem(i18n("day")); 193 mAlarmIncrCombo->insertItem(i18n("day"));
194 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); 194 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() );
195 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); 195 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() );
196 } else { 196 } else {
197 mAlarmIncrCombo->insertItem(i18n("minute(s)")); 197 mAlarmIncrCombo->insertItem(i18n("minute(s)"));
198 mAlarmIncrCombo->insertItem(i18n("hour(s)")); 198 mAlarmIncrCombo->insertItem(i18n("hour(s)"));
199 mAlarmIncrCombo->insertItem(i18n("day(s)")); 199 mAlarmIncrCombo->insertItem(i18n("day(s)"));
200 } 200 }
201 201
202 // mAlarmIncrCombo->setMinimumHeight(20); 202 // mAlarmIncrCombo->setMinimumHeight(20);
203 alarmLayout->addWidget(mAlarmIncrCombo); 203 alarmLayout->addWidget(mAlarmIncrCombo);
204 mAlarmSoundButton = new QPushButton(parent); 204 mAlarmSoundButton = new QPushButton(parent);
205 mAlarmSoundButton->setPixmap(SmallIcon("playsound")); 205 mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
206 mAlarmSoundButton->setToggleButton(true); 206 mAlarmSoundButton->setToggleButton(true);
207 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 207 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
208 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); 208 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
209 alarmLayout->addWidget(mAlarmSoundButton); 209 alarmLayout->addWidget(mAlarmSoundButton);
210 210
211 mAlarmProgramButton = new QPushButton(parent); 211 mAlarmProgramButton = new QPushButton(parent);
212 mAlarmProgramButton->setPixmap(SmallIcon("run")); 212 mAlarmProgramButton->setPixmap(SmallIcon("run"));
213 mAlarmProgramButton->setToggleButton(true); 213 mAlarmProgramButton->setToggleButton(true);
214 QToolTip::add(mAlarmProgramButton, i18n("No program set")); 214 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
215 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); 215 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram()));
216 alarmLayout->addWidget(mAlarmProgramButton); 216 alarmLayout->addWidget(mAlarmProgramButton);
217 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); 217 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 );
218 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); 218 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 );
219 // if ( KOPrefs::instance()->mCompactDialogs ) { 219 // if ( KOPrefs::instance()->mCompactDialogs ) {
220 // mAlarmSoundButton->hide(); 220 // mAlarmSoundButton->hide();
221 // mAlarmProgramButton->hide(); 221 // mAlarmProgramButton->hide();
222 // } 222 // }
223} 223}
224 224
225void KOEditorGeneral::pickAlarmSound() 225void KOEditorGeneral::pickAlarmSound()
226{ 226{
227 227
228 qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); 228 qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() );
229 //QString prefix = mAlarmSound; 229 //QString prefix = mAlarmSound;
230 if (!mAlarmSoundButton->isOn()) { 230 if (!mAlarmSoundButton->isOn()) {
231 mAlarmSoundButton->setOn(true); 231 mAlarmSoundButton->setOn(true);
232 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); 232 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
233 } else { 233 } else {
234 QString fileName(KFileDialog::getOpenFileName(mAlarmSound, 234 QString fileName(KFileDialog::getOpenFileName(mAlarmSound,
235 i18n("*.wav|Wav Files"), 0)); 235 i18n("*.wav|Wav Files"), 0));
236 if (!fileName.isEmpty()) { 236 if (!fileName.isEmpty()) {
237 mAlarmSound = fileName; 237 mAlarmSound = fileName;
238 QToolTip::remove(mAlarmSoundButton); 238 QToolTip::remove(mAlarmSoundButton);
239 QString dispStr = i18n("Playing '%1'").arg(fileName); 239 QString dispStr = i18n("Playing '%1'").arg(fileName);
240 QToolTip::add(mAlarmSoundButton, dispStr); 240 QToolTip::add(mAlarmSoundButton, dispStr);
241 mAlarmProgramButton->setOn(false); 241 mAlarmProgramButton->setOn(false);
242 mAlarmSoundButton->setOn(true); 242 mAlarmSoundButton->setOn(true);
243 } else { 243 } else {
244 mAlarmProgramButton->setOn(true); 244 mAlarmProgramButton->setOn(true);
245 mAlarmSoundButton->setOn(false); 245 mAlarmSoundButton->setOn(false);
246 246
247 } 247 }
248 } 248 }
249#if 0 249#if 0
250 if (mAlarmProgramButton->isOn()) 250 if (mAlarmProgramButton->isOn())
251 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); 251 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
252 if ( mAlarmSoundButton->isOn()) 252 if ( mAlarmSoundButton->isOn())
253 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); 253 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
254#endif 254#endif
255} 255}
256 256
257void KOEditorGeneral::pickAlarmProgram() 257void KOEditorGeneral::pickAlarmProgram()
258{ 258{
259 if (!mAlarmProgramButton->isOn()) { 259 if (!mAlarmProgramButton->isOn()) {
260 mAlarmProgramButton->setOn(true); 260 mAlarmProgramButton->setOn(true);
261 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); 261 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
262 } else { 262 } else {
263 QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); 263 QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0));
264 if (!fileName.isEmpty()) { 264 if (!fileName.isEmpty()) {
265 mAlarmProgram = fileName; 265 mAlarmProgram = fileName;
266 QToolTip::remove(mAlarmProgramButton); 266 QToolTip::remove(mAlarmProgramButton);
267 QString dispStr = i18n("Running '%1'").arg(fileName); 267 QString dispStr = i18n("Running '%1'").arg(fileName);
268 QToolTip::add(mAlarmProgramButton, dispStr); 268 QToolTip::add(mAlarmProgramButton, dispStr);
269 mAlarmSoundButton->setOn(false); 269 mAlarmSoundButton->setOn(false);
270 mAlarmProgramButton->setOn(true); 270 mAlarmProgramButton->setOn(true);
271 } else { 271 } else {
272 mAlarmProgramButton->setOn(false); 272 mAlarmProgramButton->setOn(false);
273 mAlarmSoundButton->setOn(true); 273 mAlarmSoundButton->setOn(true);
274 } 274 }
275 } 275 }
276#if 0 276#if 0
277 if (mAlarmProgramButton->isOn()) 277 if (mAlarmProgramButton->isOn())
278 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); 278 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
279 if ( mAlarmSoundButton->isOn()) 279 if ( mAlarmSoundButton->isOn())
280 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); 280 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
281#endif 281#endif
282} 282}
283 283
284 284
285QString KOEditorGeneral::getFittingPath( const QString s ) 285QString KOEditorGeneral::getFittingPath( const QString s )
286{ 286{
287 int maxlen = 50; 287 int maxlen = 50;
288 if ( QApplication::desktop()->width() < 640 ) { 288 if ( QApplication::desktop()->width() < 640 ) {
289 if ( QApplication::desktop()->width() < 320 ) 289 if ( QApplication::desktop()->width() < 320 )
290 maxlen = 22; 290 maxlen = 22;
291 else 291 else
292 maxlen = 35; 292 maxlen = 35;
293 } 293 }
294 if ( s.length() > maxlen ) { 294 if ( s.length() > maxlen ) {
295 return "..."+s.right(maxlen -3); 295 return "..."+s.right(maxlen -3);
296 } 296 }
297 return s; 297 return s;
298} 298}
299 299
300void KOEditorGeneral::enableAlarmEdit(bool enable) 300void KOEditorGeneral::enableAlarmEdit(bool enable)
301{ 301{
302 if ( enable ) { 302 if ( enable ) {
303 if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { 303 if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) {
304 mAlarmSoundButton->setOn( true ); 304 mAlarmSoundButton->setOn( true );
305 if ( mAlarmSound.isEmpty() ) 305 if ( mAlarmSound.isEmpty() )
306 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 306 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
307 else { 307 else {
308 if ( ! QFile::exists( mAlarmSound ) ) 308 if ( ! QFile::exists( mAlarmSound ) )
309 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 309 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
310 } 310 }
311 } 311 }
312 } 312 }
313 ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage); 313 ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage);
314 mAlarmTimeEdit->setEnabled(enable); 314 mAlarmTimeEdit->setEnabled(enable);
315 mAlarmSoundButton->setEnabled(enable); 315 mAlarmSoundButton->setEnabled(enable);
316 mAlarmProgramButton->setEnabled(enable); 316 mAlarmProgramButton->setEnabled(enable);
317 mAlarmIncrCombo->setEnabled(enable); 317 mAlarmIncrCombo->setEnabled(enable);
318} 318}
319 319
320void KOEditorGeneral::disableAlarmEdit(bool disable) 320void KOEditorGeneral::disableAlarmEdit(bool disable)
321{ 321{
322 enableAlarmEdit( !disable ); 322 enableAlarmEdit( !disable );
323} 323}
324 324
325void KOEditorGeneral::enableAlarm( bool enable ) 325void KOEditorGeneral::enableAlarm( bool enable )
326{ 326{
327 enableAlarmEdit( enable ); 327 enableAlarmEdit( enable );
328} 328}
329 329
330void KOEditorGeneral::alarmDisable(bool disable) 330void KOEditorGeneral::alarmDisable(bool disable)
331{ 331{
332 if (!disable) { 332 if (!disable) {
333 //mAlarmBell->setEnabled(true); 333 //mAlarmBell->setEnabled(true);
334 mAlarmButton->setEnabled(true); 334 mAlarmButton->setEnabled(true);
335 } else { 335 } else {
336 //mAlarmBell->setEnabled(false); 336 //mAlarmBell->setEnabled(false);
337 mAlarmButton->setEnabled(false); 337 mAlarmButton->setEnabled(false);
338 mAlarmButton->setChecked(false); 338 mAlarmButton->setChecked(false);
339 mAlarmTimeEdit->setEnabled(false); 339 mAlarmTimeEdit->setEnabled(false);
340 mAlarmSoundButton->setEnabled(false); 340 mAlarmSoundButton->setEnabled(false);
341 mAlarmProgramButton->setEnabled(false); 341 mAlarmProgramButton->setEnabled(false);
342 mAlarmIncrCombo->setEnabled(false); 342 mAlarmIncrCombo->setEnabled(false);
343 } 343 }
344} 344}
345 345
346void KOEditorGeneral::setCategories(const QString &str) 346void KOEditorGeneral::setCategories(const QString &str)
347{ 347{
348 mCategoriesLabel->setText(str); 348 mCategoriesLabel->setText(str);
349} 349}
350 350
351void KOEditorGeneral::setDefaults(bool allDay) 351void KOEditorGeneral::setDefaults(bool allDay)
352{ 352{
353#if 0 353#if 0
354 mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName()); 354 mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName());
355#endif 355#endif
356 356
357 mAlarmMessage = i18n("Edit new item"); 357 mAlarmMessage = i18n("Edit new item");
358 enableAlarmEdit( !allDay ); 358 enableAlarmEdit( !allDay );
359 359
360 // TODO: Implement a KPrefsComboItem to solve this in a clean way. 360 // TODO: Implement a KPrefsComboItem to solve this in a clean way.
361 int alarmTime; 361 int alarmTime;
362 int a[] = { 1,5,10,15,30,60,180, 1440 }; 362 int a[] = { 1,5,10,15,30,60,180, 1440 };
363 int index = KOPrefs::instance()->mAlarmTime; 363 int index = KOPrefs::instance()->mAlarmTime;
364 if (index < 0 || index > 7) { 364 if (index < 0 || index > 7) {
365 alarmTime = 15; 365 alarmTime = 15;
366 } else { 366 } else {
367 alarmTime = a[index]; 367 alarmTime = a[index];
368 } 368 }
369 mAlarmButton ->setChecked( false ); 369 mAlarmButton ->setChecked( false );
370 mAlarmTimeEdit->setValue(alarmTime); 370 mAlarmTimeEdit->setValue(alarmTime);
371 mAlarmIncrCombo->setCurrentItem(0); 371 mAlarmIncrCombo->setCurrentItem(0);
372 enableAlarmEdit( false ); 372 enableAlarmEdit( false );
373 //alarmDisable (false); 373 //alarmDisable (false);
374 mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic); 374 mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic);
375 mCancelBox->setChecked( false ); 375 mCancelBox->setChecked( false );
376 mSummaryEdit->setEditText(""); 376 mSummaryEdit->setEditText("");
377 mLocationEdit->setEditText(""); 377 mLocationEdit->setEditText("");
378 mDescriptionEdit->setText(""); 378 mDescriptionEdit->setText("");
379 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 379 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
380 setCategories(""); 380 setCategories("");
381} 381}
382void KOEditorGeneral::setSecrecy( int num ) 382void KOEditorGeneral::setSecrecy( int num )
383{ 383{
384 mSecrecyCombo->setCurrentItem(num); 384 mSecrecyCombo->setCurrentItem(num);
385} 385}
386void KOEditorGeneral::readIncidence(Incidence *event) 386void KOEditorGeneral::readIncidence(Incidence *event)
387{ 387{
388 388
389 mAlarmMessage = event->summary(); 389 mAlarmMessage = event->summary();
390 if ( ! event->location().isEmpty() )
391 mAlarmMessage += " ("+event->location()+")";
390 mAlarmIncrCombo->setCurrentItem(0); 392 mAlarmIncrCombo->setCurrentItem(0);
391 mSummaryEdit->setEditText(event->summary()); 393 mSummaryEdit->setEditText(event->summary());
392 mLocationEdit->setEditText(event->location()); 394 mLocationEdit->setEditText(event->location());
393 mDescriptionEdit->setText(event->description()); 395 mDescriptionEdit->setText(event->description());
394 396
395#if 0 397#if 0
396 // organizer information 398 // organizer information
397 mOwnerLabel->setText(i18n("Owner: ") + event->organizer()); 399 mOwnerLabel->setText(i18n("Owner: ") + event->organizer());
398#endif 400#endif
399 401
400 enableAlarmEdit( event->isAlarmEnabled() ); 402 enableAlarmEdit( event->isAlarmEnabled() );
401 //qDebug("KOEditorGeneral::readIncidence(Incidence *event) "); 403 //qDebug("KOEditorGeneral::readIncidence(Incidence *event) ");
402 if(!event->isAlarmEnabled()) { 404 if(!event->isAlarmEnabled()) {
403 // TODO: Implement a KPrefsComboItem to solve this in a clean way. 405 // TODO: Implement a KPrefsComboItem to solve this in a clean way.
404 int alarmTime; 406 int alarmTime;
405 int a[] = { 1,5,10,15,30,60,180, 1440 }; 407 int a[] = { 1,5,10,15,30,60,180, 1440 };
406 int index = KOPrefs::instance()->mAlarmTime; 408 int index = KOPrefs::instance()->mAlarmTime;
407 if (index < 0 || index > 7) { 409 if (index < 0 || index > 7) {
408 alarmTime = 15; 410 alarmTime = 15;
409 } else { 411 } else {
410 alarmTime = a[index]; 412 alarmTime = a[index];
411 } 413 }
412 mAlarmTimeEdit->setValue(alarmTime); 414 mAlarmTimeEdit->setValue(alarmTime);
413 } 415 }
414 mAlarmButton->setChecked( event->isAlarmEnabled() ); 416 mAlarmButton->setChecked( event->isAlarmEnabled() );
415 mSecrecyCombo->setCurrentItem(event->secrecy()); 417 mSecrecyCombo->setCurrentItem(event->secrecy());
416 mCancelBox->setChecked( event->cancelled() ); 418 mCancelBox->setChecked( event->cancelled() );
417 mAlarmProgramButton->setOn(false); 419 mAlarmProgramButton->setOn(false);
418 mAlarmSoundButton->setOn(false); 420 mAlarmSoundButton->setOn(false);
419 421
420 // set up alarm stuff 422 // set up alarm stuff
421 QPtrList<Alarm> alarms = event->alarms(); 423 QPtrList<Alarm> alarms = event->alarms();
422 Alarm* alarm; 424 Alarm* alarm;
423 mAlarmIncrCombo->setCurrentItem(0); 425 mAlarmIncrCombo->setCurrentItem(0);
424 for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) { 426 for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) {
425 int offset; 427 int offset;
426 if ( alarm->hasTime() ) { 428 if ( alarm->hasTime() ) {
427 QDateTime t = alarm->time(); 429 QDateTime t = alarm->time();
428 offset = event->dtStart().secsTo( t ); 430 offset = event->dtStart().secsTo( t );
429 } else { 431 } else {
430 offset = alarm->startOffset().asSeconds(); 432 offset = alarm->startOffset().asSeconds();
431 } 433 }
432 if ( offset != 0 ) { 434 if ( offset != 0 ) {
433 offset = offset / -60; // make minutes 435 offset = offset / -60; // make minutes
434 if (offset % 60 == 0) { // divides evenly into hours? 436 if (offset % 60 == 0) { // divides evenly into hours?
435 offset = offset / 60; 437 offset = offset / 60;
436 mAlarmIncrCombo->setCurrentItem(1); 438 mAlarmIncrCombo->setCurrentItem(1);
437 if (offset % 24 == 0) { // divides evenly into days? 439 if (offset % 24 == 0) { // divides evenly into days?
438 offset = offset / 24; 440 offset = offset / 24;
439 mAlarmIncrCombo->setCurrentItem(2); 441 mAlarmIncrCombo->setCurrentItem(2);
440 } 442 }
441 } 443 }
442 } 444 }
443 mAlarmTimeEdit->setValue( offset ); 445 mAlarmTimeEdit->setValue( offset );
444 if (alarm->type() == Alarm::Procedure) { 446 if (alarm->type() == Alarm::Procedure) {
445 447
446 mAlarmProgram = alarm->programFile(); 448 mAlarmProgram = alarm->programFile();
447 mAlarmProgramButton->setOn(true); 449 mAlarmProgramButton->setOn(true);
448 QString dispStr = i18n("Running '%1'").arg(mAlarmProgram); 450 QString dispStr = i18n("Running '%1'").arg(mAlarmProgram);
449 QToolTip::add(mAlarmProgramButton, dispStr); 451 QToolTip::add(mAlarmProgramButton, dispStr);
450 } 452 }
451 else if (alarm->type() == Alarm::Audio) { 453 else if (alarm->type() == Alarm::Audio) {
452 mAlarmSound = alarm->audioFile(); 454 mAlarmSound = alarm->audioFile();
453 if ( ! QFile::exists( mAlarmSound ) ) 455 if ( ! QFile::exists( mAlarmSound ) )
454 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 456 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
455 mAlarmSoundButton->setOn(true); 457 mAlarmSoundButton->setOn(true);
456 QString dispStr = i18n("Playing '%1'").arg(mAlarmSound); 458 QString dispStr = i18n("Playing '%1'").arg(mAlarmSound);
457 QToolTip::add(mAlarmSoundButton, dispStr); 459 QToolTip::add(mAlarmSoundButton, dispStr);
458 } 460 }
459 mAlarmButton->setChecked(alarm->enabled()); 461 mAlarmButton->setChecked(alarm->enabled());
460 enableAlarmEdit( alarm->enabled() ); 462 enableAlarmEdit( alarm->enabled() );
461 //qDebug("nableAlarmEdit( alarm->enabled() )********* "); 463 //qDebug("nableAlarmEdit( alarm->enabled() )********* ");
462 // TODO: Deal with multiple alarms 464 // TODO: Deal with multiple alarms
463 break; // For now, stop after the first alarm 465 break; // For now, stop after the first alarm
464 } 466 }
465 467
466 setCategories(event->categoriesStr()); 468 setCategories(event->categoriesStr());
467} 469}
468 470
469void KOEditorGeneral::writeIncidence(Incidence *event) 471void KOEditorGeneral::writeIncidence(Incidence *event)
470{ 472{
471 // kdDebug() << "KOEditorGeneral::writeEvent()" << endl; 473 // kdDebug() << "KOEditorGeneral::writeEvent()" << endl;
472 mLocationEdit->save(KOLocationBox::LOCATION); 474 mLocationEdit->save(KOLocationBox::LOCATION);
473 event->setSummary(mSummaryEdit->currentText()); 475 event->setSummary(mSummaryEdit->currentText());
474 event->setLocation(mLocationEdit->currentText()); 476 event->setLocation(mLocationEdit->currentText());
475 event->setDescription(mDescriptionEdit->text()); 477 event->setDescription(mDescriptionEdit->text());
476 event->setCategories(mCategoriesLabel->text()); 478 event->setCategories(mCategoriesLabel->text());
477 event->setSecrecy(mSecrecyCombo->currentItem()); 479 event->setSecrecy(mSecrecyCombo->currentItem());
478 event->setCancelled(mCancelBox->isChecked() );; 480 event->setCancelled(mCancelBox->isChecked() );;
479 // alarm stuff 481 // alarm stuff
480 if (mAlarmButton->isChecked()) { 482 if (mAlarmButton->isChecked()) {
481 if (event->alarms().count() == 0) 483 if (event->alarms().count() == 0)
482 event->newAlarm(); 484 event->newAlarm();
483 QPtrList<Alarm> alarms = event->alarms(); 485 QPtrList<Alarm> alarms = event->alarms();
484 Alarm *alarm; 486 Alarm *alarm;
485 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 487 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
486 alarm->setEnabled(true); 488 alarm->setEnabled(true);
487 int j = mAlarmTimeEdit->value()* -60; 489 int j = mAlarmTimeEdit->value()* -60;
488 if (mAlarmIncrCombo->currentItem() == 1) 490 if (mAlarmIncrCombo->currentItem() == 1)
489 j = j * 60; 491 j = j * 60;
490 else if (mAlarmIncrCombo->currentItem() == 2) 492 else if (mAlarmIncrCombo->currentItem() == 2)
491 j = j * (60 * 24); 493 j = j * (60 * 24);
492 alarm->setStartOffset( j ); 494 alarm->setStartOffset( j );
493 495
494 if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) { 496 if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) {
495 alarm->setProcedureAlarm(mAlarmProgram); 497 alarm->setProcedureAlarm(mAlarmProgram);
496 } 498 }
497 else if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) 499 else if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn())
498 alarm->setAudioAlarm(mAlarmSound); 500 alarm->setAudioAlarm(mAlarmSound);
499 else 501 else
500 alarm->setType(Alarm::Invalid); 502 alarm->setType(Alarm::Invalid);
501 //alarm->setAudioAlarm("default"); 503 //alarm->setAudioAlarm("default");
502 // TODO: Deal with multiple alarms 504 // TODO: Deal with multiple alarms
503 break; // For now, stop after the first alarm 505 break; // For now, stop after the first alarm
504 } 506 }
505 } else { 507 } else {
506 Alarm* alarm = event->alarms().first(); 508 Alarm* alarm = event->alarms().first();
507 if ( alarm ) { 509 if ( alarm ) {
508 alarm->setEnabled(false); 510 alarm->setEnabled(false);
509 alarm->setType(Alarm::Invalid); 511 alarm->setType(Alarm::Invalid);
510 } 512 }
511 } 513 }
512} 514}