summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditorgeneral.cpp7
-rw-r--r--korganizer/koeditorgeneral.h2
-rw-r--r--korganizer/koeventeditor.cpp4
-rw-r--r--korganizer/koeventviewer.cpp8
-rw-r--r--korganizer/koincidenceeditor.cpp5
-rw-r--r--korganizer/koincidenceeditor.h3
-rw-r--r--korganizer/kotodoeditor.cpp4
7 files changed, 28 insertions, 5 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index 92e5a0f..21f220c 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -50,193 +50,192 @@
50 50
51#include "koprefs.h" 51#include "koprefs.h"
52#include "koglobals.h" 52#include "koglobals.h"
53 53
54#include "koeditorgeneral.h" 54#include "koeditorgeneral.h"
55#include "kolocationbox.h" 55#include "kolocationbox.h"
56#ifndef DESKTOP_VERSION 56#ifndef DESKTOP_VERSION
57#include <qpe/qpeapplication.h> 57#include <qpe/qpeapplication.h>
58#else 58#else
59#include <qapplication.h> 59#include <qapplication.h>
60#endif 60#endif
61 61
62KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : 62KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) :
63 QObject( parent, name) 63 QObject( parent, name)
64{ 64{
65 mNextFocus = 0; 65 mNextFocus = 0;
66} 66}
67 67
68KOEditorGeneral::~KOEditorGeneral() 68KOEditorGeneral::~KOEditorGeneral()
69{ 69{
70} 70}
71 71
72void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) 72void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
73{ 73{
74 QGridLayout *headerLayout = new QGridLayout(topLayout); 74 QGridLayout *headerLayout = new QGridLayout(topLayout);
75 75
76#if 0 76#if 0
77 mOwnerLabel = new QLabel(i18n("Owner:"),parent); 77 mOwnerLabel = new QLabel(i18n("Owner:"),parent);
78 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); 78 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1);
79#endif 79#endif
80 // 1 on pda 80 // 1 on pda
81 // 11 on desktop 81 // 11 on desktop
82 headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 ); 82 headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 );
83 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); 83 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent);
84 headerLayout->addWidget(summaryLabel,0,0); 84 headerLayout->addWidget(summaryLabel,0,0);
85 85
86 mSummaryEdit = new KOLocationBox(TRUE,parent, 50); 86 mSummaryEdit = new KOLocationBox(TRUE,parent, 50);
87 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 87 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
88 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); 88 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) );
89 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); 89 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() );
90 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; 90 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2;
91 if ( QApplication::desktop()->width() > 320 ) 91 if ( QApplication::desktop()->width() > 320 )
92 mSummaryEdit->setMaximumHeight( hei +6 ); 92 mSummaryEdit->setMaximumHeight( hei +6 );
93 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); 93 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding );
94 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } 94 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink }
95 // mSummaryEdit = new QLineEdit(parent); 95 // mSummaryEdit = new QLineEdit(parent);
96 if ( QApplication::desktop()->height() < 320 ) 96 if ( QApplication::desktop()->height() < 320 )
97 headerLayout->addWidget(mSummaryEdit,0,1); 97 headerLayout->addWidget(mSummaryEdit,0,1);
98 else 98 else
99 headerLayout->addMultiCellWidget(mSummaryEdit,0,0,1,2); 99 headerLayout->addMultiCellWidget(mSummaryEdit,0,0,1,2);
100 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 100 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
101 101
102 QLabel *locationLabel = new QLabel(i18n("Location:"),parent); 102 QLabel *locationLabel = new QLabel(i18n("Location:"),parent);
103 if ( QApplication::desktop()->height() < 320 ) 103 if ( QApplication::desktop()->height() < 320 )
104 headerLayout->addWidget(locationLabel,0,2); 104 headerLayout->addWidget(locationLabel,0,2);
105 else 105 else
106 headerLayout->addWidget(locationLabel,1,0); 106 headerLayout->addWidget(locationLabel,1,0);
107 107
108 mLocationEdit = new KOLocationBox(TRUE,parent,30); 108 mLocationEdit = new KOLocationBox(TRUE,parent,30);
109 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 109 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
110 if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 ) 110 if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 )
111 mLocationEdit->setMaximumHeight( hei + 6); 111 mLocationEdit->setMaximumHeight( hei + 6);
112 112
113 // mLocationEdit = new QLineEdit(parent); 113 // mLocationEdit = new QLineEdit(parent);
114 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 114 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
115 115
116 mCalendarBox = new QComboBox ( parent ); 116 mCalendarBox = new QComboBox ( parent );
117 mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 117 mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
118 if ( QApplication::desktop()->height() < 320 ) { 118 if ( QApplication::desktop()->height() < 320 ) {
119 headerLayout->addWidget(mLocationEdit,0,3); 119 headerLayout->addWidget(mLocationEdit,0,3);
120 headerLayout->addWidget(mCalendarBox,0,4); 120 headerLayout->addWidget(mCalendarBox,0,4);
121 headerLayout->setColStretch( 1, 10); 121 headerLayout->setColStretch( 1, 10);
122 headerLayout->setColStretch( 3, 10); 122 headerLayout->setColStretch( 3, 10);
123 mCalendarBox->setMaximumWidth( 64 ); 123 mCalendarBox->setMaximumWidth( 64 );
124 } 124 }
125 else { 125 else {
126 headerLayout->addWidget(mLocationEdit,1,1); 126 headerLayout->addWidget(mLocationEdit,1,1);
127 headerLayout->addWidget(mCalendarBox,1,2); 127 headerLayout->addWidget(mCalendarBox,1,2);
128 int str = 3; 128 int str = 3;
129 if ( QApplication::desktop()->width() < 640 ) { 129 if ( QApplication::desktop()->width() < 640 ) {
130 --str; 130 --str;
131 if ( QApplication::desktop()->width() < 320 ) 131 if ( QApplication::desktop()->width() < 320 )
132 --str; 132 --str;
133 } 133 }
134 headerLayout->setColStretch( 1, str); 134 headerLayout->setColStretch( 1, str);
135 headerLayout->setColStretch( 2, 1); 135 headerLayout->setColStretch( 2, 1);
136 } 136 }
137 137
138} 138}
139void KOEditorGeneral::setFocusOn( int i ) 139void KOEditorGeneral::setFocusOn( int i )
140{ 140{
141 mNextFocus = i; 141 mNextFocus = i;
142 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); 142 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() ));
143} 143}
144void KOEditorGeneral::slotSetFocusOn() 144void KOEditorGeneral::slotSetFocusOn()
145{ 145{
146 mNextFocus;
147 if ( mNextFocus == 1 ) { 146 if ( mNextFocus == 1 ) {
148 mDescriptionEdit->setFocus(); 147 mDescriptionEdit->setFocus();
149 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); 148 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333);
150 } 149 }
151 if ( mNextFocus == 2 ) { 150 if ( mNextFocus == 2 ) {
152 mSummaryEdit->setFocus(); 151 mSummaryEdit->setFocus();
153 } 152 }
154} 153}
155void KOEditorGeneral::editCategories() 154void KOEditorGeneral::editCategories()
156{ 155{
157 // qDebug("KOEditorGeneral::editCategories() "); 156 // qDebug("KOEditorGeneral::editCategories() ");
158 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 157 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
159 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); 158 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &)));
160 //KOGlobals::fitDialogToScreen( csd ); 159 //KOGlobals::fitDialogToScreen( csd );
161 csd->setColorEnabled(); 160 csd->setColorEnabled();
162 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); 161 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) );
163 csd->exec(); 162 csd->exec();
164 delete csd; 163 delete csd;
165} 164}
166 165
167void KOEditorGeneral::showCatPopup() 166void KOEditorGeneral::showCatPopup()
168{ 167{
169 mCatPopup->clear(); 168 mCatPopup->clear();
170 QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text()); 169 QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text());
171 int index = 0; 170 int index = 0;
172 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 171 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
173 it != KOPrefs::instance()->mCustomCategories.end (); 172 it != KOPrefs::instance()->mCustomCategories.end ();
174 ++it) { 173 ++it) {
175 mCatPopup->insertItem (*it, index ); 174 mCatPopup->insertItem (*it, index );
176 //mCategory[index] = *it; 175 //mCategory[index] = *it;
177 if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true); 176 if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true);
178 ++index; 177 ++index;
179 } 178 }
180} 179}
181void KOEditorGeneral::selectedCatPopup( int index ) 180void KOEditorGeneral::selectedCatPopup( int index )
182{ 181{
183 QStringList categories = QStringList::split (",", mCategoriesLabel->text()); 182 QStringList categories = QStringList::split (",", mCategoriesLabel->text());
184 QString colcat = categories.first(); 183 QString colcat = categories.first();
185 if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) 184 if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ())
186 categories.remove (KOPrefs::instance()->mCustomCategories[index]); 185 categories.remove (KOPrefs::instance()->mCustomCategories[index]);
187 else 186 else
188 categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); 187 categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]);
189 categories.sort (); 188 categories.sort ();
190 if ( !colcat.isEmpty() ) { 189 if ( !colcat.isEmpty() ) {
191 if ( categories.find ( colcat ) != categories.end () ) { 190 if ( categories.find ( colcat ) != categories.end () ) {
192 categories.remove( colcat ); 191 categories.remove( colcat );
193 categories.prepend( colcat ); 192 categories.prepend( colcat );
194 } 193 }
195 } 194 }
196 setCategories( categories.join(",") ); 195 setCategories( categories.join(",") );
197} 196}
198 197
199void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) 198void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout)
200{ 199{
201 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); 200 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout );
202 mCatPopup = new QPopupMenu ( parent ); 201 mCatPopup = new QPopupMenu ( parent );
203 mCatPopup->setCheckable (true); 202 mCatPopup->setCheckable (true);
204 connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup())); 203 connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup()));
205 connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int ))); 204 connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int )));
206 mCategoriesButton = new QPushButton(parent); 205 mCategoriesButton = new QPushButton(parent);
207 mCategoriesButton->setText(i18n("Categories...")); 206 mCategoriesButton->setText(i18n("Categories..."));
208 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 207 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
209 //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 208 //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
210 categoriesLayout->addWidget(mCategoriesButton); 209 categoriesLayout->addWidget(mCategoriesButton);
211 mCategoriesLabel = new QPushButton(parent);//new QLabel(parent); 210 mCategoriesLabel = new QPushButton(parent);//new QLabel(parent);
212 mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); 211 mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
213 mCategoriesLabel->setPopup( mCatPopup ); 212 mCategoriesLabel->setPopup( mCatPopup );
214 //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); 213 //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
215 categoriesLayout->addWidget(mCategoriesLabel,1); 214 categoriesLayout->addWidget(mCategoriesLabel,1);
216} 215}
217 216
218void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) 217void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout)
219{ 218{
220 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); 219 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout );
221 220
222 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); 221 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent);
223 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); 222 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent);
224 secrecyLayout->addWidget(mCancelBox); 223 secrecyLayout->addWidget(mCancelBox);
225 secrecyLayout->addWidget(secrecyLabel); 224 secrecyLayout->addWidget(secrecyLabel);
226 225
227 mSecrecyCombo = new QComboBox(parent); 226 mSecrecyCombo = new QComboBox(parent);
228 mSecrecyCombo->insertStringList(Incidence::secrecyList()); 227 mSecrecyCombo->insertStringList(Incidence::secrecyList());
229 secrecyLayout->addWidget(mSecrecyCombo); 228 secrecyLayout->addWidget(mSecrecyCombo);
230} 229}
231 230
232void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) 231void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout)
233{ 232{
234 mDescriptionEdit = new KTextEdit(parent); 233 mDescriptionEdit = new KTextEdit(parent);
235 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); 234 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont );
236 mDescriptionEdit->append(""); 235 mDescriptionEdit->append("");
237 mDescriptionEdit->setReadOnly(false); 236 mDescriptionEdit->setReadOnly(false);
238 mDescriptionEdit->setOverwriteMode(false); 237 mDescriptionEdit->setOverwriteMode(false);
239 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); 238 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth );
240 topLayout->addWidget(mDescriptionEdit); 239 topLayout->addWidget(mDescriptionEdit);
241#ifndef DESKTOP_VERSION 240#ifndef DESKTOP_VERSION
242 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); 241 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold );
@@ -262,193 +261,193 @@ void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout)
262 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; 261 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
263 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); 262 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus );
264 alarmLayout->addWidget(mAlarmTimeEdit); 263 alarmLayout->addWidget(mAlarmTimeEdit);
265 mAlarmIncrCombo = new QComboBox(false, parent); 264 mAlarmIncrCombo = new QComboBox(false, parent);
266 if ( QApplication::desktop()->width() < 320 ) { 265 if ( QApplication::desktop()->width() < 320 ) {
267 mAlarmIncrCombo->insertItem(i18n("min")); 266 mAlarmIncrCombo->insertItem(i18n("min"));
268 mAlarmIncrCombo->insertItem(i18n("hou")); 267 mAlarmIncrCombo->insertItem(i18n("hou"));
269 mAlarmIncrCombo->insertItem(i18n("day")); 268 mAlarmIncrCombo->insertItem(i18n("day"));
270 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); 269 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() );
271 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); 270 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() );
272 } else { 271 } else {
273 mAlarmIncrCombo->insertItem(i18n("minute(s)")); 272 mAlarmIncrCombo->insertItem(i18n("minute(s)"));
274 mAlarmIncrCombo->insertItem(i18n("hour(s)")); 273 mAlarmIncrCombo->insertItem(i18n("hour(s)"));
275 mAlarmIncrCombo->insertItem(i18n("day(s)")); 274 mAlarmIncrCombo->insertItem(i18n("day(s)"));
276 } 275 }
277 276
278 // mAlarmIncrCombo->setMinimumHeight(20); 277 // mAlarmIncrCombo->setMinimumHeight(20);
279 alarmLayout->addWidget(mAlarmIncrCombo); 278 alarmLayout->addWidget(mAlarmIncrCombo);
280 mAlarmSoundButton = new QPushButton(parent); 279 mAlarmSoundButton = new QPushButton(parent);
281 mAlarmSoundButton->setPixmap(SmallIcon("playsound")); 280 mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
282 mAlarmSoundButton->setToggleButton(true); 281 mAlarmSoundButton->setToggleButton(true);
283 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 282 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
284 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); 283 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
285 alarmLayout->addWidget(mAlarmSoundButton); 284 alarmLayout->addWidget(mAlarmSoundButton);
286 285
287 mAlarmProgramButton = new QPushButton(parent); 286 mAlarmProgramButton = new QPushButton(parent);
288 mAlarmProgramButton->setPixmap(SmallIcon("run")); 287 mAlarmProgramButton->setPixmap(SmallIcon("run"));
289 mAlarmProgramButton->setToggleButton(true); 288 mAlarmProgramButton->setToggleButton(true);
290 QToolTip::add(mAlarmProgramButton, i18n("No program set")); 289 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
291 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); 290 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram()));
292 alarmLayout->addWidget(mAlarmProgramButton); 291 alarmLayout->addWidget(mAlarmProgramButton);
293 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); 292 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 );
294 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); 293 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 );
295 // if ( KOPrefs::instance()->mCompactDialogs ) { 294 // if ( KOPrefs::instance()->mCompactDialogs ) {
296 // mAlarmSoundButton->hide(); 295 // mAlarmSoundButton->hide();
297 // mAlarmProgramButton->hide(); 296 // mAlarmProgramButton->hide();
298 // } 297 // }
299} 298}
300 299
301void KOEditorGeneral::pickAlarmSound() 300void KOEditorGeneral::pickAlarmSound()
302{ 301{
303 302
304 //qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); 303 //qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() );
305 304
306 bool oldState = mAlarmSoundButton->isOn(); 305 bool oldState = mAlarmSoundButton->isOn();
307 306
308 QString fileName(KFileDialog::getOpenFileName(mAlarmSound, 307 QString fileName(KFileDialog::getOpenFileName(mAlarmSound,
309 i18n("*.wav|Wav Files"), 0)); 308 i18n("*.wav|Wav Files"), 0));
310 if (!fileName.isEmpty()) { 309 if (!fileName.isEmpty()) {
311 mAlarmSound = fileName; 310 mAlarmSound = fileName;
312 QToolTip::remove(mAlarmSoundButton); 311 QToolTip::remove(mAlarmSoundButton);
313 QString dispStr = i18n("Playing '%1'").arg(fileName); 312 QString dispStr = i18n("Playing '%1'").arg(fileName);
314 QToolTip::add(mAlarmSoundButton, dispStr); 313 QToolTip::add(mAlarmSoundButton, dispStr);
315 mAlarmProgramButton->setOn(false); 314 mAlarmProgramButton->setOn(false);
316 mAlarmSoundButton->setOn(true); 315 mAlarmSoundButton->setOn(true);
317 QToolTip::add(mAlarmProgramButton, i18n("No program set")); 316 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
318 } else { 317 } else {
319 mAlarmProgramButton->setOn(oldState); 318 mAlarmProgramButton->setOn(oldState);
320 mAlarmSoundButton->setOn(!oldState); 319 mAlarmSoundButton->setOn(!oldState);
321 320
322 321
323 } 322 }
324 323
325 if (mAlarmProgramButton->isOn()) 324 if (mAlarmProgramButton->isOn())
326 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); 325 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
327 if ( mAlarmSoundButton->isOn()) 326 if ( mAlarmSoundButton->isOn())
328 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); 327 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
329 328
330} 329}
331 330
332void KOEditorGeneral::pickAlarmProgram() 331void KOEditorGeneral::pickAlarmProgram()
333{ 332{
334 bool oldState = mAlarmProgramButton->isOn(); 333 bool oldState = mAlarmProgramButton->isOn();
335 334
336 QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); 335 QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0));
337 if (!fileName.isEmpty()) { 336 if (!fileName.isEmpty()) {
338 mAlarmProgram = fileName; 337 mAlarmProgram = fileName;
339 QToolTip::remove(mAlarmProgramButton); 338 QToolTip::remove(mAlarmProgramButton);
340 QString dispStr = i18n("Running '%1'").arg(fileName); 339 QString dispStr = i18n("Running '%1'").arg(fileName);
341 QToolTip::add(mAlarmProgramButton, dispStr); 340 QToolTip::add(mAlarmProgramButton, dispStr);
342 mAlarmSoundButton->setOn(false); 341 mAlarmSoundButton->setOn(false);
343 mAlarmProgramButton->setOn(true); 342 mAlarmProgramButton->setOn(true);
344 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 343 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
345 } else { 344 } else {
346 mAlarmProgramButton->setOn(!oldState); 345 mAlarmProgramButton->setOn(!oldState);
347 mAlarmSoundButton->setOn(oldState); 346 mAlarmSoundButton->setOn(oldState);
348 } 347 }
349 348
350 if (mAlarmProgramButton->isOn()) 349 if (mAlarmProgramButton->isOn())
351 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); 350 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
352 if ( mAlarmSoundButton->isOn()) 351 if ( mAlarmSoundButton->isOn())
353 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); 352 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
354 353
355} 354}
356 355
357 356
358QString KOEditorGeneral::getFittingPath( const QString s ) 357QString KOEditorGeneral::getFittingPath( const QString & s )
359{ 358{
360 int maxlen = 50; 359 int maxlen = 50;
361 if ( QApplication::desktop()->width() < 640 ) { 360 if ( QApplication::desktop()->width() < 640 ) {
362 if ( QApplication::desktop()->width() < 320 ) 361 if ( QApplication::desktop()->width() < 320 )
363 maxlen = 22; 362 maxlen = 22;
364 else 363 else
365 maxlen = 35; 364 maxlen = 35;
366 } 365 }
367 if ( s.length() > maxlen ) { 366 if ( s.length() > maxlen ) {
368 return "..."+s.right(maxlen -3); 367 return "..."+s.right(maxlen -3);
369 } 368 }
370 return s; 369 return s;
371} 370}
372 371
373void KOEditorGeneral::enableAlarmEdit(bool enable) 372void KOEditorGeneral::enableAlarmEdit(bool enable)
374{ 373{
375 if ( enable ) { 374 if ( enable ) {
376 if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { 375 if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) {
377 mAlarmSoundButton->setOn( true ); 376 mAlarmSoundButton->setOn( true );
378 if ( mAlarmSound.isEmpty() ) 377 if ( mAlarmSound.isEmpty() )
379 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 378 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
380 else { 379 else {
381 if ( ! QFile::exists( mAlarmSound ) ) 380 if ( ! QFile::exists( mAlarmSound ) )
382 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 381 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
383 } 382 }
384 } 383 }
385 } 384 }
386 ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage); 385 ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage);
387 mAlarmTimeEdit->setEnabled(enable); 386 mAlarmTimeEdit->setEnabled(enable);
388 mAlarmSoundButton->setEnabled(enable); 387 mAlarmSoundButton->setEnabled(enable);
389 mAlarmProgramButton->setEnabled(enable); 388 mAlarmProgramButton->setEnabled(enable);
390 mAlarmIncrCombo->setEnabled(enable); 389 mAlarmIncrCombo->setEnabled(enable);
391} 390}
392 391
393void KOEditorGeneral::disableAlarmEdit(bool disable) 392void KOEditorGeneral::disableAlarmEdit(bool disable)
394{ 393{
395 enableAlarmEdit( !disable ); 394 enableAlarmEdit( !disable );
396} 395}
397 396
398void KOEditorGeneral::enableAlarm( bool enable ) 397void KOEditorGeneral::enableAlarm( bool enable )
399{ 398{
400 enableAlarmEdit( enable ); 399 enableAlarmEdit( enable );
401} 400}
402 401
403void KOEditorGeneral::alarmDisable(bool disable) 402void KOEditorGeneral::alarmDisable(bool disable)
404{ 403{
405 if (!disable) { 404 if (!disable) {
406 //mAlarmBell->setEnabled(true); 405 //mAlarmBell->setEnabled(true);
407 mAlarmButton->setEnabled(true); 406 mAlarmButton->setEnabled(true);
408 } else { 407 } else {
409 //mAlarmBell->setEnabled(false); 408 //mAlarmBell->setEnabled(false);
410 mAlarmButton->setEnabled(false); 409 mAlarmButton->setEnabled(false);
411 mAlarmButton->setChecked(false); 410 mAlarmButton->setChecked(false);
412 mAlarmTimeEdit->setEnabled(false); 411 mAlarmTimeEdit->setEnabled(false);
413 mAlarmSoundButton->setEnabled(false); 412 mAlarmSoundButton->setEnabled(false);
414 mAlarmProgramButton->setEnabled(false); 413 mAlarmProgramButton->setEnabled(false);
415 mAlarmIncrCombo->setEnabled(false); 414 mAlarmIncrCombo->setEnabled(false);
416 } 415 }
417} 416}
418 417
419void KOEditorGeneral::setCategories(const QString &str) 418void KOEditorGeneral::setCategories(const QString &str)
420{ 419{
421 QString tt = str; 420 QString tt = str;
422 QToolTip::add( mCategoriesLabel, i18n("<b>Click here to edit categories: </b>") +"<em>"+tt.replace( QRegExp(","),", ")+"</em>"); 421 QToolTip::add( mCategoriesLabel, i18n("<b>Click here to edit categories: </b>") +"<em>"+tt.replace( QRegExp(","),", ")+"</em>");
423 mCategoriesLabel->setText(str); 422 mCategoriesLabel->setText(str);
424} 423}
425 424
426void KOEditorGeneral::setDefaults(bool allDay) 425void KOEditorGeneral::setDefaults(bool allDay)
427{ 426{
428#if 0 427#if 0
429 mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName()); 428 mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName());
430#endif 429#endif
431 430
432 mAlarmMessage = i18n("Edit new item"); 431 mAlarmMessage = i18n("Edit new item");
433 enableAlarmEdit( !allDay ); 432 enableAlarmEdit( !allDay );
434 433
435 // TODO: Implement a KPrefsComboItem to solve this in a clean way. 434 // TODO: Implement a KPrefsComboItem to solve this in a clean way.
436 int alarmTime; 435 int alarmTime;
437 int a[] = { 1,5,10,15,30,60,180, 1440 }; 436 int a[] = { 1,5,10,15,30,60,180, 1440 };
438 int index = KOPrefs::instance()->mAlarmTime; 437 int index = KOPrefs::instance()->mAlarmTime;
439 if (index < 0 || index > 7) { 438 if (index < 0 || index > 7) {
440 alarmTime = 15; 439 alarmTime = 15;
441 } else { 440 } else {
442 alarmTime = a[index]; 441 alarmTime = a[index];
443 } 442 }
444 mAlarmButton ->setChecked( false ); 443 mAlarmButton ->setChecked( false );
445 mAlarmTimeEdit->setValue(alarmTime); 444 mAlarmTimeEdit->setValue(alarmTime);
446 mAlarmIncrCombo->setCurrentItem(0); 445 mAlarmIncrCombo->setCurrentItem(0);
447 enableAlarmEdit( false ); 446 enableAlarmEdit( false );
448 //alarmDisable (false); 447 //alarmDisable (false);
449 mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic); 448 mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic);
450 mCancelBox->setChecked( false ); 449 mCancelBox->setChecked( false );
451 mSummaryEdit->setEditText(""); 450 mSummaryEdit->setEditText("");
452 mLocationEdit->setEditText(""); 451 mLocationEdit->setEditText("");
453 mDescriptionEdit->setText(""); 452 mDescriptionEdit->setText("");
454 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 453 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
@@ -527,98 +526,100 @@ void KOEditorGeneral::readIncidence(Incidence *event)
527 mCancelBox->setChecked( event->cancelled() ); 526 mCancelBox->setChecked( event->cancelled() );
528 mAlarmProgramButton->setOn(false); 527 mAlarmProgramButton->setOn(false);
529 mAlarmSoundButton->setOn(false); 528 mAlarmSoundButton->setOn(false);
530 529
531 // set up alarm stuff 530 // set up alarm stuff
532 QPtrList<Alarm> alarms = event->alarms(); 531 QPtrList<Alarm> alarms = event->alarms();
533 Alarm* alarm; 532 Alarm* alarm;
534 mAlarmIncrCombo->setCurrentItem(0); 533 mAlarmIncrCombo->setCurrentItem(0);
535 for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) { 534 for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) {
536 int offset; 535 int offset;
537 if ( alarm->hasTime() ) { 536 if ( alarm->hasTime() ) {
538 QDateTime t = alarm->time(); 537 QDateTime t = alarm->time();
539 offset = event->dtStart().secsTo( t ); 538 offset = event->dtStart().secsTo( t );
540 } else { 539 } else {
541 offset = alarm->startOffset().asSeconds(); 540 offset = alarm->startOffset().asSeconds();
542 } 541 }
543 if ( offset != 0 ) { 542 if ( offset != 0 ) {
544 offset = offset / -60; // make minutes 543 offset = offset / -60; // make minutes
545 if (offset % 60 == 0) { // divides evenly into hours? 544 if (offset % 60 == 0) { // divides evenly into hours?
546 offset = offset / 60; 545 offset = offset / 60;
547 mAlarmIncrCombo->setCurrentItem(1); 546 mAlarmIncrCombo->setCurrentItem(1);
548 if (offset % 24 == 0) { // divides evenly into days? 547 if (offset % 24 == 0) { // divides evenly into days?
549 offset = offset / 24; 548 offset = offset / 24;
550 mAlarmIncrCombo->setCurrentItem(2); 549 mAlarmIncrCombo->setCurrentItem(2);
551 } 550 }
552 } 551 }
553 } 552 }
554 mAlarmTimeEdit->setValue( offset ); 553 mAlarmTimeEdit->setValue( offset );
555 if (alarm->type() == Alarm::Procedure) { 554 if (alarm->type() == Alarm::Procedure) {
556 555
557 mAlarmProgram = alarm->programFile(); 556 mAlarmProgram = alarm->programFile();
558 mAlarmProgramButton->setOn(true); 557 mAlarmProgramButton->setOn(true);
559 QString dispStr = i18n("Running '%1'").arg(mAlarmProgram); 558 QString dispStr = i18n("Running '%1'").arg(mAlarmProgram);
560 QToolTip::add(mAlarmProgramButton, dispStr); 559 QToolTip::add(mAlarmProgramButton, dispStr);
561 } 560 }
562 else if (alarm->type() == Alarm::Audio) { 561 else if (alarm->type() == Alarm::Audio) {
563 mAlarmSound = alarm->audioFile(); 562 mAlarmSound = alarm->audioFile();
564 if ( ! QFile::exists( mAlarmSound ) ) 563 if ( ! QFile::exists( mAlarmSound ) )
565 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 564 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
566 mAlarmSoundButton->setOn(true); 565 mAlarmSoundButton->setOn(true);
567 QString dispStr = i18n("Playing '%1'").arg(mAlarmSound); 566 QString dispStr = i18n("Playing '%1'").arg(mAlarmSound);
568 QToolTip::add(mAlarmSoundButton, dispStr); 567 QToolTip::add(mAlarmSoundButton, dispStr);
569 } 568 }
570 mAlarmButton->setChecked(alarm->enabled()); 569 mAlarmButton->setChecked(alarm->enabled());
571 enableAlarmEdit( alarm->enabled() ); 570 enableAlarmEdit( alarm->enabled() );
572 //qDebug("nableAlarmEdit( alarm->enabled() )********* "); 571 //qDebug("nableAlarmEdit( alarm->enabled() )********* ");
573 // TODO: Deal with multiple alarms 572 // TODO: Deal with multiple alarms
574 break; // For now, stop after the first alarm 573 break; // For now, stop after the first alarm
575 } 574 }
576 575
577 setCategories(event->categoriesStr()); 576 setCategories(event->categoriesStr());
578} 577}
579 578
580void KOEditorGeneral::writeIncidence(Incidence *event) 579void KOEditorGeneral::writeIncidence(Incidence *event)
581{ 580{
582 // kdDebug() << "KOEditorGeneral::writeEvent()" << endl; 581 // kdDebug() << "KOEditorGeneral::writeEvent()" << endl;
583 mLocationEdit->save(KOLocationBox::LOCATION); 582 mLocationEdit->save(KOLocationBox::LOCATION);
584 event->setSummary(mSummaryEdit->currentText()); 583 event->setSummary(mSummaryEdit->currentText());
585 event->setLocation(mLocationEdit->currentText()); 584 event->setLocation(mLocationEdit->currentText());
586 event->setDescription(mDescriptionEdit->text()); 585 event->setDescription(mDescriptionEdit->text());
587 event->setCategories(mCategoriesLabel->text()); 586 event->setCategories(mCategoriesLabel->text());
588 event->setSecrecy(mSecrecyCombo->currentItem()); 587 event->setSecrecy(mSecrecyCombo->currentItem());
589 event->setCancelled(mCancelBox->isChecked() );; 588 event->setCancelled(mCancelBox->isChecked() );;
590 // alarm stuff 589 // alarm stuff
591 if (mAlarmButton->isChecked()) { 590 if (mAlarmButton->isChecked()) {
592 if (event->alarms().count() == 0) 591 if (event->alarms().count() == 0)
593 event->newAlarm(); 592 event->newAlarm();
594 QPtrList<Alarm> alarms = event->alarms(); 593 QPtrList<Alarm> alarms = event->alarms();
595 Alarm *alarm; 594 Alarm *alarm;
596 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 595 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
597 alarm->setEnabled(true); 596 alarm->setEnabled(true);
598 int j = mAlarmTimeEdit->value()* -60; 597 int j = mAlarmTimeEdit->value()* -60;
599 if (mAlarmIncrCombo->currentItem() == 1) 598 if (mAlarmIncrCombo->currentItem() == 1)
600 j = j * 60; 599 j = j * 60;
601 else if (mAlarmIncrCombo->currentItem() == 2) 600 else if (mAlarmIncrCombo->currentItem() == 2)
602 j = j * (60 * 24); 601 j = j * (60 * 24);
603 alarm->setStartOffset( j ); 602 alarm->setStartOffset( j );
604 603
605 if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) { 604 if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) {
606 alarm->setProcedureAlarm(mAlarmProgram); 605 alarm->setProcedureAlarm(mAlarmProgram);
607 } 606 }
608 else if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) 607 else if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn())
609 alarm->setAudioAlarm(mAlarmSound); 608 alarm->setAudioAlarm(mAlarmSound);
610 else 609 else
611 alarm->setType(Alarm::Invalid); 610 alarm->setType(Alarm::Invalid);
612 //alarm->setAudioAlarm("default"); 611 //alarm->setAudioAlarm("default");
613 // TODO: Deal with multiple alarms 612 // TODO: Deal with multiple alarms
614 break; // For now, stop after the first alarm 613 break; // For now, stop after the first alarm
615 } 614 }
616 } else { 615 } else {
617 Alarm* alarm = event->alarms().first(); 616 Alarm* alarm = event->alarms().first();
618 if ( alarm ) { 617 if ( alarm ) {
619 alarm->setEnabled(false); 618 alarm->setEnabled(false);
620 alarm->setType(Alarm::Invalid); 619 alarm->setType(Alarm::Invalid);
621 } 620 }
622 } 621 }
623 event->setCalID( getCalendarID() ); 622 int id = getCalendarID();
623 event->setCalID( id );
624 event->setAlarmEnabled( KOPrefs::instance()->getCalendar( id )->isAlarmEnabled );
624} 625}
diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h
index d8b15af..b10a5d4 100644
--- a/korganizer/koeditorgeneral.h
+++ b/korganizer/koeditorgeneral.h
@@ -23,103 +23,103 @@
23#ifndef KOEDITORGENERAL_H 23#ifndef KOEDITORGENERAL_H
24#define KOEDITORGENERAL_H 24#define KOEDITORGENERAL_H
25 25
26#include <qframe.h> 26#include <qframe.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qcheckbox.h> 28#include <qcheckbox.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qpopupmenu.h> 30#include <qpopupmenu.h>
31#include <qgroupbox.h> 31#include <qgroupbox.h>
32#include <qlineedit.h> 32#include <qlineedit.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qlistview.h> 34#include <qlistview.h>
35#include <qradiobutton.h> 35#include <qradiobutton.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qcombobox.h> 38#include <qcombobox.h>
39 39
40#include <ktextedit.h> 40#include <ktextedit.h>
41#include <krestrictedline.h> 41#include <krestrictedline.h>
42 42
43#include <libkcal/incidence.h> 43#include <libkcal/incidence.h>
44 44
45#include "ktimeedit.h" 45#include "ktimeedit.h"
46 46
47class KDateEdit; 47class KDateEdit;
48class KOLocationBox; 48class KOLocationBox;
49using namespace KCal; 49using namespace KCal;
50 50
51class KOEditorGeneral : public QObject 51class KOEditorGeneral : public QObject
52{ 52{
53 Q_OBJECT 53 Q_OBJECT
54 public: 54 public:
55 KOEditorGeneral (QObject* parent=0,const char* name=0); 55 KOEditorGeneral (QObject* parent=0,const char* name=0);
56 virtual ~KOEditorGeneral(); 56 virtual ~KOEditorGeneral();
57 void setFocusOn( int i ); 57 void setFocusOn( int i );
58 void initHeader(QWidget *,QBoxLayout *); 58 void initHeader(QWidget *,QBoxLayout *);
59 void initDescription(QWidget *,QBoxLayout *); 59 void initDescription(QWidget *,QBoxLayout *);
60 void initSecrecy(QWidget *,QBoxLayout *); 60 void initSecrecy(QWidget *,QBoxLayout *);
61 void initCategories(QWidget *,QBoxLayout *); 61 void initCategories(QWidget *,QBoxLayout *);
62 void initAlarm(QWidget *,QBoxLayout *); 62 void initAlarm(QWidget *,QBoxLayout *);
63 63
64 /** Set widgets to default values */ 64 /** Set widgets to default values */
65 void setDefaults(bool allDay); 65 void setDefaults(bool allDay);
66 /** Read event object and setup widgets accordingly */ 66 /** Read event object and setup widgets accordingly */
67 void readIncidence(Incidence *); 67 void readIncidence(Incidence *);
68 /** Write event settings to event object */ 68 /** Write event settings to event object */
69 void writeIncidence(Incidence *); 69 void writeIncidence(Incidence *);
70 70
71 /** Check if the input is valid. */ 71 /** Check if the input is valid. */
72 bool validateInput() { return true; } 72 bool validateInput() { return true; }
73 73
74 void enableAlarm( bool enable ); 74 void enableAlarm( bool enable );
75 void setSecrecy( int num ); 75 void setSecrecy( int num );
76 int getCalendarID(); 76 int getCalendarID();
77 public slots: 77 public slots:
78 void setCategories(const QString &); 78 void setCategories(const QString &);
79 void editCategories(); 79 void editCategories();
80 80
81 protected slots: 81 protected slots:
82 void enableAlarmEdit( bool enable ); 82 void enableAlarmEdit( bool enable );
83 void disableAlarmEdit( bool disable ); 83 void disableAlarmEdit( bool disable );
84 void alarmDisable( bool disable ); 84 void alarmDisable( bool disable );
85 void pickAlarmSound(); 85 void pickAlarmSound();
86 void pickAlarmProgram(); 86 void pickAlarmProgram();
87 void slotSetFocusOn(); 87 void slotSetFocusOn();
88 void showCatPopup(); 88 void showCatPopup();
89 void selectedCatPopup( int ); 89 void selectedCatPopup( int );
90 90
91 signals: 91 signals:
92 void openCategoryDialog(); 92 void openCategoryDialog();
93 void allAccepted(); 93 void allAccepted();
94 void dateTimesChanged(QDateTime,QDateTime); 94 void dateTimesChanged(QDateTime,QDateTime);
95 95
96 protected: 96 protected:
97 void fillCalCombo( int setToID = 0 ); 97 void fillCalCombo( int setToID = 0 );
98 int mNextFocus; 98 int mNextFocus;
99 //QLineEdit *mSummaryEdit; 99 //QLineEdit *mSummaryEdit;
100 //QLineEdit *mLocationEdit; 100 //QLineEdit *mLocationEdit;
101 KOLocationBox *mSummaryEdit; 101 KOLocationBox *mSummaryEdit;
102 KOLocationBox *mLocationEdit; 102 KOLocationBox *mLocationEdit;
103 QComboBox *mCalendarBox; 103 QComboBox *mCalendarBox;
104 QLabel *mAlarmBell; 104 QLabel *mAlarmBell;
105 QCheckBox *mAlarmButton; 105 QCheckBox *mAlarmButton;
106 QSpinBox *mAlarmTimeEdit; 106 QSpinBox *mAlarmTimeEdit;
107 QPushButton *mAlarmSoundButton; 107 QPushButton *mAlarmSoundButton;
108 QPushButton *mAlarmProgramButton; 108 QPushButton *mAlarmProgramButton;
109 QComboBox *mAlarmIncrCombo; 109 QComboBox *mAlarmIncrCombo;
110 KTextEdit *mDescriptionEdit; 110 KTextEdit *mDescriptionEdit;
111 QLabel *mOwnerLabel; 111 QLabel *mOwnerLabel;
112 QComboBox *mSecrecyCombo; 112 QComboBox *mSecrecyCombo;
113 QCheckBox *mCancelBox; 113 QCheckBox *mCancelBox;
114 QPushButton *mCategoriesButton; 114 QPushButton *mCategoriesButton;
115 QPushButton *mCategoriesLabel; 115 QPushButton *mCategoriesLabel;
116 116
117 private: 117 private:
118 QPopupMenu * mCatPopup; 118 QPopupMenu * mCatPopup;
119 QString getFittingPath( const QString ) ; 119 QString getFittingPath( const QString &) ;
120 QString mAlarmSound; 120 QString mAlarmSound;
121 QString mAlarmProgram; 121 QString mAlarmProgram;
122 QString mAlarmMessage; 122 QString mAlarmMessage;
123}; 123};
124 124
125#endif 125#endif
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp
index 9ede543..3e87197 100644
--- a/korganizer/koeventeditor.cpp
+++ b/korganizer/koeventeditor.cpp
@@ -1,123 +1,124 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001,2002 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 <qtooltip.h> 24#include <qtooltip.h>
25#include <qframe.h> 25#include <qframe.h>
26#include <qpixmap.h> 26#include <qpixmap.h>
27#include <qhbox.h> 27#include <qhbox.h>
28#include <qtimer.h>
28#include <qdir.h> 29#include <qdir.h>
29#include <qlayout.h> 30#include <qlayout.h>
30#include <qwidgetstack.h> 31#include <qwidgetstack.h>
31#include <qapplication.h> 32#include <qapplication.h>
32 33
33#include <kiconloader.h> 34#include <kiconloader.h>
34#include <kstandarddirs.h> 35#include <kstandarddirs.h>
35#include <kdebug.h> 36#include <kdebug.h>
36#include <klocale.h> 37#include <klocale.h>
37#include <kfiledialog.h> 38#include <kfiledialog.h>
38#include <kmessagebox.h> 39#include <kmessagebox.h>
39#include <libkcal/calendarresources.h> 40#include <libkcal/calendarresources.h>
40#include <libkcal/resourcecalendar.h> 41#include <libkcal/resourcecalendar.h>
41#include <kresources/resourceselectdialog.h> 42#include <kresources/resourceselectdialog.h>
42 43
43#include <libkdepim/categoryselectdialog.h> 44#include <libkdepim/categoryselectdialog.h>
44#include <libkcal/calendarlocal.h> 45#include <libkcal/calendarlocal.h>
45#include <libkcal/icalformat.h> 46#include <libkcal/icalformat.h>
46 47
47#include "koprefs.h" 48#include "koprefs.h"
48 49
49#include "koeventeditor.h" 50#include "koeventeditor.h"
50extern int globalFlagBlockAgenda; 51extern int globalFlagBlockAgenda;
51 52
52KOEventEditor::KOEventEditor( Calendar *calendar, QWidget *parent ) : 53KOEventEditor::KOEventEditor( Calendar *calendar, QWidget *parent ) :
53 KOIncidenceEditor( i18n("Edit Event"), calendar, parent ) 54 KOIncidenceEditor( i18n("Edit Event"), calendar, parent )
54{ 55{
55 mEvent = 0; 56 mEvent = 0;
56 init(); 57 init();
57 if ( QApplication::desktop()->height() <= 240 ) 58 if ( QApplication::desktop()->height() <= 240 )
58 hideButtons(); 59 hideButtons();
59} 60}
60 61
61KOEventEditor::~KOEventEditor() 62KOEventEditor::~KOEventEditor()
62{ 63{
63 //emit dialogClose( mEvent ); 64 //emit dialogClose( mEvent );
64} 65}
65 66
66void KOEventEditor::init() 67void KOEventEditor::init()
67{ 68{
68 69
69 setupGeneral(); 70 setupGeneral();
70 setupAttendeesTab(); 71 setupAttendeesTab();
71 setupRecurrence(); 72 setupRecurrence();
72 73
73 // Propagate date time settings to recurrence tab 74 // Propagate date time settings to recurrence tab
74 connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), 75 connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
75 mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime))); 76 mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime)));
76 connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)), 77 connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)),
77 mRecurrence,SLOT(setDateTimeStr(const QString &))); 78 mRecurrence,SLOT(setDateTimeStr(const QString &)));
78 79
79 // Category dialog 80 // Category dialog
80 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); 81 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show()));
81 //connect(mCategoryDialog,SIGNAL(categoriesSelected(const QString &)), 82 //connect(mCategoryDialog,SIGNAL(categoriesSelected(const QString &)),
82 // mGeneral,SLOT(setCategories(const QString &))); 83 // mGeneral,SLOT(setCategories(const QString &)));
83 84
84 85
85} 86}
86 87
87void KOEventEditor::reload() 88void KOEventEditor::reload()
88{ 89{
89 if ( mEvent ) readEvent( mEvent ); 90 if ( mEvent ) readEvent( mEvent );
90} 91}
91 92
92void KOEventEditor::setSecrecy( int sec ) 93void KOEventEditor::setSecrecy( int sec )
93{ 94{
94 mGeneral->setSecrecy( sec ); 95 mGeneral->setSecrecy( sec );
95} 96}
96void KOEventEditor::setCategories( QString s ) 97void KOEventEditor::setCategories( QString s )
97{ 98{
98 mGeneral->setCategories(s); 99 mGeneral->setCategories(s);
99 100
100} 101}
101void KOEventEditor::setupGeneral() 102void KOEventEditor::setupGeneral()
102{ 103{
103 mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" ); 104 mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" );
104 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); 105 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) );
105 106
106 if( KOPrefs::instance()->mCompactDialogs ) { 107 if( KOPrefs::instance()->mCompactDialogs ) {
107 QFrame *topFrame = addPage(i18n("General")); 108 QFrame *topFrame = addPage(i18n("General"));
108 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 109 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
109 topLayout->setSpacing(spacingHint()-1); 110 topLayout->setSpacing(spacingHint()-1);
110 topLayout->setMargin(marginHint()-1); 111 topLayout->setMargin(marginHint()-1);
111 topLayout->addStretch ( 1 ); 112 topLayout->addStretch ( 1 );
112 mGeneral->initHeader(topFrame,topLayout); 113 mGeneral->initHeader(topFrame,topLayout);
113 topLayout->addStretch ( 1 ); 114 topLayout->addStretch ( 1 );
114 mGeneral->initTime(topFrame,topLayout); 115 mGeneral->initTime(topFrame,topLayout);
115 topLayout->addStretch ( 1 ); 116 topLayout->addStretch ( 1 );
116// QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); 117// QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout);
117 mGeneral->initAlarm(topFrame,topLayout); 118 mGeneral->initAlarm(topFrame,topLayout);
118 topLayout->addStretch ( 1 ); 119 topLayout->addStretch ( 1 );
119 mGeneral->enableAlarm( false ); 120 mGeneral->enableAlarm( false );
120 121
121 QBoxLayout *buttonLayout; 122 QBoxLayout *buttonLayout;
122 if ( QApplication::desktop()->width() < 500 && QApplication::desktop()->height() > 240 ) 123 if ( QApplication::desktop()->width() < 500 && QApplication::desktop()->height() > 240 )
123 buttonLayout = new QVBoxLayout( topLayout ); 124 buttonLayout = new QVBoxLayout( topLayout );
@@ -156,192 +157,195 @@ void KOEventEditor::setupGeneral()
156 mGeneral->initSecrecy( topFrame2, topLayout2 ); 157 mGeneral->initSecrecy( topFrame2, topLayout2 );
157 mGeneral->initDescription(topFrame2,topLayout2); 158 mGeneral->initDescription(topFrame2,topLayout2);
158 159
159 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 160 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
160 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 161 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
161 } else { 162 } else {
162 QFrame *topFrame = addPage(i18n("General")); 163 QFrame *topFrame = addPage(i18n("General"));
163 164
164 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 165 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
165 topLayout->setSpacing(spacingHint()); 166 topLayout->setSpacing(spacingHint());
166 167
167 mGeneral->initHeader(topFrame,topLayout); 168 mGeneral->initHeader(topFrame,topLayout);
168 mGeneral->initTime(topFrame,topLayout); 169 mGeneral->initTime(topFrame,topLayout);
169 QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); 170 QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout);
170 mGeneral->initAlarm(topFrame,alarmLineLayout); 171 mGeneral->initAlarm(topFrame,alarmLineLayout);
171 mGeneral->initClass(topFrame,alarmLineLayout); 172 mGeneral->initClass(topFrame,alarmLineLayout);
172 mGeneral->initDescription(topFrame,topLayout); 173 mGeneral->initDescription(topFrame,topLayout);
173 QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); 174 QBoxLayout *detailsLayout = new QHBoxLayout(topLayout);
174 mGeneral->initCategories( topFrame, detailsLayout ); 175 mGeneral->initCategories( topFrame, detailsLayout );
175 mGeneral->initSecrecy( topFrame, detailsLayout ); 176 mGeneral->initSecrecy( topFrame, detailsLayout );
176 } 177 }
177 178
178 mGeneral->finishSetup(); 179 mGeneral->finishSetup();
179 180
180} 181}
181 182
182void KOEventEditor::setupRecurrence() 183void KOEventEditor::setupRecurrence()
183{ 184{
184 QFrame *topFrame = addPage( i18n("Recurrence") ); 185 QFrame *topFrame = addPage( i18n("Recurrence") );
185 QBoxLayout *topLayout = new QVBoxLayout( topFrame ); 186 QBoxLayout *topLayout = new QVBoxLayout( topFrame );
186 187
187 mRecurrence = new KOEditorRecurrence( topFrame ); 188 mRecurrence = new KOEditorRecurrence( topFrame );
188 topLayout->addWidget( mRecurrence ); 189 topLayout->addWidget( mRecurrence );
189} 190}
190 191
191void KOEventEditor::editEvent(Event *event, bool showDescription) 192void KOEventEditor::editEvent(Event *event, bool showDescription)
192{ 193{
193 // init(); 194 // init();
194 195
195 mEvent = event; 196 mEvent = event;
196 readEvent(mEvent); 197 readEvent(mEvent);
197 if ( showDescription ) { 198 if ( showDescription ) {
198 showPage( 1 ); 199 showPage( 1 );
199 mGeneral->setFocusOn( 1 ); 200 mGeneral->setFocusOn( 1 );
200 } else { 201 } else {
201 showPage( 0 ); 202 showPage( 0 );
202 mGeneral->setFocusOn( 2 ); 203 mGeneral->setFocusOn( 2 );
203 } 204 }
204} 205}
205 206
206void KOEventEditor::newEvent( QDateTime from, QDateTime to, bool allDay ) 207void KOEventEditor::newEvent( QDateTime from, QDateTime to, bool allDay )
207{ 208{
208 // init(); 209 // init();
209 210
210 mEvent = 0; 211 mEvent = 0;
211 setDefaults(from,to,allDay); 212 setDefaults(from,to,allDay);
212} 213}
213 214
214void KOEventEditor::loadDefaults() 215void KOEventEditor::loadDefaults()
215{ 216{
216 int fmt = KOPrefs::instance()->mStartTime; 217 int fmt = KOPrefs::instance()->mStartTime;
217 218
218 QDateTime from(QDate::currentDate(), QTime(fmt,0,0)); 219 QDateTime from(QDate::currentDate(), QTime(fmt,0,0));
219 QDateTime to(QDate::currentDate(), 220 QDateTime to(QDate::currentDate(),
220 QTime(fmt+KOPrefs::instance()->mDefaultDuration,0,0)); 221 QTime(fmt+KOPrefs::instance()->mDefaultDuration,0,0));
221 222
222 setDefaults(from,to,false); 223 setDefaults(from,to,false);
223} 224}
224 225
225bool KOEventEditor::processInput( bool emitTime ) 226bool KOEventEditor::processInput( bool emitTime )
226{ 227{
227 if (!validateInput()) return false; 228 if (!validateInput()) return false;
228 229
229 Event *event = 0; 230 Event *event = 0;
230 231
231 if (mEvent) event = mEvent; 232 if (mEvent) event = mEvent;
232 else { 233 else {
233 event = new Event; 234 event = new Event;
234 event->setOrganizer(KOPrefs::instance()->email()); 235 event->setOrganizer(KOPrefs::instance()->email());
235 } 236 }
236 237
237 writeEvent(event); 238 writeEvent(event);
238 if ( emitTime ) { 239 if ( emitTime ) {
239 globalFlagBlockAgenda = 1; 240 globalFlagBlockAgenda = 1;
240 emit showAgendaView( false ); 241 emit showAgendaView( false );
241 emit jumpToTime( event->dtStart().date() ); 242 emit jumpToTime( event->dtStart().date() );
242 globalFlagBlockAgenda = 2; 243 globalFlagBlockAgenda = 2;
243 244
244 } 245 }
245 if (mEvent) { 246 if (mEvent) {
246 event->setRevision(event->revision()+1); 247 event->setRevision(event->revision()+1);
247 emit eventChanged(event); 248 emit eventChanged(event);
248 } else { 249 } else {
249 mCalendar->addEvent(event); 250 mCalendar->addEvent(event);
250 mEvent = event; 251 mEvent = event;
251 emit eventAdded(event); 252 emit eventAdded(event);
253 if ( event->isAlarmEnabled () && !event->alarmEnabled () ) {
254 QTimer::singleShot( 0, this, SLOT ( alarmWarning() ) );
255 }
252 } 256 }
253 257
254 return true; 258 return true;
255} 259}
256 260
257void KOEventEditor::deleteEvent() 261void KOEventEditor::deleteEvent()
258{ 262{
259 kdDebug() << "Delete event" << endl; 263 kdDebug() << "Delete event" << endl;
260 264
261 if (mEvent) { 265 if (mEvent) {
262 if (KOPrefs::instance()->mConfirm) { 266 if (KOPrefs::instance()->mConfirm) {
263 switch (msgItemDelete()) { 267 switch (msgItemDelete()) {
264 case KMessageBox::Continue: // OK 268 case KMessageBox::Continue: // OK
265 emit eventToBeDeleted(mEvent); 269 emit eventToBeDeleted(mEvent);
266 emit dialogClose(mEvent); 270 emit dialogClose(mEvent);
267 mCalendar->deleteEvent(mEvent); 271 mCalendar->deleteEvent(mEvent);
268 emit eventDeleted(); 272 emit eventDeleted();
269 reject(); 273 reject();
270 break; 274 break;
271 } 275 }
272 } 276 }
273 else { 277 else {
274 emit eventToBeDeleted(mEvent); 278 emit eventToBeDeleted(mEvent);
275 emit dialogClose(mEvent); 279 emit dialogClose(mEvent);
276 mCalendar->deleteEvent(mEvent); 280 mCalendar->deleteEvent(mEvent);
277 emit eventDeleted(); 281 emit eventDeleted();
278 reject(); 282 reject();
279 } 283 }
280 } else { 284 } else {
281 reject(); 285 reject();
282 } 286 }
283} 287}
284 288
285void KOEventEditor::setDefaults(QDateTime from, QDateTime to, bool allDay) 289void KOEventEditor::setDefaults(QDateTime from, QDateTime to, bool allDay)
286{ 290{
287 mGeneral->setDefaults(from,to,allDay); 291 mGeneral->setDefaults(from,to,allDay);
288 mDetails->setDefaults(); 292 mDetails->setDefaults();
289 mRecurrence->setDefaults(from,to); 293 mRecurrence->setDefaults(from,to);
290 showPage( 0 ); 294 showPage( 0 );
291 mGeneral->setFocusOn( 2 ); 295 mGeneral->setFocusOn( 2 );
292} 296}
293 297
294void KOEventEditor::readEvent( Event *event, bool tmpl ) 298void KOEventEditor::readEvent( Event *event, bool tmpl )
295{ 299{
296 mGeneral->readEvent( event, tmpl ); 300 mGeneral->readEvent( event, tmpl );
297 mDetails->readEvent( event ); 301 mDetails->readEvent( event );
298 mRecurrence->readEvent( event ); 302 mRecurrence->readEvent( event );
299 303
300 // categories 304 // categories
301 //mCategoryDialog->setSelected( event->categories() ); 305 //mCategoryDialog->setSelected( event->categories() );
302} 306}
303 307
304void KOEventEditor::writeEvent(Event *event) 308void KOEventEditor::writeEvent(Event *event)
305{ 309{
306 mGeneral->writeEvent( event ); 310 mGeneral->writeEvent( event );
307 mDetails->writeEvent( event ); 311 mDetails->writeEvent( event );
308 312
309 if ( event->organizer() == KOPrefs::instance()->email() ) { 313 if ( event->organizer() == KOPrefs::instance()->email() ) {
310 Event *ev = new Event( *event ); 314 Event *ev = new Event( *event );
311 ev->registerObserver(0); 315 ev->registerObserver(0);
312 mDetails->cancelAttendeeEvent( ev ); 316 mDetails->cancelAttendeeEvent( ev );
313 if ( ev->attendeeCount() > 0 ) { 317 if ( ev->attendeeCount() > 0 ) {
314 emit deleteAttendee( ev ); 318 emit deleteAttendee( ev );
315 } 319 }
316 delete(ev); 320 delete(ev);
317 } 321 }
318 322
319 mRecurrence->writeEvent(event); 323 mRecurrence->writeEvent(event);
320} 324}
321 325
322bool KOEventEditor::validateInput() 326bool KOEventEditor::validateInput()
323{ 327{
324 if (!mGeneral->validateInput()) return false; 328 if (!mGeneral->validateInput()) return false;
325 if (!mDetails->validateInput()) return false; 329 if (!mDetails->validateInput()) return false;
326 if (!mRecurrence->validateInput()) return false; 330 if (!mRecurrence->validateInput()) return false;
327 return true; 331 return true;
328} 332}
329 333
330int KOEventEditor::msgItemDelete() 334int KOEventEditor::msgItemDelete()
331{ 335{
332 return KMessageBox::warningContinueCancel(this, 336 return KMessageBox::warningContinueCancel(this,
333 i18n("This item will be permanently deleted."), 337 i18n("This item will be permanently deleted."),
334 i18n("KOrganizer Confirmation"),i18n("Delete")); 338 i18n("KOrganizer Confirmation"),i18n("Delete"));
335} 339}
336 340
337void KOEventEditor::slotLoadTemplate() 341void KOEventEditor::slotLoadTemplate()
338{ 342{
339 343
340 QString fileName =locateLocal( "templates", "events" ); 344 QString fileName =locateLocal( "templates", "events" );
341 QDir t_dir; 345 QDir t_dir;
342 if ( !t_dir.exists(fileName) ) 346 if ( !t_dir.exists(fileName) )
343 t_dir.mkdir ( fileName ); 347 t_dir.mkdir ( fileName );
344 fileName += "/event"; 348 fileName += "/event";
345 fileName = KFileDialog::getOpenFileName( fileName , i18n("Load Event template"), this ); 349 fileName = KFileDialog::getOpenFileName( fileName , i18n("Load Event template"), this );
346 if ( fileName.length() == 0 ) 350 if ( fileName.length() == 0 )
347 return; 351 return;
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 02b54da..607e549 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -311,309 +311,317 @@ void KOEventViewer::appendEvent(Event *event, int mode )
311 } 311 }
312 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 312 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
313 if ( mode == 1 ) { 313 if ( mode == 1 ) {
314 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 314 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
315 } else { 315 } else {
316 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 316 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
317 } 317 }
318 formatReadOnly(event); 318 formatReadOnly(event);
319 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 319 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
320 if ( mColorMode ) 320 if ( mColorMode )
321 mText += "</font>"; 321 mText += "</font>";
322 } 322 }
323 mMailSubject += i18n( "Meeting " )+ event->summary(); 323 mMailSubject += i18n( "Meeting " )+ event->summary();
324 if (event->cancelled ()) { 324 if (event->cancelled ()) {
325 mText +="<font color=\"#B00000\">"; 325 mText +="<font color=\"#B00000\">";
326 addTag("i",i18n("This event has been cancelled!")); 326 addTag("i",i18n("This event has been cancelled!"));
327 mText.append("<br>"); 327 mText.append("<br>");
328 mText += "</font>"; 328 mText += "</font>";
329 mMailSubject += i18n("(cancelled)"); 329 mMailSubject += i18n("(cancelled)");
330 } 330 }
331 331
332 if (event->doesFloat()) { 332 if (event->doesFloat()) {
333 if (event->isMultiDay()) { 333 if (event->isMultiDay()) {
334 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") 334 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
335 .arg(event->dtStartDateStr(shortDate)) 335 .arg(event->dtStartDateStr(shortDate))
336 .arg(event->dtEndDateStr(shortDate))); 336 .arg(event->dtEndDateStr(shortDate)));
337 mText.append(i18n("<p><b>Duration:</b> %1 days</p>") 337 mText.append(i18n("<p><b>Duration:</b> %1 days</p>")
338 .arg(event->dtStart().daysTo(event->dtEnd())+1)); 338 .arg(event->dtStart().daysTo(event->dtEnd())+1));
339 } else { 339 } else {
340 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); 340 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
341 } 341 }
342 } else { 342 } else {
343 if (event->isMultiDay()) { 343 if (event->isMultiDay()) {
344 mText.append(i18n("<p><b>From:</b> %1</p> ") 344 mText.append(i18n("<p><b>From:</b> %1</p> ")
345 .arg(event->dtStartStr( shortDate))); 345 .arg(event->dtStartStr( shortDate)));
346 mText.append(i18n("<p><b>To:</b> %1</p>") 346 mText.append(i18n("<p><b>To:</b> %1</p>")
347 .arg(event->dtEndStr(shortDate))); 347 .arg(event->dtEndStr(shortDate)));
348 } else { 348 } else {
349 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") 349 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
350 .arg(event->dtStartTimeStr()) 350 .arg(event->dtStartTimeStr())
351 .arg(event->dtEndTimeStr())); 351 .arg(event->dtEndTimeStr()));
352 mText.append(i18n("<p><b>On:</b> %1</p> ") 352 mText.append(i18n("<p><b>On:</b> %1</p> ")
353 .arg(event->dtStartDateStr( shortDate ))); 353 .arg(event->dtStartDateStr( shortDate )));
354 } 354 }
355 } 355 }
356 if (!event->location().isEmpty()) { 356 if (!event->location().isEmpty()) {
357 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); 357 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) );
358 mMailSubject += i18n(" at ") + event->location(); 358 mMailSubject += i18n(" at ") + event->location();
359 } 359 }
360 if (event->doesRecur()) { 360 if (event->doesRecur()) {
361 361
362 QString recurText = event->recurrenceText(); 362 QString recurText = event->recurrenceText();
363 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 363 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
364 bool ok; 364 bool ok;
365 QDate start = QDate::currentDate(); 365 QDate start = QDate::currentDate();
366 QDateTime next; 366 QDateTime next;
367 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); 367 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
368 if ( ok ) { 368 if ( ok ) {
369 if ( wideScreen ){ 369 if ( wideScreen ){
370 addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) ); 370 addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) );
371 } else { 371 } else {
372 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 372 addTag("p",i18n("<b>Next recurrence is on:</b>") );
373 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); 373 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
374 } 374 }
375 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); 375 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true );
376 376
377 } else { 377 } else {
378 bool last; 378 bool last;
379 QDate nextd; 379 QDate nextd;
380 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); 380 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
381 if ( last ) { 381 if ( last ) {
382 if ( wideScreen ){ 382 if ( wideScreen ){
383 addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate )); 383 addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate ));
384 } else{ 384 } else{
385 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 385 addTag("p",i18n("<b>Last recurrence was on:</b>") );
386 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); 386 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
387 } 387 }
388 } 388 }
389 } 389 }
390 } else { 390 } else {
391 mMailSubject += i18n(" - " )+event->dtStartStr( true ); 391 mMailSubject += i18n(" - " )+event->dtStartStr( true );
392 392
393 } 393 }
394 394
395 395
396 if (event->isAlarmEnabled()) { 396 if (event->isAlarmEnabled()) {
397 Alarm *alarm =event->alarms().first() ; 397 Alarm *alarm =event->alarms().first() ;
398 QDateTime t = alarm->time(); 398 QDateTime t = alarm->time();
399 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 399 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
400 if(wideScreen ){ 400 if(wideScreen ){
401 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); 401 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate ));
402 }else{ 402 }else{
403 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 403 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
404 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 404 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
405 } 405 }
406 //addTag("p",s); 406 //addTag("p",s);
407 if ( !(event->alarmEnabled() ) ) {
408 addTag("p", "<em>("+i18n("Enable alarm in resource settings") + ")</em>");
409
410 }
407 } 411 }
408 412
409 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); 413 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr());
410 414
411 formatCategories(event); 415 formatCategories(event);
412 416
413 formatAttendees(event); 417 formatAttendees(event);
414 418
415 if ( KOPrefs::instance()->mEVshowCreated ) { 419 if ( KOPrefs::instance()->mEVshowCreated ) {
416 if(wideScreen ){ 420 if(wideScreen ){
417 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 421 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
418 }else{ 422 }else{
419 addTag("p",i18n("<b>Created: ") +" </b>"); 423 addTag("p",i18n("<b>Created: ") +" </b>");
420 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 424 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
421 } 425 }
422 426
423 427
424 } 428 }
425 if ( KOPrefs::instance()->mEVshowChanged ) { 429 if ( KOPrefs::instance()->mEVshowChanged ) {
426 if(wideScreen ){ 430 if(wideScreen ){
427 addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); 431 addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) );
428 }else{ 432 }else{
429 addTag("p",i18n("<b>Last modified: ") +" </b>"); 433 addTag("p",i18n("<b>Last modified: ") +" </b>");
430 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 434 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
431 } 435 }
432 436
433 } 437 }
434 if ( KOPrefs::instance()->mEVshowDetails ) { 438 if ( KOPrefs::instance()->mEVshowDetails ) {
435 if (!event->description().isEmpty()) { 439 if (!event->description().isEmpty()) {
436 addTag("p",i18n("<b>Details: </b>")); 440 addTag("p",i18n("<b>Details: </b>"));
437 addTag("p",deTag(event->description())); 441 addTag("p",deTag(event->description()));
438 } 442 }
439 } 443 }
440 setText(mText); 444 setText(mText);
441 //QWhatsThis::add(this,mText); 445 //QWhatsThis::add(this,mText);
442 446
443} 447}
444 448
445void KOEventViewer::appendTodo(Todo *event, int mode ) 449void KOEventViewer::appendTodo(Todo *event, int mode )
446{ 450{
447 mMailSubject = ""; 451 mMailSubject = "";
448 mCurrentIncidence = event; 452 mCurrentIncidence = event;
449 topLevelWidget()->setCaption(i18n("Todo Viewer")); 453 topLevelWidget()->setCaption(i18n("Todo Viewer"));
450 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 454 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
451 bool wideScreen = ( QApplication::desktop()->width() >= 640 ); 455 bool wideScreen = ( QApplication::desktop()->width() >= 640 );
452 if (mode == 0 ) { 456 if (mode == 0 ) {
453 addTag("h2",deTag(event->summary())); 457 addTag("h2",deTag(event->summary()));
454 formatReadOnly(event); 458 formatReadOnly(event);
455 } 459 }
456 else { 460 else {
457 if ( mColorMode == 1 ) { 461 if ( mColorMode == 1 ) {
458 mText +="<font color=\"#00A000\">"; 462 mText +="<font color=\"#00A000\">";
459 } 463 }
460 if ( mColorMode == 2 ) { 464 if ( mColorMode == 2 ) {
461 mText +="<font color=\"#B00000\">"; 465 mText +="<font color=\"#B00000\">";
462 } 466 }
463 if ( mode == 1 ) { 467 if ( mode == 1 ) {
464 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 468 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
465 } else { 469 } else {
466 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 470 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
467 } 471 }
468 formatReadOnly(event); 472 formatReadOnly(event);
469 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 473 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
470 if ( mColorMode ) 474 if ( mColorMode )
471 mText += "</font>"; 475 mText += "</font>";
472 } 476 }
473 mMailSubject += i18n( "Todo " )+ event->summary(); 477 mMailSubject += i18n( "Todo " )+ event->summary();
474 478
475 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { 479 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
476 mText +="<font color=\"#B00000\">"; 480 mText +="<font color=\"#B00000\">";
477 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); 481 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) );
478 mText += "</font>"; 482 mText += "</font>";
479 } else { 483 } else {
480 mText.append(i18n("<p><i>%1 % completed</i></p>") 484 mText.append(i18n("<p><i>%1 % completed</i></p>")
481 .arg(event->percentComplete())); 485 .arg(event->percentComplete()));
482 } 486 }
483 487
484 if (event->cancelled ()) { 488 if (event->cancelled ()) {
485 mText +="<font color=\"#B00000\">"; 489 mText +="<font color=\"#B00000\">";
486 addTag("i",i18n("This todo has been cancelled!")); 490 addTag("i",i18n("This todo has been cancelled!"));
487 mText.append("<br>"); 491 mText.append("<br>");
488 mText += "</font>"; 492 mText += "</font>";
489 mMailSubject += i18n("(cancelled)"); 493 mMailSubject += i18n("(cancelled)");
490 } 494 }
491 495
492 496
493 497
494 if (event->doesRecur()) { 498 if (event->doesRecur()) {
495 499
496 QString recurText = event->recurrence()->recurrenceText(); 500 QString recurText = event->recurrence()->recurrenceText();
497 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); 501 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
498 502
499 } 503 }
500 if (event->hasStartDate()) { 504 if (event->hasStartDate()) {
501 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); 505 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer)));
502 } 506 }
503 if (event->hasDueDate()) { 507 if (event->hasDueDate()) {
504 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); 508 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer)));
505 mMailSubject += i18n(" - " )+event->dtDueStr( true ); 509 mMailSubject += i18n(" - " )+event->dtDueStr( true );
506 } 510 }
507 if (!event->location().isEmpty()) { 511 if (!event->location().isEmpty()) {
508 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); 512 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) );
509 mMailSubject += i18n(" at ") + event->location(); 513 mMailSubject += i18n(" at ") + event->location();
510 } 514 }
511 mText.append(i18n("<p><b>Priority:</b> %2</p>") 515 mText.append(i18n("<p><b>Priority:</b> %2</p>")
512 .arg(QString::number(event->priority()))); 516 .arg(QString::number(event->priority())));
513 517
514 if (event->isAlarmEnabled()) { 518 if (event->isAlarmEnabled()) {
515 Alarm *alarm =event->alarms().first() ; 519 Alarm *alarm =event->alarms().first() ;
516 QDateTime t = alarm->time(); 520 QDateTime t = alarm->time();
517 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 521 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
518 if ( wideScreen ) { 522 if ( wideScreen ) {
519 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); 523 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate ));
520 } else { 524 } else {
521 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 525 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
522 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 526 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
523 } 527 }
528 if ( !(event->alarmEnabled() ) ) {
529 addTag("p", "<em>("+i18n("Enable alarm in resource settings") + ")</em>");
530
531 }
524 } 532 }
525 533
526 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); 534 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr());
527 535
528 formatCategories(event); 536 formatCategories(event);
529 537
530 formatAttendees(event); 538 formatAttendees(event);
531 539
532 if ( KOPrefs::instance()->mEVshowCreated ) { 540 if ( KOPrefs::instance()->mEVshowCreated ) {
533 if(wideScreen ){ 541 if(wideScreen ){
534 542
535 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 543 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
536 544
537 } else { 545 } else {
538 addTag("p",i18n("<b>Created: ") +" </b>"); 546 addTag("p",i18n("<b>Created: ") +" </b>");
539 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 547 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
540 } 548 }
541 } 549 }
542 if ( KOPrefs::instance()->mEVshowChanged ) { 550 if ( KOPrefs::instance()->mEVshowChanged ) {
543 if(wideScreen ){ 551 if(wideScreen ){
544 addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); 552 addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) );
545 553
546 } else { 554 } else {
547 addTag("p",i18n("<b>Last modified: ") +" </b>"); 555 addTag("p",i18n("<b>Last modified: ") +" </b>");
548 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 556 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
549 } 557 }
550 } 558 }
551 if ( event->relatedTo() ) { 559 if ( event->relatedTo() ) {
552 addTag("b",i18n("Parent todo:<br>")); 560 addTag("b",i18n("Parent todo:<br>"));
553 561
554 QString t_name = "[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] ";// +event->relatedTo()->summary()); 562 QString t_name = "[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] ";// +event->relatedTo()->summary());
555 563
556 mText += t_name; 564 mText += t_name;
557 mText += "<a href=\"todo_uid:" + event->relatedTo()->uid() + "\">"; 565 mText += "<a href=\"todo_uid:" + event->relatedTo()->uid() + "\">";
558 mText += deTag(event->relatedTo()->summary()); 566 mText += deTag(event->relatedTo()->summary());
559 mText += "</a><br>"; 567 mText += "</a><br>";
560 568
561 // mText.append(deTag("[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] " +event->relatedTo()->summary()) +"<br>"); 569 // mText.append(deTag("[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] " +event->relatedTo()->summary()) +"<br>");
562 } 570 }
563 QPtrList<Incidence> Relations = event->relations(); 571 QPtrList<Incidence> Relations = event->relations();
564 Incidence *to; 572 Incidence *to;
565 if ( Relations.first() ) 573 if ( Relations.first() )
566 addTag("b",i18n("Sub todos:<br>")); 574 addTag("b",i18n("Sub todos:<br>"));
567 for (to=Relations.first();to;to=Relations.next()) { 575 for (to=Relations.first();to;to=Relations.next()) {
568 QString t_name = "[" +QString::number(((Todo*)to)->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%] ";// +to->relatedTo()->summary()); 576 QString t_name = "[" +QString::number(((Todo*)to)->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%] ";// +to->relatedTo()->summary());
569 mText += t_name; 577 mText += t_name;
570 mText += "<a href=\"todo_uid:" + to->uid() + "\">"; 578 mText += "<a href=\"todo_uid:" + to->uid() + "\">";
571 mText += deTag(to->summary()); 579 mText += deTag(to->summary());
572 mText += "</a><br>"; 580 mText += "</a><br>";
573 581
574 } 582 }
575 583
576 if ( KOPrefs::instance()->mEVshowDetails ) { 584 if ( KOPrefs::instance()->mEVshowDetails ) {
577 if (!event->description().isEmpty()) { 585 if (!event->description().isEmpty()) {
578 addTag("p",i18n("<b>Details: </b>")); 586 addTag("p",i18n("<b>Details: </b>"));
579 addTag("p",deTag(event->description())); 587 addTag("p",deTag(event->description()));
580 } 588 }
581 } 589 }
582 setText(mText); 590 setText(mText);
583} 591}
584 592
585void KOEventViewer::formatCategories(Incidence *event) 593void KOEventViewer::formatCategories(Incidence *event)
586{ 594{
587 if (!event->categoriesStr().isEmpty()) { 595 if (!event->categoriesStr().isEmpty()) {
588 if (event->categories().count() == 1) { 596 if (event->categories().count() == 1) {
589 addTag("p","<b>"+i18n("Category") + ":</b> " + event->categoriesStrWithSpace()); 597 addTag("p","<b>"+i18n("Category") + ":</b> " + event->categoriesStrWithSpace());
590 } else { 598 } else {
591 addTag("p","<b>"+i18n("Categories")+":</b> " + event->categoriesStrWithSpace() ) ; 599 addTag("p","<b>"+i18n("Categories")+":</b> " + event->categoriesStrWithSpace() ) ;
592 } 600 }
593 } 601 }
594} 602}
595void KOEventViewer::formatAttendees(Incidence *event) 603void KOEventViewer::formatAttendees(Incidence *event)
596{ 604{
597 QPtrList<Attendee> attendees = event->attendees(); 605 QPtrList<Attendee> attendees = event->attendees();
598 if (attendees.count()) { 606 if (attendees.count()) {
599 607
600 608
601 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); 609 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
602 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); 610 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
603 addTag("h3",i18n("Organizer")); 611 addTag("h3",i18n("Organizer"));
604 mText.append("<ul><li>"); 612 mText.append("<ul><li>");
605#ifndef KORG_NOKABC 613#ifndef KORG_NOKABC
606 614
607#ifdef DESKTOP_VERSION 615#ifdef DESKTOP_VERSION
608 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 616 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
609 KABC::Addressee::List addressList; 617 KABC::Addressee::List addressList;
610 addressList = add_book->findByEmail(event->organizer()); 618 addressList = add_book->findByEmail(event->organizer());
611 KABC::Addressee o = addressList.first(); 619 KABC::Addressee o = addressList.first();
612 if (!o.isEmpty() && addressList.size()<2) { 620 if (!o.isEmpty() && addressList.size()<2) {
613 mText += "<a href=\"uid:" + o.uid() + "\">"; 621 mText += "<a href=\"uid:" + o.uid() + "\">";
614 mText += o.formattedName(); 622 mText += o.formattedName();
615 mText += "</a>\n"; 623 mText += "</a>\n";
616 } else { 624 } else {
617 mText.append(event->organizer()); 625 mText.append(event->organizer());
618 } 626 }
619#else //DESKTOP_VERSION 627#else //DESKTOP_VERSION
diff --git a/korganizer/koincidenceeditor.cpp b/korganizer/koincidenceeditor.cpp
index 9bc0302..236f6f9 100644
--- a/korganizer/koincidenceeditor.cpp
+++ b/korganizer/koincidenceeditor.cpp
@@ -1,185 +1,190 @@
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 <qtooltip.h> 24#include <qtooltip.h>
25#include <qframe.h> 25#include <qframe.h>
26#include <qpixmap.h> 26#include <qpixmap.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qwidgetstack.h> 28#include <qwidgetstack.h>
29#include <qdatetime.h> 29#include <qdatetime.h>
30#include <qdir.h> 30#include <qdir.h>
31 31
32#include <kdebug.h> 32#include <kdebug.h>
33#include <klocale.h> 33#include <klocale.h>
34#include <kstandarddirs.h> 34#include <kstandarddirs.h>
35#include <kmessagebox.h> 35#include <kmessagebox.h>
36#include <kfiledialog.h> 36#include <kfiledialog.h>
37 37
38#include <libkdepim/categoryselectdialog.h> 38#include <libkdepim/categoryselectdialog.h>
39#include <libkdepim/kinputdialog.h> 39#include <libkdepim/kinputdialog.h>
40 40
41#include <libkcal/calendarlocal.h> 41#include <libkcal/calendarlocal.h>
42#include <libkcal/icalformat.h> 42#include <libkcal/icalformat.h>
43 43
44#include "koprefs.h" 44#include "koprefs.h"
45 45
46#include "koincidenceeditor.h" 46#include "koincidenceeditor.h"
47 47
48KOIncidenceEditor::KOIncidenceEditor( const QString &caption, 48KOIncidenceEditor::KOIncidenceEditor( const QString &caption,
49 Calendar *calendar, QWidget *parent ) : 49 Calendar *calendar, QWidget *parent ) :
50 KDialogBase( Tabbed, caption, Ok | Apply | Cancel |/* Default | */User1, Ok, 50 KDialogBase( Tabbed, caption, Ok | Apply | Cancel |/* Default | */User1, Ok,
51 parent, caption, true, false ), 51 parent, caption, true, false ),
52 mSaveTemplateDialog( 0 ) 52 mSaveTemplateDialog( 0 )
53{ 53{
54 mCalendar = calendar; 54 mCalendar = calendar;
55 55
56 setButtonText( Default, i18n("Template...") ); 56 setButtonText( Default, i18n("Template...") );
57 57
58 QString saveTemplateText; 58 QString saveTemplateText;
59 // if ( KOPrefs::instance()->mCompactDialogs ) { 59 // if ( KOPrefs::instance()->mCompactDialogs ) {
60// showButton( User1, false ); 60// showButton( User1, false );
61// showButton( Apply, false ); 61// showButton( Apply, false );
62// } else { 62// } else {
63 showButton( Apply, false ); 63 showButton( Apply, false );
64 saveTemplateText = i18n("Ok+Agenda"); 64 saveTemplateText = i18n("Ok+Agenda");
65 // } 65 // }
66 setButtonText( User1, saveTemplateText ); 66 setButtonText( User1, saveTemplateText );
67 67
68 //mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this ); 68 //mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this );
69 // KOGlobals::fitDialogToScreen( mCategoryDialog ); 69 // KOGlobals::fitDialogToScreen( mCategoryDialog );
70 70
71 //connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories())); 71 //connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories()));
72 72
73 //connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) ); 73 //connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) );
74 // connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) ); 74 // connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) );
75 connect( this, SIGNAL( user1Clicked() ), SLOT( slotShowIncidence() ) ); 75 connect( this, SIGNAL( user1Clicked() ), SLOT( slotShowIncidence() ) );
76} 76}
77 77
78KOIncidenceEditor::~KOIncidenceEditor() 78KOIncidenceEditor::~KOIncidenceEditor()
79{ 79{
80 //delete mCategoryDialog; 80 //delete mCategoryDialog;
81} 81}
82 82
83void KOIncidenceEditor::setupAttendeesTab() 83void KOIncidenceEditor::setupAttendeesTab()
84{ 84{
85 QFrame *topFrame = addPage(i18n("Attendees")); 85 QFrame *topFrame = addPage(i18n("Attendees"));
86 86
87 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 87 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
88 88
89 mDetails = new KOEditorDetails(spacingHint()-2,topFrame); 89 mDetails = new KOEditorDetails(spacingHint()-2,topFrame);
90 topLayout->addWidget(mDetails); 90 topLayout->addWidget(mDetails);
91} 91}
92 92
93void KOIncidenceEditor::alarmWarning()
94{
95 KMessageBox::information( 0, i18n("The alarm for this calendar\nis currently disabled!\nEnable it in resource settings."), i18n("Alarm disabled warning"));
96
97}
93 98
94void KOIncidenceEditor::slotApply() 99void KOIncidenceEditor::slotApply()
95{ 100{
96 processInput( false ); 101 processInput( false );
97} 102}
98void KOIncidenceEditor::accept() 103void KOIncidenceEditor::accept()
99{ 104{
100 slotOk(); 105 slotOk();
101} 106}
102void KOIncidenceEditor::slotOk() 107void KOIncidenceEditor::slotOk()
103{ 108{
104 if ( processInput( false ) ) QDialog::accept(); 109 if ( processInput( false ) ) QDialog::accept();
105} 110}
106 111
107void KOIncidenceEditor::updateCategoryConfig() 112void KOIncidenceEditor::updateCategoryConfig()
108{ 113{
109 qDebug("KOIncidenceEditor::updateCategoryConfig() is dead! "); 114 qDebug("KOIncidenceEditor::updateCategoryConfig() is dead! ");
110 //mCategoryDialog->updateCategoryConfig(); 115 //mCategoryDialog->updateCategoryConfig();
111} 116}
112 117
113void KOIncidenceEditor::slotCancel() 118void KOIncidenceEditor::slotCancel()
114{ 119{
115 reject(); 120 reject();
116} 121}
117 122
118void KOIncidenceEditor::slotLoadTemplate() 123void KOIncidenceEditor::slotLoadTemplate()
119{ 124{
120 kdDebug() << "KOIncidenceEditor::loadTemplate()" << endl; 125 kdDebug() << "KOIncidenceEditor::loadTemplate()" << endl;
121} 126}
122void KOIncidenceEditor::slotShowIncidence() 127void KOIncidenceEditor::slotShowIncidence()
123{ 128{
124 129
125 if ( processInput(true ) ) { 130 if ( processInput(true ) ) {
126 accept(); 131 accept();
127 } 132 }
128} 133}
129 134
130void KOIncidenceEditor::slotSaveTemplate() 135void KOIncidenceEditor::slotSaveTemplate()
131{ 136{
132 kdDebug() << "KOIncidenceEditor::saveTemplate()" << endl; 137 kdDebug() << "KOIncidenceEditor::saveTemplate()" << endl;
133} 138}
134 139
135void KOIncidenceEditor::createSaveTemplateDialog( SaveTemplateDialog::IncidenceType type ) 140void KOIncidenceEditor::createSaveTemplateDialog( SaveTemplateDialog::IncidenceType type )
136{ 141{
137 if ( !mSaveTemplateDialog ) { 142 if ( !mSaveTemplateDialog ) {
138 mSaveTemplateDialog = new SaveTemplateDialog( type, this ); 143 mSaveTemplateDialog = new SaveTemplateDialog( type, this );
139 connect( mSaveTemplateDialog, SIGNAL( templateSelected( const QString & ) ), 144 connect( mSaveTemplateDialog, SIGNAL( templateSelected( const QString & ) ),
140 SLOT( saveTemplate( const QString & ) ) ); 145 SLOT( saveTemplate( const QString & ) ) );
141 } 146 }
142 mSaveTemplateDialog->show(); 147 mSaveTemplateDialog->show();
143 mSaveTemplateDialog->raise(); 148 mSaveTemplateDialog->raise();
144} 149}
145 150
146void KOIncidenceEditor::saveAsTemplate( Incidence *incidence, 151void KOIncidenceEditor::saveAsTemplate( Incidence *incidence,
147 const QString &templateName ) 152 const QString &templateName )
148{ 153{
149 CalendarLocal cal; 154 CalendarLocal cal;
150 cal.addIncidence( incidence ); 155 cal.addIncidence( incidence );
151 ICalFormat format; 156 ICalFormat format;
152 format.save( &cal, templateName ); 157 format.save( &cal, templateName );
153} 158}
154 159
155QString KOIncidenceEditor::loadTemplate( Calendar *cal, const QString &type, 160QString KOIncidenceEditor::loadTemplate( Calendar *cal, const QString &type,
156 const QStringList &templates ) 161 const QStringList &templates )
157{ 162{
158 // bool ok = false; 163 // bool ok = false;
159// QString templateName = KInputDialog::getItem( i18n("Load Template"), 164// QString templateName = KInputDialog::getItem( i18n("Load Template"),
160// i18n("Select a template to load:"), templates, 0, &ok ); 165// i18n("Select a template to load:"), templates, 0, &ok );
161// if ( !ok || templateName.isEmpty() ) return QString::null; 166// if ( !ok || templateName.isEmpty() ) return QString::null;
162 167
163// QString fileName = locateLocal( "data", "korganizer/templates/" + type + "/" + 168// QString fileName = locateLocal( "data", "korganizer/templates/" + type + "/" +
164// templateName ); 169// templateName );
165// fn =KFileDialog:: getOpenFileName( fn, "Import filename(*.ics/*.vcs)", this ); 170// fn =KFileDialog:: getOpenFileName( fn, "Import filename(*.ics/*.vcs)", this );
166 171
167 // QString fileName;// =locateLocal( "templates", incidence->type() ); 172 // QString fileName;// =locateLocal( "templates", incidence->type() );
168// fileName=KFileDialog:: getOpenFileName( fileName, "Load "+incidence()->type(), this ); 173// fileName=KFileDialog:: getOpenFileName( fileName, "Load "+incidence()->type(), this );
169// if ( fileNamelength() == 0) 174// if ( fileNamelength() == 0)
170// return QString::null; 175// return QString::null;
171// if ( fileName.isEmpty() ) { 176// if ( fileName.isEmpty() ) {
172// KMessageBox::error( this, i18n("Unable to find template '%1'.") 177// KMessageBox::error( this, i18n("Unable to find template '%1'.")
173// .arg( fileName ) ); 178// .arg( fileName ) );
174// return QString::null; 179// return QString::null;
175// } else { 180// } else {
176// ICalFormat format; 181// ICalFormat format;
177// if ( !format.load( cal, fileName ) ) { 182// if ( !format.load( cal, fileName ) ) {
178// KMessageBox::error( this, i18n("Error loading template file '%1'.") 183// KMessageBox::error( this, i18n("Error loading template file '%1'.")
179// .arg( fileName ) ); 184// .arg( fileName ) );
180// return QString::null; 185// return QString::null;
181// } 186// }
182// } 187// }
183 188
184 return ""; 189 return "";
185} 190}
diff --git a/korganizer/koincidenceeditor.h b/korganizer/koincidenceeditor.h
index bfd6cc6..2e4bbf8 100644
--- a/korganizer/koincidenceeditor.h
+++ b/korganizer/koincidenceeditor.h
@@ -1,105 +1,106 @@
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#ifndef KOINCIDENCEEDITOR_H 23#ifndef KOINCIDENCEEDITOR_H
24#define KOINCIDENCEEDITOR_H 24#define KOINCIDENCEEDITOR_H
25 25
26#include <kdialogbase.h> 26#include <kdialogbase.h>
27 27
28#include <libkcal/calendar.h> 28#include <libkcal/calendar.h>
29 29
30#include "koeditordetails.h" 30#include "koeditordetails.h"
31#include "savetemplatedialog.h" 31#include "savetemplatedialog.h"
32 32
33class QDateTime; 33class QDateTime;
34namespace KPIM { class CategorySelectDialog; } 34namespace KPIM { class CategorySelectDialog; }
35 35
36using namespace KCal; 36using namespace KCal;
37 37
38/** 38/**
39 This is the base class for the calendar component editors. 39 This is the base class for the calendar component editors.
40*/ 40*/
41class KOIncidenceEditor : public KDialogBase 41class KOIncidenceEditor : public KDialogBase
42{ 42{
43 Q_OBJECT 43 Q_OBJECT
44 public: 44 public:
45 /** 45 /**
46 Construct new IncidenceEditor. 46 Construct new IncidenceEditor.
47 */ 47 */
48 KOIncidenceEditor( const QString &caption, Calendar *calendar, 48 KOIncidenceEditor( const QString &caption, Calendar *calendar,
49 QWidget *parent ); 49 QWidget *parent );
50 virtual ~KOIncidenceEditor(); 50 virtual ~KOIncidenceEditor();
51 51
52 /** Initialize editor. This function creates the tab widgets. */ 52 /** Initialize editor. This function creates the tab widgets. */
53 virtual void init() = 0; 53 virtual void init() = 0;
54 void accept(); 54 void accept();
55 virtual void setCategories( QString )= 0; 55 virtual void setCategories( QString )= 0;
56 56
57 virtual void reload() = 0; 57 virtual void reload() = 0;
58 58
59 public slots: 59 public slots:
60 void updateCategoryConfig(); 60 void updateCategoryConfig();
61 61
62 signals: 62 signals:
63 void editCategories(); 63 void editCategories();
64 void showAgendaView( bool ); 64 void showAgendaView( bool );
65 void dialogClose( Incidence * ); 65 void dialogClose( Incidence * );
66 void jumpToTime( const QDate & ); 66 void jumpToTime( const QDate & );
67 67
68 protected slots: 68 protected slots:
69 void alarmWarning();
69 void slotApply(); 70 void slotApply();
70 void slotOk(); 71 void slotOk();
71 void slotCancel(); 72 void slotCancel();
72 void slotShowIncidence(); 73 void slotShowIncidence();
73 74
74 virtual void slotLoadTemplate(); 75 virtual void slotLoadTemplate();
75 virtual void slotSaveTemplate(); 76 virtual void slotSaveTemplate();
76 77
77 virtual void saveTemplate( const QString & ) = 0; 78 virtual void saveTemplate( const QString & ) = 0;
78 79
79 protected: 80 protected:
80 void setupAttendeesTab(); 81 void setupAttendeesTab();
81 82
82 void createSaveTemplateDialog( SaveTemplateDialog::IncidenceType ); 83 void createSaveTemplateDialog( SaveTemplateDialog::IncidenceType );
83 84
84 QString loadTemplate( Calendar *cal, const QString &type, 85 QString loadTemplate( Calendar *cal, const QString &type,
85 const QStringList &templates ); 86 const QStringList &templates );
86 void saveAsTemplate( Incidence *, const QString &name ); 87 void saveAsTemplate( Incidence *, const QString &name );
87 88
88 /** 89 /**
89 Process user input and create or update event. Returns false if input is invalid. 90 Process user input and create or update event. Returns false if input is invalid.
90 */ 91 */
91 virtual bool processInput( bool emitTime ) { return false; } 92 virtual bool processInput( bool emitTime ) { return false; }
92 93
93 Calendar *mCalendar; 94 Calendar *mCalendar;
94 95
95 //KPIM::CategorySelectDialog *mCategoryDialog; 96 //KPIM::CategorySelectDialog *mCategoryDialog;
96 97
97 KOEditorDetails *mDetails; 98 KOEditorDetails *mDetails;
98 99
99 private: 100 private:
100 SaveTemplateDialog *mSaveTemplateDialog; 101 SaveTemplateDialog *mSaveTemplateDialog;
101}; 102};
102 103
103#endif 104#endif
104 105
105 106
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 682f83b..20a35d2 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -1,125 +1,126 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 1997, 1998 Preston Brown 3 Copyright (c) 1997, 1998 Preston Brown
4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qtooltip.h> 25#include <qtooltip.h>
26#include <qframe.h> 26#include <qframe.h>
27#include <qpixmap.h> 27#include <qpixmap.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qhbox.h> 29#include <qhbox.h>
30#include <qtimer.h>
30#include <qdir.h> 31#include <qdir.h>
31#include <qdatetime.h> 32#include <qdatetime.h>
32#include <qapplication.h> 33#include <qapplication.h>
33#include <qtabwidget.h> 34#include <qtabwidget.h>
34 35
35#include <kiconloader.h> 36#include <kiconloader.h>
36#include <klocale.h> 37#include <klocale.h>
37#include <kfiledialog.h> 38#include <kfiledialog.h>
38#include <kstandarddirs.h> 39#include <kstandarddirs.h>
39#include <kmessagebox.h> 40#include <kmessagebox.h>
40 41
41#include <libkdepim/categoryselectdialog.h> 42#include <libkdepim/categoryselectdialog.h>
42#include <libkcal/calendarlocal.h> 43#include <libkcal/calendarlocal.h>
43#include <libkcal/calendarresources.h> 44#include <libkcal/calendarresources.h>
44#include <libkcal/resourcecalendar.h> 45#include <libkcal/resourcecalendar.h>
45#include <libkcal/icalformat.h> 46#include <libkcal/icalformat.h>
46#include <kresources/resourceselectdialog.h> 47#include <kresources/resourceselectdialog.h>
47#include <libkdepim/kdateedit.h> 48#include <libkdepim/kdateedit.h>
48 49
49#include "koprefs.h" 50#include "koprefs.h"
50#include "kolocationbox.h" 51#include "kolocationbox.h"
51 52
52#include "kotodoeditor.h" 53#include "kotodoeditor.h"
53extern int globalFlagBlockAgenda; 54extern int globalFlagBlockAgenda;
54 55
55KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) : 56KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) :
56 KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent ) 57 KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent )
57{ 58{
58 mTodo = 0; 59 mTodo = 0;
59 mRelatedTodo = 0; 60 mRelatedTodo = 0;
60 findButton(User1)->hide(); 61 findButton(User1)->hide();
61 init(); 62 init();
62 if ( QApplication::desktop()->height() <= 240 ) 63 if ( QApplication::desktop()->height() <= 240 )
63 hideButtons(); 64 hideButtons();
64} 65}
65 66
66KOTodoEditor::~KOTodoEditor() 67KOTodoEditor::~KOTodoEditor()
67{ 68{
68 emit dialogClose( mTodo ); 69 emit dialogClose( mTodo );
69} 70}
70 71
71void KOTodoEditor::init() 72void KOTodoEditor::init()
72{ 73{
73 setupGeneral(); 74 setupGeneral();
74 setupAttendeesTab(); 75 setupAttendeesTab();
75 setupRecurrence(); 76 setupRecurrence();
76 connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence())); 77 connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence()));
77 mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") ); 78 mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") );
78 connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), 79 connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
79 mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime))); 80 mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime)));
80} 81}
81void KOTodoEditor::setupRecurrence() 82void KOTodoEditor::setupRecurrence()
82{ 83{
83 QFrame *topFrame = addPage( i18n("Recurrence") ); 84 QFrame *topFrame = addPage( i18n("Recurrence") );
84 QBoxLayout *topLayout = new QVBoxLayout( topFrame ); 85 QBoxLayout *topLayout = new QVBoxLayout( topFrame );
85 86
86 mRecurrence = new KOEditorRecurrence( topFrame ); 87 mRecurrence = new KOEditorRecurrence( topFrame );
87 topLayout->addWidget( mRecurrence ); 88 topLayout->addWidget( mRecurrence );
88} 89}
89 90
90void KOTodoEditor::setCategories( QString s ) 91void KOTodoEditor::setCategories( QString s )
91{ 92{
92 mGeneral->setCategories(s); 93 mGeneral->setCategories(s);
93} 94}
94void KOTodoEditor::setSecrecy( int sec ) 95void KOTodoEditor::setSecrecy( int sec )
95{ 96{
96 mGeneral->setSecrecy( sec ); 97 mGeneral->setSecrecy( sec );
97} 98}
98void KOTodoEditor::reload() 99void KOTodoEditor::reload()
99{ 100{
100 if ( mTodo ) readTodo( mTodo ); 101 if ( mTodo ) readTodo( mTodo );
101} 102}
102 103
103void KOTodoEditor::setupGeneral() 104void KOTodoEditor::setupGeneral()
104{ 105{
105 mGeneral = new KOEditorGeneralTodo(this); 106 mGeneral = new KOEditorGeneralTodo(this);
106 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); 107 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) );
107 108
108 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); 109 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show()));
109 //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)), 110 //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)),
110 // mGeneral,SLOT(setCategories(const QString &))); 111 // mGeneral,SLOT(setCategories(const QString &)));
111 112
112 if (KOPrefs::instance()->mCompactDialogs) { 113 if (KOPrefs::instance()->mCompactDialogs) {
113 QFrame *topFrame = addPage(i18n("General")); 114 QFrame *topFrame = addPage(i18n("General"));
114 115
115 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 116 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
116 if ( QApplication::desktop()->width() < 480 ) { 117 if ( QApplication::desktop()->width() < 480 ) {
117 topLayout->setMargin(marginHintSmall()); 118 topLayout->setMargin(marginHintSmall());
118 topLayout->setSpacing(spacingHintSmall()); 119 topLayout->setSpacing(spacingHintSmall());
119 } else { 120 } else {
120 topLayout->setMargin(marginHint()); 121 topLayout->setMargin(marginHint());
121 topLayout->setSpacing(spacingHint()); 122 topLayout->setSpacing(spacingHint());
122 } 123 }
123 topLayout->addStretch( 1 ); 124 topLayout->addStretch( 1 );
124 mGeneral->initHeader(topFrame,topLayout); 125 mGeneral->initHeader(topFrame,topLayout);
125 topLayout->addStretch( 1 ); 126 topLayout->addStretch( 1 );
@@ -166,192 +167,195 @@ void KOTodoEditor::setupGeneral()
166 QFrame *topFrame2 = addPage(i18n("Details")); 167 QFrame *topFrame2 = addPage(i18n("Details"));
167 168
168 QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); 169 QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2);
169 topLayout2->setMargin(marginHint()); 170 topLayout2->setMargin(marginHint());
170 topLayout2->setSpacing(spacingHint()); 171 topLayout2->setSpacing(spacingHint());
171 172
172 QHBoxLayout *completionLayout = new QHBoxLayout( topLayout2 ); 173 QHBoxLayout *completionLayout = new QHBoxLayout( topLayout2 );
173 mGeneral->initCompletion(topFrame2,completionLayout); 174 mGeneral->initCompletion(topFrame2,completionLayout);
174 175
175 176
176 mGeneral->initSecrecy( topFrame2, topLayout2 ); 177 mGeneral->initSecrecy( topFrame2, topLayout2 );
177 mGeneral->initDescription(topFrame2,topLayout2); 178 mGeneral->initDescription(topFrame2,topLayout2);
178 179
179 // QHBox * hb = new QHBox ( topFrame2 ); 180 // QHBox * hb = new QHBox ( topFrame2 );
180 // topLayout2->addWidget(hb); 181 // topLayout2->addWidget(hb);
181 // hb->setSpacing( 3 ); 182 // hb->setSpacing( 3 );
182 183
183 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 184 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
184 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 185 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
185 186
186 } else { 187 } else {
187 QFrame *topFrame = addPage(i18n("General")); 188 QFrame *topFrame = addPage(i18n("General"));
188 189
189 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 190 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
190 topLayout->setSpacing(spacingHint()); 191 topLayout->setSpacing(spacingHint());
191 192
192 mGeneral->initHeader(topFrame,topLayout); 193 mGeneral->initHeader(topFrame,topLayout);
193 mGeneral->initTime(topFrame,topLayout); 194 mGeneral->initTime(topFrame,topLayout);
194 mGeneral->initStatus(topFrame,topLayout); 195 mGeneral->initStatus(topFrame,topLayout);
195 QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); 196 QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout);
196 mGeneral->initAlarm(topFrame,alarmLineLayout); 197 mGeneral->initAlarm(topFrame,alarmLineLayout);
197 mGeneral->initDescription(topFrame,topLayout); 198 mGeneral->initDescription(topFrame,topLayout);
198 QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); 199 QBoxLayout *detailsLayout = new QHBoxLayout(topLayout);
199 mGeneral->initCategories( topFrame, detailsLayout ); 200 mGeneral->initCategories( topFrame, detailsLayout );
200 mGeneral->initSecrecy( topFrame, detailsLayout ); 201 mGeneral->initSecrecy( topFrame, detailsLayout );
201 } 202 }
202 mGeneral->finishSetup(); 203 mGeneral->finishSetup();
203 204
204} 205}
205 206
206void KOTodoEditor::editTodo(Todo *todo, bool editDescription) 207void KOTodoEditor::editTodo(Todo *todo, bool editDescription)
207{ 208{
208 //init(); 209 //init();
209 210
210 mTodo = todo; 211 mTodo = todo;
211 readTodo(mTodo); 212 readTodo(mTodo);
212 if ( editDescription ) { 213 if ( editDescription ) {
213 showPage( 1 ); 214 showPage( 1 );
214 mGeneral->setFocusOn( 1 ); 215 mGeneral->setFocusOn( 1 );
215 } else { 216 } else {
216 showPage( 0 ); 217 showPage( 0 );
217 mGeneral->setFocusOn( 2 ); 218 mGeneral->setFocusOn( 2 );
218 } 219 }
219 checkRecurrence(); 220 checkRecurrence();
220} 221}
221 222
222void KOTodoEditor::newTodo(QDateTime due,Todo *relatedTodo,bool allDay) 223void KOTodoEditor::newTodo(QDateTime due,Todo *relatedTodo,bool allDay)
223{ 224{
224 //init(); 225 //init();
225 226
226 mTodo = 0; 227 mTodo = 0;
227 setDefaults(due,relatedTodo,allDay); 228 setDefaults(due,relatedTodo,allDay);
228} 229}
229 230
230void KOTodoEditor::loadDefaults() 231void KOTodoEditor::loadDefaults()
231{ 232{
232 setDefaults(QDateTime::currentDateTime().addDays(7),0,false); 233 setDefaults(QDateTime::currentDateTime().addDays(7),0,false);
233} 234}
234 235
235bool KOTodoEditor::processInput( bool emitTime ) 236bool KOTodoEditor::processInput( bool emitTime )
236{ 237{
237 if (!validateInput()) return false; 238 if (!validateInput()) return false;
238 239
239 Todo *todo = 0; 240 Todo *todo = 0;
240 241
241 if (mTodo) todo = mTodo; 242 if (mTodo) todo = mTodo;
242 else { 243 else {
243 todo = new Todo; 244 todo = new Todo;
244 todo->setOrganizer(KOPrefs::instance()->email()); 245 todo->setOrganizer(KOPrefs::instance()->email());
245 } 246 }
246 247
247 writeTodo(todo); 248 writeTodo(todo);
248 if ( emitTime ) { 249 if ( emitTime ) {
249 globalFlagBlockAgenda = 1; 250 globalFlagBlockAgenda = 1;
250 emit showAgendaView( false ); 251 emit showAgendaView( false );
251 if ( todo->hasDueDate() ) 252 if ( todo->hasDueDate() )
252 emit jumpToTime( todo->dtDue().date() ); 253 emit jumpToTime( todo->dtDue().date() );
253 globalFlagBlockAgenda = 2; 254 globalFlagBlockAgenda = 2;
254 } 255 }
255 if (mTodo) { 256 if (mTodo) {
256 todo->setRevision(todo->revision()+1); 257 todo->setRevision(todo->revision()+1);
257 emit todoChanged(todo); 258 emit todoChanged(todo);
258 } else { 259 } else {
259 mCalendar->addTodo(todo); 260 mCalendar->addTodo(todo);
260 mTodo = todo; 261 mTodo = todo;
261 emit todoAdded(todo); 262 emit todoAdded(todo);
263 if ( todo->isAlarmEnabled () && !todo->alarmEnabled () ) {
264 QTimer::singleShot( 0, this, SLOT ( alarmWarning() ) );
265 }
262 } 266 }
263 267
264 return true; 268 return true;
265} 269}
266 270
267void KOTodoEditor::deleteTodo() 271void KOTodoEditor::deleteTodo()
268{ 272{
269 if (mTodo) { 273 if (mTodo) {
270 if (KOPrefs::instance()->mConfirm) { 274 if (KOPrefs::instance()->mConfirm) {
271 switch (msgItemDelete()) { 275 switch (msgItemDelete()) {
272 case KMessageBox::Continue: // OK 276 case KMessageBox::Continue: // OK
273 emit todoToBeDeleted(mTodo); 277 emit todoToBeDeleted(mTodo);
274 emit dialogClose(mTodo); 278 emit dialogClose(mTodo);
275 mCalendar->deleteTodo(mTodo); 279 mCalendar->deleteTodo(mTodo);
276 emit todoDeleted(); 280 emit todoDeleted();
277 reject(); 281 reject();
278 break; 282 break;
279 } 283 }
280 } 284 }
281 else { 285 else {
282 emit todoToBeDeleted(mTodo); 286 emit todoToBeDeleted(mTodo);
283 emit dialogClose(mTodo); 287 emit dialogClose(mTodo);
284 mCalendar->deleteTodo(mTodo); 288 mCalendar->deleteTodo(mTodo);
285 emit todoDeleted(); 289 emit todoDeleted();
286 reject(); 290 reject();
287 } 291 }
288 } else { 292 } else {
289 reject(); 293 reject();
290 } 294 }
291} 295}
292 296
293void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay) 297void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay)
294{ 298{
295 mRelatedTodo = relatedEvent; 299 mRelatedTodo = relatedEvent;
296 300
297 mGeneral->setDefaults(due,allDay); 301 mGeneral->setDefaults(due,allDay);
298 mDetails->setDefaults(); 302 mDetails->setDefaults();
299 showPage( 0 ); 303 showPage( 0 );
300 if ( mRelatedTodo ) { 304 if ( mRelatedTodo ) {
301 mGeneral->fillCalCombo(mRelatedTodo->calID() ); 305 mGeneral->fillCalCombo(mRelatedTodo->calID() );
302 mGeneral->setCategories (mRelatedTodo->categoriesStr ()); 306 mGeneral->setCategories (mRelatedTodo->categoriesStr ());
303 mGeneral->setSecrecy (mRelatedTodo->secrecy ()); 307 mGeneral->setSecrecy (mRelatedTodo->secrecy ());
304 if ( mRelatedTodo->priority() < 3 ) 308 if ( mRelatedTodo->priority() < 3 )
305 mGeneral->mPriorityCombo->setCurrentItem(mRelatedTodo->priority()-1); 309 mGeneral->mPriorityCombo->setCurrentItem(mRelatedTodo->priority()-1);
306 mGeneral->mSummaryEdit->lineEdit()->setText(mRelatedTodo->summary()+": "); 310 mGeneral->mSummaryEdit->lineEdit()->setText(mRelatedTodo->summary()+": ");
307 int len = mRelatedTodo->summary().length(); 311 int len = mRelatedTodo->summary().length();
308 mGeneral->mSummaryEdit->lineEdit()->setFocus(); 312 mGeneral->mSummaryEdit->lineEdit()->setFocus();
309 mGeneral->mSummaryEdit->lineEdit()->setCursorPosition ( len+2 ); 313 mGeneral->mSummaryEdit->lineEdit()->setCursorPosition ( len+2 );
310 mGeneral->mSummaryEdit->lineEdit()->setSelection ( 0, len+2 ); 314 mGeneral->mSummaryEdit->lineEdit()->setSelection ( 0, len+2 );
311 315
312 } else 316 } else
313 mGeneral->setFocusOn( 2 ); 317 mGeneral->setFocusOn( 2 );
314 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); 318 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
315 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 )); 319 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ));
316} 320}
317void KOTodoEditor::checkRecurrence() 321void KOTodoEditor::checkRecurrence()
318{ 322{
319 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { 323 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
320 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), true ); 324 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), true );
321 325
322 if ( mTodo ) 326 if ( mTodo )
323 mRecurrence->readEvent( mTodo ); 327 mRecurrence->readEvent( mTodo );
324 else { 328 else {
325 bool time = mGeneral->mTimeButton->isChecked(); 329 bool time = mGeneral->mTimeButton->isChecked();
326 QDateTime from,to; 330 QDateTime from,to;
327 if ( time ) { 331 if ( time ) {
328 to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ; 332 to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ;
329 from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ; 333 from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ;
330 } else { 334 } else {
331 to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ; 335 to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ;
332 from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ; 336 from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ;
333 } 337 }
334 if ( to < from ) 338 if ( to < from )
335 to = from; 339 to = from;
336 mRecurrence->setDefaults(from,to); 340 mRecurrence->setDefaults(from,to);
337 } 341 }
338 } else { 342 } else {
339 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); 343 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
340 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 )); 344 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ));
341 } 345 }
342} 346}
343void KOTodoEditor::readTodo(Todo *todo) 347void KOTodoEditor::readTodo(Todo *todo)
344{ 348{
345 mGeneral->readTodo(todo); 349 mGeneral->readTodo(todo);
346 mDetails->readEvent(todo); 350 mDetails->readEvent(todo);
347 mRelatedTodo = 0;//todo->relatedTo(); 351 mRelatedTodo = 0;//todo->relatedTo();
348 // categories 352 // categories
349 // mCategoryDialog->setSelected(todo->categories()); 353 // mCategoryDialog->setSelected(todo->categories());
350 354
351 // We should handle read-only events here. 355 // We should handle read-only events here.
352} 356}
353 357
354void KOTodoEditor::writeTodo(Todo *event) 358void KOTodoEditor::writeTodo(Todo *event)
355{ 359{
356 bool maybeComputeRecurrenceTime = false; 360 bool maybeComputeRecurrenceTime = false;
357 if( event->hasRecurrenceID() && event->percentComplete() < 100) 361 if( event->hasRecurrenceID() && event->percentComplete() < 100)