summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-04-17 14:27:55 (UTC)
committer zautrix <zautrix>2005-04-17 14:27:55 (UTC)
commitb411ec2d8961d07c3e2e9aefc9e04322b7851859 (patch) (unidiff)
tree79e2a70f1ad32562456b0bfa03aa2b916095fbb0 /korganizer
parent2d81c75c4ffb8f144ae58e90e68496500d07a19e (diff)
downloadkdepimpi-b411ec2d8961d07c3e2e9aefc9e04322b7851859.zip
kdepimpi-b411ec2d8961d07c3e2e9aefc9e04322b7851859.tar.gz
kdepimpi-b411ec2d8961d07c3e2e9aefc9e04322b7851859.tar.bz2
qdebugcleanup
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kdatenavigator.cpp4
-rw-r--r--korganizer/koagendaview.cpp6
-rw-r--r--korganizer/kodaymatrix.cpp1
-rw-r--r--korganizer/koeditorgeneral.cpp2
-rw-r--r--korganizer/koeditorrecurrence.cpp10
-rw-r--r--korganizer/koeventviewer.cpp4
-rw-r--r--korganizer/koglobals.cpp31
-rw-r--r--korganizer/koglobals.h5
-rw-r--r--korganizer/koincidenceeditor.cpp1
-rw-r--r--korganizer/kolistview.cpp9
-rw-r--r--korganizer/kolistview.h2
-rw-r--r--korganizer/komonthview.cpp14
-rw-r--r--korganizer/korganizer.pro2
-rw-r--r--korganizer/korganizerE.pro2
-rw-r--r--korganizer/kotodoview.cpp31
-rw-r--r--korganizer/koviewmanager.cpp10
-rw-r--r--korganizer/kowhatsnextview.cpp2
-rw-r--r--korganizer/ktimeedit.cpp2
-rw-r--r--korganizer/mainwindow.cpp6
-rw-r--r--korganizer/mainwindow.h9
-rw-r--r--korganizer/searchdialog.cpp3
21 files changed, 29 insertions, 127 deletions
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index 5aa1c9b..6697602 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -124,53 +124,51 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
124void KDateNavigator::changeFont ( QFont fo ) 124void KDateNavigator::changeFont ( QFont fo )
125{ 125{
126 setFont( fo ); 126 setFont( fo );
127 mNavigatorBar->resetFont( fo ); 127 mNavigatorBar->resetFont( fo );
128} 128}
129QFont KDateNavigator::yourFontHint( QSize si , bool *b) 129QFont KDateNavigator::yourFontHint( QSize si , bool *b)
130{ 130{
131 QFont fo = KOPrefs::instance()->mDateNavigatorFont; 131 QFont fo = KOPrefs::instance()->mDateNavigatorFont;
132 *b = false; 132 *b = false;
133 int fontPoint = fo.pointSize(); 133 int fontPoint = fo.pointSize();
134 while ( fontPoint > 5 ) { 134 while ( fontPoint > 5 ) {
135 --fontPoint; 135 --fontPoint;
136 fo.setPointSize( fontPoint ); 136 fo.setPointSize( fontPoint );
137 setFont( fo ); 137 setFont( fo );
138 mFontChanged = true; 138 mFontChanged = true;
139 mNavigatorBar->resetFont( fo ); 139 mNavigatorBar->resetFont( fo );
140 QSize sh = sizeHintTwoButtons( 2 ); 140 QSize sh = sizeHintTwoButtons( 2 );
141 //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); 141 //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() );
142 if ( si.width() > sh.width() && si.height() > sh.height()) { 142 if ( si.width() > sh.width() && si.height() > sh.height()) {
143 if ( si.width() / sh.width() == 1 ) { 143 if ( si.width() / sh.width() == 1 ) {
144 if ( si.width() < sizeHintTwoButtons( 4 ).width()) 144 if ( si.width() < sizeHintTwoButtons( 4 ).width())
145 continue; 145 continue;
146 } 146 }
147 *b = true; 147 *b = true;
148 //qDebug("fooooooooooooooooooooooouuuuund ");
149 break; 148 break;
150 } 149 }
151 } 150 }
152 //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() );
153 return fo; 151 return fo;
154} 152}
155QSize KDateNavigator::sizeHint() const 153QSize KDateNavigator::sizeHint() const
156{ 154{
157 QFontMetrics fm ( font() ); 155 QFontMetrics fm ( font() );
158 QSize day = daymatrix->sizeHint(); 156 QSize day = daymatrix->sizeHint();
159 QSize nav = mNavigatorBar->sizeHint(); 157 QSize nav = mNavigatorBar->sizeHint();
160 int wid = fm.width( "30") + day.width()+3; 158 int wid = fm.width( "30") + day.width()+3;
161 int hei = fm.height() +day.height()+nav.height()+2; 159 int hei = fm.height() +day.height()+nav.height()+2;
162 if ( wid < nav.width() ) 160 if ( wid < nav.width() )
163 wid = nav.width() ; 161 wid = nav.width() ;
164 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); 162 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei);
165 return QSize ( wid, hei ); 163 return QSize ( wid, hei );
166} 164}
167QSize KDateNavigator::sizeHintTwoButtons( int butnum ) const 165QSize KDateNavigator::sizeHintTwoButtons( int butnum ) const
168{ 166{
169 QFontMetrics fm ( font() ); 167 QFontMetrics fm ( font() );
170 QSize day = daymatrix->sizeHint(); 168 QSize day = daymatrix->sizeHint();
171 QSize nav = mNavigatorBar->sizeHintTwoButtons( butnum ); 169 QSize nav = mNavigatorBar->sizeHintTwoButtons( butnum );
172 int wid = fm.width( "30") + day.width()+3; 170 int wid = fm.width( "30") + day.width()+3;
173 int hei = fm.height() +day.height()+nav.height()+2; 171 int hei = fm.height() +day.height()+nav.height()+2;
174 if ( wid < nav.width() ) 172 if ( wid < nav.width() )
175 wid = nav.width() ; 173 wid = nav.width() ;
176 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); 174 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei);
@@ -347,49 +345,49 @@ void KDateNavigator::updateView()
347} 345}
348 346
349void KDateNavigator::updateConfig() 347void KDateNavigator::updateConfig()
350{ 348{
351 int day; 349 int day;
352 for(int i=0; i<7; i++) { 350 for(int i=0; i<7; i++) {
353 // take the first letter of the day name to be the abbreviation 351 // take the first letter of the day name to be the abbreviation
354 if (KGlobal::locale()->weekStartsMonday()) { 352 if (KGlobal::locale()->weekStartsMonday()) {
355 day = i+1; 353 day = i+1;
356 } else { 354 } else {
357 if (i==0) day = 7; 355 if (i==0) day = 7;
358 else day = i; 356 else day = i;
359 } 357 }
360 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day, 358 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day,
361 true ); 359 true );
362 if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 ); 360 if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 );
363 headings[i]->setText( dayName ); 361 headings[i]->setText( dayName );
364 } 362 }
365 updateDates(); 363 updateDates();
366 updateView(); 364 updateView();
367} 365}
368 366
369void KDateNavigator::setShowWeekNums(bool enabled) 367void KDateNavigator::setShowWeekNums(bool enabled)
370{ 368{
371 qDebug("KDateNavigator::setShowWeekNums***************************** "); 369
372 m_bShowWeekNums = enabled; 370 m_bShowWeekNums = enabled;
373 for(int i=0; i<6; i++) { 371 for(int i=0; i<6; i++) {
374 if(enabled) 372 if(enabled)
375 weeknos[i]->show(); 373 weeknos[i]->show();
376 else 374 else
377 weeknos[i]->hide(); 375 weeknos[i]->hide();
378 } 376 }
379 resize(size()); 377 resize(size());
380} 378}
381 379
382void KDateNavigator::selectDates(const DateList& dateList) 380void KDateNavigator::selectDates(const DateList& dateList)
383{ 381{
384 382
385 if (dateList.count() > 0) { 383 if (dateList.count() > 0) {
386 mNavigatorBar->selectDates( dateList ); 384 mNavigatorBar->selectDates( dateList );
387 mSelectedDates = dateList; 385 mSelectedDates = dateList;
388 386
389 // set our record of the month and year that this datetbl is 387 // set our record of the month and year that this datetbl is
390 // displaying. 388 // displaying.
391 m_MthYr = mSelectedDates.first(); 389 m_MthYr = mSelectedDates.first();
392 390
393 391
394 // set our record of the first day of the week of the current 392 // set our record of the first day of the week of the current
395 // month. This needs to be done before calling dayToIndex, since it 393 // month. This needs to be done before calling dayToIndex, since it
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index b43c40e..b5a4199 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -895,49 +895,49 @@ DateList KOAgendaView::selectedDates()
895} 895}
896 896
897 897
898void KOAgendaView::updateView() 898void KOAgendaView::updateView()
899{ 899{
900 if ( mBlockUpdating ) 900 if ( mBlockUpdating )
901 return; 901 return;
902 // kdDebug() << "KOAgendaView::updateView()" << endl; 902 // kdDebug() << "KOAgendaView::updateView()" << endl;
903 fillAgenda(); 903 fillAgenda();
904 904
905} 905}
906 906
907 907
908/* 908/*
909 Update configuration settings for the agenda view. This method is not 909 Update configuration settings for the agenda view. This method is not
910 complete. 910 complete.
911*/ 911*/
912void KOAgendaView::updateConfig() 912void KOAgendaView::updateConfig()
913{ 913{
914 if ( mBlockUpdating ) 914 if ( mBlockUpdating )
915 return; 915 return;
916 if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) { 916 if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) {
917 int old = KOPrefs::instance()->mHourSize; 917 int old = KOPrefs::instance()->mHourSize;
918 KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1; 918 KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1;
919 qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize ); 919 //qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize );
920 } 920 }
921 921
922 922
923 // update config for children 923 // update config for children
924 mTimeLabels->updateConfig(); 924 mTimeLabels->updateConfig();
925 mAgenda->storePosition(); 925 mAgenda->storePosition();
926 mAgenda->updateConfig(); 926 mAgenda->updateConfig();
927 mAllDayAgenda->updateConfig(); 927 mAllDayAgenda->updateConfig();
928 // widget synchronization 928 // widget synchronization
929 //TODO: find a better way, maybe signal/slot 929 //TODO: find a better way, maybe signal/slot
930 mTimeLabels->positionChanged(); 930 mTimeLabels->positionChanged();
931 931
932 // for some reason, this needs to be called explicitly 932 // for some reason, this needs to be called explicitly
933 mTimeLabels->repaint(); 933 mTimeLabels->repaint();
934 934
935 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); 935 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
936 936
937 // ToolTips displaying summary of events 937 // ToolTips displaying summary of events
938 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() 938 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance()
939 ->mEnableToolTips); 939 ->mEnableToolTips);
940 940
941 //setHolidayMasks(); 941 //setHolidayMasks();
942 942
943 //createDayLabels(); called by via updateView(); 943 //createDayLabels(); called by via updateView();
@@ -1143,52 +1143,52 @@ void KOAgendaView::fillAgenda()
1143 mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; 1143 mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1;
1144 1144
1145 unsigned int numEvent; 1145 unsigned int numEvent;
1146 for(numEvent=0;numEvent<dayEvents.count();++numEvent) { 1146 for(numEvent=0;numEvent<dayEvents.count();++numEvent) {
1147 Event *event = dayEvents.at(numEvent); 1147 Event *event = dayEvents.at(numEvent);
1148 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) 1148 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") )
1149 if ( event->uid().left(15) == QString("last-syncEvent-") ) 1149 if ( event->uid().left(15) == QString("last-syncEvent-") )
1150 continue; 1150 continue;
1151 // kdDebug() << " Event: " << event->summary() << endl; 1151 // kdDebug() << " Event: " << event->summary() << endl;
1152 1152
1153 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; 1153 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol;
1154 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; 1154 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol;
1155 1155
1156 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; 1156 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl;
1157 1157
1158 if (event->doesFloat()) { 1158 if (event->doesFloat()) {
1159 if (event->recurrence()->doesRecur()) { 1159 if (event->recurrence()->doesRecur()) {
1160 if (event->isMultiDay() ) { 1160 if (event->isMultiDay() ) {
1161 endX = endX - beginX;// endX is now number of days 1161 endX = endX - beginX;// endX is now number of days
1162 if ( event->recursOn( currentDate ) ) { 1162 if ( event->recursOn( currentDate ) ) {
1163 endX += curCol; 1163 endX += curCol;
1164 beginX = curCol; 1164 beginX = curCol;
1165 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1165 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1166 } else { 1166 } else {
1167 qDebug("days %d %s",endX , currentDate.toString().latin1()); 1167 //qDebug("days %d %s",endX , currentDate.toString().latin1());
1168 QDate dateit = currentDate.addDays( -endX ); 1168 QDate dateit = currentDate.addDays( -endX );
1169 if ( event->recursOn( dateit ) ) { 1169 if ( event->recursOn( dateit ) ) {
1170 qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() ); 1170 //qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() );
1171 if ( curCol-endX < 0 ) { 1171 if ( curCol-endX < 0 ) {
1172 mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); 1172 mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol);
1173 } 1173 }
1174 } 1174 }
1175 } 1175 }
1176 } else { 1176 } else {
1177 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); 1177 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol);
1178 } 1178 }
1179 1179
1180 } else { 1180 } else {
1181 if (beginX <= 0 && curCol == 0) { 1181 if (beginX <= 0 && curCol == 0) {
1182 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1182 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1183 } else if (beginX == curCol) { 1183 } else if (beginX == curCol) {
1184 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1184 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1185 } 1185 }
1186 } 1186 }
1187 } else if (event->isMultiDay()) { 1187 } else if (event->isMultiDay()) {
1188 if ( event->doesRecur () ) { 1188 if ( event->doesRecur () ) {
1189 QDate dateit = currentDate; 1189 QDate dateit = currentDate;
1190 int count = 0; 1190 int count = 0;
1191 int max = event->dtStart().daysTo( event->dtEnd() ) +2; 1191 int max = event->dtStart().daysTo( event->dtEnd() ) +2;
1192 while (! event->recursOn( dateit ) && count <= max ) { 1192 while (! event->recursOn( dateit ) && count <= max ) {
1193 ++count; 1193 ++count;
1194 dateit = dateit.addDays( -1 ); 1194 dateit = dateit.addDays( -1 );
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index ecca374..17a1d13 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -476,49 +476,48 @@ void KODayMatrix::updateViewTimed()
476 Todo *todo; 476 Todo *todo;
477 for(todo = todos.first(); todo; todo = todos.next()) { 477 for(todo = todos.first(); todo; todo = todos.next()) {
478 //insertTodo( todo ); 478 //insertTodo( todo );
479 if ( todo->hasDueDate() ) { 479 if ( todo->hasDueDate() ) {
480 int day = mStartDate.daysTo( todo->dtDue().date() ); 480 int day = mStartDate.daysTo( todo->dtDue().date() );
481 if ( day >= 0 && day < timeSpan + 1) { 481 if ( day >= 0 && day < timeSpan + 1) {
482 (*cells)[day]->insertTodo( todo ); 482 (*cells)[day]->insertTodo( todo );
483 } 483 }
484 } 484 }
485 } 485 }
486#endif 486#endif
487 487
488#else 488#else
489 //qDebug("KODayMatrix::updateViewTimed "); 489 //qDebug("KODayMatrix::updateViewTimed ");
490 for(int i = 0; i < NUMDAYS; i++) { 490 for(int i = 0; i < NUMDAYS; i++) {
491 // if events are set for the day then remember to draw it bold 491 // if events are set for the day then remember to draw it bold
492 QPtrList<Event> eventlist = mCalendar->events(days[i]); 492 QPtrList<Event> eventlist = mCalendar->events(days[i]);
493 Event *event; 493 Event *event;
494 int numEvents = eventlist.count(); 494 int numEvents = eventlist.count();
495 QString holiStr = ""; 495 QString holiStr = "";
496 bDays.clearBit(i); 496 bDays.clearBit(i);
497 hDays.clearBit(i); 497 hDays.clearBit(i);
498 eDays.clearBit(i); 498 eDays.clearBit(i);
499 for(event=eventlist.first();event != 0;event=eventlist.next()) { 499 for(event=eventlist.first();event != 0;event=eventlist.next()) {
500 qDebug("FFFFFFFFFFFFFFFFFFFFFFFFF ");
501 ushort recurType = event->recurrence()->doesRecur(); 500 ushort recurType = event->recurrence()->doesRecur();
502 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || 501 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) ||
503 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { 502 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) {
504 numEvents--; 503 numEvents--;
505 } 504 }
506 if ( event->isHoliday()) { 505 if ( event->isHoliday()) {
507 hDays.setBit(i); 506 hDays.setBit(i);
508 if ( !holiStr.isEmpty() ) 507 if ( !holiStr.isEmpty() )
509 holiStr += "\n"; 508 holiStr += "\n";
510 holiStr += event->summary(); 509 holiStr += event->summary();
511 if ( !event->location().isEmpty() ) 510 if ( !event->location().isEmpty() )
512 holiStr += " (" + event->location() + ")"; 511 holiStr += " (" + event->location() + ")";
513 } 512 }
514 if ( event->isBirthday()) { 513 if ( event->isBirthday()) {
515 if ( !holiStr.isEmpty() ) 514 if ( !holiStr.isEmpty() )
516 holiStr += "\n"; 515 holiStr += "\n";
517 holiStr += i18n("Birthday") + ": "+event->summary(); 516 holiStr += i18n("Birthday") + ": "+event->summary();
518 if ( !event->location().isEmpty() ) 517 if ( !event->location().isEmpty() )
519 holiStr += " (" + event->location() + ")"; 518 holiStr += " (" + event->location() + ")";
520 bDays.setBit(i); 519 bDays.setBit(i);
521 } 520 }
522 } 521 }
523 if ( numEvents ) 522 if ( numEvents )
524 eDays.setBit(i); 523 eDays.setBit(i);
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index 9df76e7..0045b7f 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -211,49 +211,49 @@ void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout)
211 mAlarmSoundButton = new QPushButton(parent); 211 mAlarmSoundButton = new QPushButton(parent);
212 mAlarmSoundButton->setPixmap(SmallIcon("playsound")); 212 mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
213 mAlarmSoundButton->setToggleButton(true); 213 mAlarmSoundButton->setToggleButton(true);
214 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 214 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
215 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); 215 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
216 alarmLayout->addWidget(mAlarmSoundButton); 216 alarmLayout->addWidget(mAlarmSoundButton);
217 217
218 mAlarmProgramButton = new QPushButton(parent); 218 mAlarmProgramButton = new QPushButton(parent);
219 mAlarmProgramButton->setPixmap(SmallIcon("run")); 219 mAlarmProgramButton->setPixmap(SmallIcon("run"));
220 mAlarmProgramButton->setToggleButton(true); 220 mAlarmProgramButton->setToggleButton(true);
221 QToolTip::add(mAlarmProgramButton, i18n("No program set")); 221 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
222 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); 222 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram()));
223 alarmLayout->addWidget(mAlarmProgramButton); 223 alarmLayout->addWidget(mAlarmProgramButton);
224 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); 224 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 );
225 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); 225 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 );
226 // if ( KOPrefs::instance()->mCompactDialogs ) { 226 // if ( KOPrefs::instance()->mCompactDialogs ) {
227 // mAlarmSoundButton->hide(); 227 // mAlarmSoundButton->hide();
228 // mAlarmProgramButton->hide(); 228 // mAlarmProgramButton->hide();
229 // } 229 // }
230} 230}
231 231
232void KOEditorGeneral::pickAlarmSound() 232void KOEditorGeneral::pickAlarmSound()
233{ 233{
234 234
235 qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); 235 //qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() );
236 236
237 bool oldState = mAlarmSoundButton->isOn(); 237 bool oldState = mAlarmSoundButton->isOn();
238 238
239 QString fileName(KFileDialog::getOpenFileName(mAlarmSound, 239 QString fileName(KFileDialog::getOpenFileName(mAlarmSound,
240 i18n("*.wav|Wav Files"), 0)); 240 i18n("*.wav|Wav Files"), 0));
241 if (!fileName.isEmpty()) { 241 if (!fileName.isEmpty()) {
242 mAlarmSound = fileName; 242 mAlarmSound = fileName;
243 QToolTip::remove(mAlarmSoundButton); 243 QToolTip::remove(mAlarmSoundButton);
244 QString dispStr = i18n("Playing '%1'").arg(fileName); 244 QString dispStr = i18n("Playing '%1'").arg(fileName);
245 QToolTip::add(mAlarmSoundButton, dispStr); 245 QToolTip::add(mAlarmSoundButton, dispStr);
246 mAlarmProgramButton->setOn(false); 246 mAlarmProgramButton->setOn(false);
247 mAlarmSoundButton->setOn(true); 247 mAlarmSoundButton->setOn(true);
248 QToolTip::add(mAlarmProgramButton, i18n("No program set")); 248 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
249 } else { 249 } else {
250 mAlarmProgramButton->setOn(oldState); 250 mAlarmProgramButton->setOn(oldState);
251 mAlarmSoundButton->setOn(!oldState); 251 mAlarmSoundButton->setOn(!oldState);
252 252
253 253
254 } 254 }
255 255
256 if (mAlarmProgramButton->isOn()) 256 if (mAlarmProgramButton->isOn())
257 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); 257 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
258 if ( mAlarmSoundButton->isOn()) 258 if ( mAlarmSoundButton->isOn())
259 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); 259 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index 01c5773..47e73dd 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -918,73 +918,73 @@ void KOEditorRecurrence::readEvent(Incidence *event)
918 if ( rmp.first()->negative ) 918 if ( rmp.first()->negative )
919 count = 5 - rmp.first()->rPos - 1; 919 count = 5 - rmp.first()->rPos - 1;
920 else 920 else
921 count = rmp.first()->rPos - 1; 921 count = rmp.first()->rPos - 1;
922 day = 0; 922 day = 0;
923 while ( !rmp.first()->rDays.testBit( day ) ) ++day; 923 while ( !rmp.first()->rDays.testBit( day ) ) ++day;
924 mMonthly->setByPos( count, day ); 924 mMonthly->setByPos( count, day );
925 925
926 mMonthly->setFrequency( f ); 926 mMonthly->setFrequency( f );
927 927
928 break; 928 break;
929 case Recurrence::rMonthlyDay: 929 case Recurrence::rMonthlyDay:
930 recurrenceType = RecurrenceChooser::Monthly; 930 recurrenceType = RecurrenceChooser::Monthly;
931 931
932 rmd = r->monthDays(); 932 rmd = r->monthDays();
933 day = *rmd.first() - 1; 933 day = *rmd.first() - 1;
934 mMonthly->setByDay( day ); 934 mMonthly->setByDay( day );
935 935
936 mMonthly->setFrequency( f ); 936 mMonthly->setFrequency( f );
937 937
938 break; 938 break;
939 case Recurrence::rYearlyMonth: 939 case Recurrence::rYearlyMonth:
940 { 940 {
941 recurrenceType = RecurrenceChooser::Yearly; 941 recurrenceType = RecurrenceChooser::Yearly;
942 qDebug("Recurrence::rYearlyMonth: "); 942 //qDebug("Recurrence::rYearlyMonth: ");
943 day = event->dtStart().date().day(); 943 day = event->dtStart().date().day();
944 rmd = r->yearNums(); 944 rmd = r->yearNums();
945 if ( rmd.count() > 0 ) 945 if ( rmd.count() > 0 )
946 month = *rmd.first(); 946 month = *rmd.first();
947 else 947 else
948 month = event->dtStart().date().month() ; 948 month = event->dtStart().date().month() ;
949 mYearly->setByMonth( month, day ); 949 mYearly->setByMonth( month, day );
950#if 0 950#if 0
951 qDebug("2day = %d ",day ); 951 //qDebug("2day = %d ",day );
952 QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions(); 952 QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions();
953 int month; 953 int month;
954 if ( !monthlist.isEmpty() ) { 954 if ( !monthlist.isEmpty() ) {
955 month = monthlist.first()->rPos ; 955 month = monthlist.first()->rPos ;
956 } else { 956 } else {
957 month = event->dtStart().date().month() ; 957 month = event->dtStart().date().month() ;
958 } 958 }
959 mYearly->setByMonth( day, month ); 959 mYearly->setByMonth( day, month );
960#endif 960#endif
961 mYearly->setFrequency( f ); 961 mYearly->setFrequency( f );
962 } 962 }
963 963
964 break; 964 break;
965 case Recurrence::rYearlyDay: 965 case Recurrence::rYearlyDay:
966 qDebug("Recurrence::rYearlyDay: "); 966 //qDebug("Recurrence::rYearlyDay: ");
967 recurrenceType = RecurrenceChooser::Yearly; 967 recurrenceType = RecurrenceChooser::Yearly;
968 mYearly->setByDay( event->dtStart().date().dayOfYear() ); 968 mYearly->setByDay( event->dtStart().date().dayOfYear() );
969 mYearly->setFrequency( f ); 969 mYearly->setFrequency( f );
970 break; 970 break;
971 default: 971 default:
972 setDefaults( event->dtStart(), dtEnd, true ); 972 setDefaults( event->dtStart(), dtEnd, true );
973 break; 973 break;
974 } 974 }
975 975
976 mRecurrenceChooser->setType( recurrenceType ); 976 mRecurrenceChooser->setType( recurrenceType );
977 showCurrentRule( recurrenceType ); 977 showCurrentRule( recurrenceType );
978 978
979 mRecurrenceRange->setDateTimes( event->dtStart() ); 979 mRecurrenceRange->setDateTimes( event->dtStart() );
980 980
981 if ( r->doesRecur() ) { 981 if ( r->doesRecur() ) {
982 mRecurrenceRange->setDuration( r->duration() ); 982 mRecurrenceRange->setDuration( r->duration() );
983 if ( r->duration() == 0 ) 983 if ( r->duration() == 0 )
984 { 984 {
985 if ( r->endDate() < event->dtStart().date() ) 985 if ( r->endDate() < event->dtStart().date() )
986 mRecurrenceRange->setEndDate( event->dtStart().date() ); 986 mRecurrenceRange->setEndDate( event->dtStart().date() );
987 else 987 else
988 mRecurrenceRange->setEndDate( r->endDate() ); 988 mRecurrenceRange->setEndDate( r->endDate() );
989 } else 989 } else
990 mRecurrenceRange->setEndDate( event->dtStart().date() ); 990 mRecurrenceRange->setEndDate( event->dtStart().date() );
@@ -1000,79 +1000,79 @@ void KOEditorRecurrence::writeEvent( Incidence *event )
1000 // clear out any old settings; 1000 // clear out any old settings;
1001 r->unsetRecurs(); 1001 r->unsetRecurs();
1002 1002
1003 if ( mEnabledCheck->isChecked() ) { 1003 if ( mEnabledCheck->isChecked() ) {
1004 int duration = mRecurrenceRange->duration(); 1004 int duration = mRecurrenceRange->duration();
1005 QDate endDate; 1005 QDate endDate;
1006 if ( duration == 0 ) endDate = mRecurrenceRange->endDate(); 1006 if ( duration == 0 ) endDate = mRecurrenceRange->endDate();
1007 1007
1008 int recurrenceType = mRecurrenceChooser->type(); 1008 int recurrenceType = mRecurrenceChooser->type();
1009 1009
1010 if ( recurrenceType == RecurrenceChooser::Daily ) { 1010 if ( recurrenceType == RecurrenceChooser::Daily ) {
1011 int freq = mDaily->frequency(); 1011 int freq = mDaily->frequency();
1012 if ( duration != 0 ) r->setDaily( freq, duration ); 1012 if ( duration != 0 ) r->setDaily( freq, duration );
1013 else r->setDaily( freq, endDate ); 1013 else r->setDaily( freq, endDate );
1014 } else if ( recurrenceType == RecurrenceChooser::Weekly ) { 1014 } else if ( recurrenceType == RecurrenceChooser::Weekly ) {
1015 int freq = mWeekly->frequency(); 1015 int freq = mWeekly->frequency();
1016 QBitArray days = mWeekly->days(); 1016 QBitArray days = mWeekly->days();
1017 int j; 1017 int j;
1018 bool found = false; 1018 bool found = false;
1019 for (j = 0; j < 7 ; ++j ) { 1019 for (j = 0; j < 7 ; ++j ) {
1020 found |=days.at(j); 1020 found |=days.at(j);
1021 } 1021 }
1022 if ( !found ) { 1022 if ( !found ) {
1023 days.setBit( event->dtStart().date().dayOfWeek()-1); 1023 days.setBit( event->dtStart().date().dayOfWeek()-1);
1024 qDebug("bit set %d ", event->dtStart().date().dayOfWeek()-1); 1024 //qDebug("bit set %d ", event->dtStart().date().dayOfWeek()-1);
1025 } 1025 }
1026 if ( duration != 0 ) r->setWeekly( freq, days, duration ); 1026 if ( duration != 0 ) r->setWeekly( freq, days, duration );
1027 else r->setWeekly( freq, days, endDate ); 1027 else r->setWeekly( freq, days, endDate );
1028 } else if ( recurrenceType == RecurrenceChooser::Monthly ) { 1028 } else if ( recurrenceType == RecurrenceChooser::Monthly ) {
1029 int freq = mMonthly->frequency(); 1029 int freq = mMonthly->frequency();
1030 if ( mMonthly->byPos() ) { 1030 if ( mMonthly->byPos() ) {
1031 int pos = mMonthly->count(); 1031 int pos = mMonthly->count();
1032 1032
1033 QBitArray days( 7 ); 1033 QBitArray days( 7 );
1034 days.fill( false ); 1034 days.fill( false );
1035 1035
1036 days.setBit( mMonthly->weekday() ); 1036 days.setBit( mMonthly->weekday() );
1037 if ( duration != 0 ) 1037 if ( duration != 0 )
1038 r->setMonthly( Recurrence::rMonthlyPos, freq, duration ); 1038 r->setMonthly( Recurrence::rMonthlyPos, freq, duration );
1039 else 1039 else
1040 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); 1040 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );
1041 r->addMonthlyPos( pos, days ); 1041 r->addMonthlyPos( pos, days );
1042 } else { 1042 } else {
1043 // it's by day 1043 // it's by day
1044 int day = mMonthly->day(); 1044 int day = mMonthly->day();
1045 1045
1046 if ( duration != 0 ) { 1046 if ( duration != 0 ) {
1047 r->setMonthly( Recurrence::rMonthlyDay, freq, duration ); 1047 r->setMonthly( Recurrence::rMonthlyDay, freq, duration );
1048 } else { 1048 } else {
1049 r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); 1049 r->setMonthly( Recurrence::rMonthlyDay, freq, endDate );
1050 } 1050 }
1051 r->addMonthlyDay( day ); 1051 r->addMonthlyDay( day );
1052 } 1052 }
1053 } else if ( recurrenceType == RecurrenceChooser::Yearly ) { 1053 } else if ( recurrenceType == RecurrenceChooser::Yearly ) {
1054 qDebug("RecurrenceChooser::Yearly "); 1054 //qDebug("RecurrenceChooser::Yearly ");
1055 int freq = mYearly->frequency(); 1055 int freq = mYearly->frequency();
1056 if ( mYearly->byDay() ) { 1056 if ( mYearly->byDay() ) {
1057 if ( duration != 0 ) { 1057 if ( duration != 0 ) {
1058 r->setYearly( Recurrence::rYearlyDay, freq, duration ); 1058 r->setYearly( Recurrence::rYearlyDay, freq, duration );
1059 } else { 1059 } else {
1060 r->setYearly( Recurrence::rYearlyDay, freq, endDate ); 1060 r->setYearly( Recurrence::rYearlyDay, freq, endDate );
1061 } 1061 }
1062 r->addYearlyNum( event->dtStart().date().dayOfYear() ); 1062 r->addYearlyNum( event->dtStart().date().dayOfYear() );
1063 } else { 1063 } else {
1064 if ( duration != 0 ) { 1064 if ( duration != 0 ) {
1065 r->setYearly( Recurrence::rYearlyMonth, freq, duration ); 1065 r->setYearly( Recurrence::rYearlyMonth, freq, duration );
1066 } else { 1066 } else {
1067 r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); 1067 r->setYearly( Recurrence::rYearlyMonth, freq, endDate );
1068 } 1068 }
1069 r->addYearlyNum( mYearly->month() ); 1069 r->addYearlyNum( mYearly->month() );
1070 } 1070 }
1071 1071
1072 } 1072 }
1073 1073
1074 event->setExDates( mExceptions->dates() ); 1074 event->setExDates( mExceptions->dates() );
1075 } 1075 }
1076} 1076}
1077 1077
1078void KOEditorRecurrence::setDateTimeStr( const QString &str ) 1078void KOEditorRecurrence::setDateTimeStr( const QString &str )
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index fefc778..f39b5e1 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -78,51 +78,49 @@ void KOEventViewer::printMe()
78 78
79 KOPrintPrefs pp ( this ); 79 KOPrintPrefs pp ( this );
80 if (!pp.exec() ) 80 if (!pp.exec() )
81 return; 81 return;
82 int scaleval = pp.printMode() ; 82 int scaleval = pp.printMode() ;
83 83
84 QPrinter printer; 84 QPrinter printer;
85 if (!printer.setup() ) 85 if (!printer.setup() )
86 return; 86 return;
87 QPainter p; 87 QPainter p;
88 p.begin ( &printer ); 88 p.begin ( &printer );
89 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); 89 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
90 float dx, dy; 90 float dx, dy;
91 int wid = (m.width() * 9)/10; 91 int wid = (m.width() * 9)/10;
92 dx = (float) wid/(float)contentsWidth (); 92 dx = (float) wid/(float)contentsWidth ();
93 dy = (float)(m.height()) / (float)contentsHeight (); 93 dy = (float)(m.height()) / (float)contentsHeight ();
94 float scale; 94 float scale;
95 // scale to fit the width or height of the paper 95 // scale to fit the width or height of the paper
96 if ( dx < dy ) 96 if ( dx < dy )
97 scale = dx; 97 scale = dx;
98 else 98 else
99 scale = dy; 99 scale = dy;
100 100
101 p.translate( m.width()/10,0 ); 101 p.translate( m.width()/10,0 );
102 qDebug("Scale: %f ", scale );
103 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { 102 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) {
104 qDebug("SCALE ");
105 p.scale( scale, scale ); 103 p.scale( scale, scale );
106 } 104 }
107 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); 105 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
108 p.end(); 106 p.end();
109#endif 107#endif
110 108
111} 109}
112void KOEventViewer::setSource(const QString& n) 110void KOEventViewer::setSource(const QString& n)
113{ 111{
114 112
115 if ( n.left(3) == "uid" ) 113 if ( n.left(3) == "uid" )
116#ifdef DESKTOP_VERSION 114#ifdef DESKTOP_VERSION
117 { 115 {
118 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 116 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
119 KABC::AddressBook::Iterator it; 117 KABC::AddressBook::Iterator it;
120 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 118 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
121 // LR I do not understand, why the uid string is different on zaurus and desktop 119 // LR I do not understand, why the uid string is different on zaurus and desktop
122 QString uid = "uid://"+(*it).uid(); 120 QString uid = "uid://"+(*it).uid();
123 121
124 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); 122 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1());
125 if (n == uid ) { 123 if (n == uid ) {
126 //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); 124 //qDebug("found %s ",(*it).mobileHomePhone().latin1() );
127 QDialog dia( this,"dia123", true ); 125 QDialog dia( this,"dia123", true );
128 dia.setCaption( i18n("Details of attendee") ); 126 dia.setCaption( i18n("Details of attendee") );
@@ -146,53 +144,51 @@ void KOEventViewer::setSource(const QString& n)
146 if ( "uid:organizer" == n ) { 144 if ( "uid:organizer" == n ) {
147 ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),""); 145 ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),"");
148 return; 146 return;
149 } 147 }
150 QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); 148 QPtrList<Attendee> attendees = mCurrentIncidence->attendees();
151 if (attendees.count()) { 149 if (attendees.count()) {
152 Attendee *a; 150 Attendee *a;
153 for(a=attendees.first();a;a=attendees.next()) { 151 for(a=attendees.first();a;a=attendees.next()) {
154 if ( "uid:"+a->uid() == n ) { 152 if ( "uid:"+a->uid() == n ) {
155 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); 153 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid());
156 return; 154 return;
157 } 155 }
158 } 156 }
159 } 157 }
160 return; 158 return;
161 } 159 }
162 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 160 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
163 // the result should now arrive through method insertAttendees 161 // the result should now arrive through method insertAttendees
164 //QString uid = "uid:"+(*it).uid(); 162 //QString uid = "uid:"+(*it).uid();
165#endif 163#endif
166 if ( n.left(6) == "mailto" ) { 164 if ( n.left(6) == "mailto" ) {
167 // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); 165 // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1());
168#ifndef DESKTOP_VERSION 166#ifndef DESKTOP_VERSION
169 if ( n.mid(7,3) == "ALL" ) { 167 if ( n.mid(7,3) == "ALL" ) {
170 qDebug("all ");
171 mailToAttendees( true ); 168 mailToAttendees( true );
172 } else if ( n.mid(7,4) == "RSVP" ) { 169 } else if ( n.mid(7,4) == "RSVP" ) {
173 mailToAttendees( false ); 170 mailToAttendees( false );
174 qDebug("rsvp ");
175 } else { 171 } else {
176 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); 172 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" );
177 e << n.mid(7); 173 e << n.mid(7);
178 } 174 }
179#endif 175#endif
180 176
181 } 177 }
182 178
183 179
184#ifndef KORG_NODCOP 180#ifndef KORG_NODCOP
185 kdDebug() << "KOEventViewer::setSource(): " << n << endl; 181 kdDebug() << "KOEventViewer::setSource(): " << n << endl;
186 QString tmpStr; 182 QString tmpStr;
187 if (n.startsWith("mailto:")) { 183 if (n.startsWith("mailto:")) {
188 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); 184 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null);
189 //emit showIncidence(n); 185 //emit showIncidence(n);
190 return; 186 return;
191 } else if (n.startsWith("uid:")) { 187 } else if (n.startsWith("uid:")) {
192 DCOPClient *client = KApplication::kApplication()->dcopClient(); 188 DCOPClient *client = KApplication::kApplication()->dcopClient();
193 const QByteArray noParamData; 189 const QByteArray noParamData;
194 const QByteArray paramData; 190 const QByteArray paramData;
195 QByteArray replyData; 191 QByteArray replyData;
196 QCString replyTypeStr; 192 QCString replyTypeStr;
197#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) 193#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData))
198 bool foundAbbrowser = PING_ABBROWSER; 194 bool foundAbbrowser = PING_ABBROWSER;
diff --git a/korganizer/koglobals.cpp b/korganizer/koglobals.cpp
index 8016034..9ece77f 100644
--- a/korganizer/koglobals.cpp
+++ b/korganizer/koglobals.cpp
@@ -11,123 +11,94 @@
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 <qapplication.h> 24#include <qapplication.h>
25 25
26#include <kdebug.h> 26#include <kdebug.h>
27#include <kglobal.h> 27#include <kglobal.h>
28#include <kconfig.h> 28#include <kconfig.h>
29#include <kstandarddirs.h> 29#include <kstandarddirs.h>
30#include <kglobalsettings.h> 30#include <kglobalsettings.h>
31#include <klocale.h> 31#include <klocale.h>
32 32
33#include <kcalendarsystem.h> 33#include <kcalendarsystem.h>
34 34
35#ifndef KORG_NOKALARMD
36#include "kalarmdclient.h"
37#endif
38#include "simplealarmclient.h"
39 35
40#include "koglobals.h" 36#include "koglobals.h"
41#include "koprefs.h" 37#include "koprefs.h"
42 38
43class NopAlarmClient : public AlarmClient
44{
45 public:
46 void startDaemon() {}
47 bool setCalendars( const QStringList & ) { return false; }
48 bool addCalendar( const QString & ) { return false; }
49 bool removeCalendar( const QString & ) { return false; }
50 bool reloadCalendar( const QString & ) { return false; }
51};
52 39
53KOGlobals *KOGlobals::mSelf = 0; 40KOGlobals *KOGlobals::mSelf = 0;
54 41
55KOGlobals *KOGlobals::self() 42KOGlobals *KOGlobals::self()
56{ 43{
57 if (!mSelf) { 44 if (!mSelf) {
58 mSelf = new KOGlobals; 45 mSelf = new KOGlobals;
59 } 46 }
60 47
61 return mSelf; 48 return mSelf;
62} 49}
63 50
64KOGlobals::KOGlobals() 51KOGlobals::KOGlobals()
65{ 52{
66 KConfig *cfg = KOGlobals::config(); 53 KConfig *cfg = KOGlobals::config();
67 54
68 cfg->setGroup("General"); 55 cfg->setGroup("General");
69 mCalendarSystem = KGlobal::locale()->calendar(); 56 mCalendarSystem = KGlobal::locale()->calendar();
70 57
71 cfg->setGroup("AlarmDaemon");
72 QString alarmClient = cfg->readEntry( "Daemon", "kalarmd" );
73 if ( alarmClient == "simple" ) {
74 mAlarmClient = new SimpleAlarmClient;
75#ifndef KORG_NOKALARMD
76 } else if ( alarmClient == "kalarmd" ) {
77 mAlarmClient = new KalarmdClient;
78#endif
79 } else {
80 mAlarmClient = new NopAlarmClient;
81 }
82} 58}
83 59
84KConfig* KOGlobals::config() 60KConfig* KOGlobals::config()
85{ 61{
86 static KConfig *mConfig = 0; 62 static KConfig *mConfig = 0;
87 if (!mConfig) { 63 if (!mConfig) {
88 KOPrefs *p = KOPrefs::instance(); 64 KOPrefs *p = KOPrefs::instance();
89 mConfig = p->getConfig(); 65 mConfig = p->getConfig();
90 //mConfig = new KConfig( locateLocal( "config", "korganizerrc" ) ); 66 //mConfig = new KConfig( locateLocal( "config", "korganizerrc" ) );
91 } 67 }
92 return mConfig; 68 return mConfig;
93} 69}
94 70
95KOGlobals::~KOGlobals() 71KOGlobals::~KOGlobals()
96{ 72{
97 delete mAlarmClient; 73
98} 74}
99 75
100const KCalendarSystem *KOGlobals::calendarSystem() const 76const KCalendarSystem *KOGlobals::calendarSystem() const
101{ 77{
102 return mCalendarSystem; 78 return mCalendarSystem;
103} 79}
104 80
105AlarmClient *KOGlobals::alarmClient() const
106{
107 return mAlarmClient;
108}
109
110void KOGlobals::fitDialogToScreen( QWidget *wid, bool force ) 81void KOGlobals::fitDialogToScreen( QWidget *wid, bool force )
111{ 82{
112 bool resized = false; 83 bool resized = false;
113 84
114 int w = wid->frameSize().width(); 85 int w = wid->frameSize().width();
115 int h = wid->frameSize().height(); 86 int h = wid->frameSize().height();
116 87
117 QRect desk = KGlobalSettings::desktopGeometry(wid); 88 QRect desk = KGlobalSettings::desktopGeometry(wid);
118 if ( w > desk.width() ) { 89 if ( w > desk.width() ) {
119 w = desk.width(); 90 w = desk.width();
120 resized = true; 91 resized = true;
121 } 92 }
122 // Yuck this hack is ugly. Is the -30 really to circumvent the size of 93 // Yuck this hack is ugly. Is the -30 really to circumvent the size of
123 // kicker?! 94 // kicker?!
124 if ( h > desk.height() - 30 ) { 95 if ( h > desk.height() - 30 ) {
125 h = desk.height() - 30; 96 h = desk.height() - 30;
126 resized = true; 97 resized = true;
127 } 98 }
128 99
129 if ( resized || force ) { 100 if ( resized || force ) {
130 wid->resize( w, h ); 101 wid->resize( w, h );
131 wid->move( desk.x(), desk.y()+15 ); 102 wid->move( desk.x(), desk.y()+15 );
132 if ( force ) wid->setFixedSize( w, h ); 103 if ( force ) wid->setFixedSize( w, h );
133 } 104 }
diff --git a/korganizer/koglobals.h b/korganizer/koglobals.h
index 357ff5f..b3ff67b 100644
--- a/korganizer/koglobals.h
+++ b/korganizer/koglobals.h
@@ -22,38 +22,35 @@
22*/ 22*/
23#ifndef KORG_GLOBALS_H 23#ifndef KORG_GLOBALS_H
24#define KORG_GLOBALS_H 24#define KORG_GLOBALS_H
25 25
26class KCalendarSystem; 26class KCalendarSystem;
27class AlarmClient; 27class AlarmClient;
28 28
29class KConfig; 29class KConfig;
30 30
31class KOGlobals 31class KOGlobals
32{ 32{
33 public: 33 public:
34 static KOGlobals *self(); 34 static KOGlobals *self();
35 35
36 enum { EVENTADDED, EVENTEDITED, EVENTDELETED }; 36 enum { EVENTADDED, EVENTEDITED, EVENTDELETED };
37 enum { PRIORITY_MODIFIED, COMPLETION_MODIFIED, CATEGORY_MODIFIED, UNKNOWN_MODIFIED }; 37 enum { PRIORITY_MODIFIED, COMPLETION_MODIFIED, CATEGORY_MODIFIED, UNKNOWN_MODIFIED };
38 38
39 static void fitDialogToScreen( QWidget *widget, bool force=false ); 39 static void fitDialogToScreen( QWidget *widget, bool force=false );
40 static KConfig *config(); 40 static KConfig *config();
41 41
42 static bool reverseLayout(); 42 static bool reverseLayout();
43 43
44 const KCalendarSystem *calendarSystem() const; 44 const KCalendarSystem *calendarSystem() const;
45 45
46 AlarmClient *alarmClient() const;
47
48 protected: 46 protected:
49 KOGlobals(); 47 KOGlobals();
50 ~KOGlobals(); 48 ~KOGlobals();
51 49
52 private: 50 private:
53 static KOGlobals *mSelf; 51 static KOGlobals *mSelf;
54 52
55 const KCalendarSystem *mCalendarSystem; 53 const KCalendarSystem *mCalendarSystem;
56 AlarmClient *mAlarmClient;
57}; 54};
58 55
59#endif 56#endif
diff --git a/korganizer/koincidenceeditor.cpp b/korganizer/koincidenceeditor.cpp
index 51df123..9813a80 100644
--- a/korganizer/koincidenceeditor.cpp
+++ b/korganizer/koincidenceeditor.cpp
@@ -21,49 +21,48 @@
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#include "koglobals.h"
46 45
47#include "koincidenceeditor.h" 46#include "koincidenceeditor.h"
48 47
49KOIncidenceEditor::KOIncidenceEditor( const QString &caption, 48KOIncidenceEditor::KOIncidenceEditor( const QString &caption,
50 Calendar *calendar, QWidget *parent ) : 49 Calendar *calendar, QWidget *parent ) :
51 KDialogBase( Tabbed, caption, Ok | Apply | Cancel |/* Default | */User1, Ok, 50 KDialogBase( Tabbed, caption, Ok | Apply | Cancel |/* Default | */User1, Ok,
52 parent, caption, true, false ), 51 parent, caption, true, false ),
53 mSaveTemplateDialog( 0 ) 52 mSaveTemplateDialog( 0 )
54{ 53{
55 mCalendar = calendar; 54 mCalendar = calendar;
56 55
57 setButtonText( Default, i18n("Template...") ); 56 setButtonText( Default, i18n("Template...") );
58 57
59 QString saveTemplateText; 58 QString saveTemplateText;
60 // if ( KOPrefs::instance()->mCompactDialogs ) { 59 // if ( KOPrefs::instance()->mCompactDialogs ) {
61// showButton( User1, false ); 60// showButton( User1, false );
62// showButton( Apply, false ); 61// showButton( Apply, false );
63// } else { 62// } else {
64 showButton( Apply, false ); 63 showButton( Apply, false );
65 saveTemplateText = i18n("Ok+Agenda"); 64 saveTemplateText = i18n("Ok+Agenda");
66 // } 65 // }
67 setButtonText( User1, saveTemplateText ); 66 setButtonText( User1, saveTemplateText );
68 67
69 //mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this ); 68 //mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this );
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 341f473..e1b393d 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -310,48 +310,49 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
310 mPopupMenu->insertItem(i18n("Show Dates"), this, 310 mPopupMenu->insertItem(i18n("Show Dates"), this,
311 SLOT(showDates())); 311 SLOT(showDates()));
312 mPopupMenu->insertItem(i18n("Hide Dates"), this, 312 mPopupMenu->insertItem(i18n("Hide Dates"), this,
313 SLOT(hideDates())); 313 SLOT(hideDates()));
314 */ 314 */
315 QObject::connect(mListView,SIGNAL( newEvent()), 315 QObject::connect(mListView,SIGNAL( newEvent()),
316 this,SIGNAL(signalNewEvent())); 316 this,SIGNAL(signalNewEvent()));
317 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 317 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
318 this,SLOT(defaultItemAction(QListViewItem *))); 318 this,SLOT(defaultItemAction(QListViewItem *)));
319 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, 319 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *,
320 const QPoint &, int )), 320 const QPoint &, int )),
321 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 321 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
322 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 322 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
323 SLOT(processSelectionChange(QListViewItem *))); 323 SLOT(processSelectionChange(QListViewItem *)));
324 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 324 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
325 SIGNAL(showIncidenceSignal(Incidence *)) ); 325 SIGNAL(showIncidenceSignal(Incidence *)) );
326 326
327 readSettings(KOGlobals::config(),"KOListView Layout"); 327 readSettings(KOGlobals::config(),"KOListView Layout");
328} 328}
329 329
330KOListView::~KOListView() 330KOListView::~KOListView()
331{ 331{
332 delete mPopupMenu; 332 delete mPopupMenu;
333} 333}
334
334QString KOListView::getWhatsThisText(QPoint p) 335QString KOListView::getWhatsThisText(QPoint p)
335{ 336{
336 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 337 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
337 if ( item ) 338 if ( item )
338 return KIncidenceFormatter::instance()->getFormattedText( item->data(), 339 return KIncidenceFormatter::instance()->getFormattedText( item->data(),
339 KOPrefs::instance()->mWTshowDetails, 340 KOPrefs::instance()->mWTshowDetails,
340 KOPrefs::instance()->mWTshowCreated, 341 KOPrefs::instance()->mWTshowCreated,
341 KOPrefs::instance()->mWTshowChanged); 342 KOPrefs::instance()->mWTshowChanged);
342 return i18n("That is the list view" ); 343 return i18n("That is the list view" );
343 344
344} 345}
345 346
346void KOListView::updateList() 347void KOListView::updateList()
347{ 348{
348 // qDebug(" KOListView::updateList() "); 349 // qDebug(" KOListView::updateList() ");
349 350
350} 351}
351 352
352void KOListView::addCat( ) 353void KOListView::addCat( )
353{ 354{
354 setCategories( false ); 355 setCategories( false );
355} 356}
356void KOListView::setCat() 357void KOListView::setCat()
357{ 358{
@@ -407,95 +408,97 @@ void KOListView::setAlarm()
407 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) 408 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
408 alarm->setAudioAlarm(kap.mAlarmSound); 409 alarm->setAudioAlarm(kap.mAlarmSound);
409 else 410 else
410 alarm->setType(Alarm::Invalid); 411 alarm->setType(Alarm::Invalid);
411 //alarm->setAudioAlarm("default"); 412 //alarm->setAudioAlarm("default");
412 // TODO: Deal with multiple alarms 413 // TODO: Deal with multiple alarms
413 break; // For now, stop after the first alarm 414 break; // For now, stop after the first alarm
414 } 415 }
415 } else { 416 } else {
416 Alarm* alarm = inc->alarms().first(); 417 Alarm* alarm = inc->alarms().first();
417 if ( alarm ) { 418 if ( alarm ) {
418 alarm->setEnabled(false); 419 alarm->setEnabled(false);
419 alarm->setType(Alarm::Invalid); 420 alarm->setType(Alarm::Invalid);
420 } 421 }
421 } 422 }
422 temp = item; 423 temp = item;
423 item = sel.next(); 424 item = sel.next();
424 mUidDict.remove( inc->uid() ); 425 mUidDict.remove( inc->uid() );
425 delete temp;; 426 delete temp;;
426 addIncidence( inc ); 427 addIncidence( inc );
427 } 428 }
428 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) ); 429 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) );
429 qDebug("KO: Set alarm for %d items", count); 430 qDebug("KO: Set alarm for %d items", count);
430 calendar()->reInitAlarmSettings(); 431 calendar()->reInitAlarmSettings();
432 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
431} 433}
432void KOListView::setCategories( bool removeOld ) 434void KOListView::setCategories( bool removeOld )
433{ 435{
434 436
435 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 437 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
436 if (! csd->exec()) { 438 if (! csd->exec()) {
437 delete csd; 439 delete csd;
438 return; 440 return;
439 } 441 }
440 QStringList catList = csd->selectedCategories(); 442 QStringList catList = csd->selectedCategories();
441 delete csd; 443 delete csd;
442 // if ( catList.count() == 0 ) 444 // if ( catList.count() == 0 )
443 // return; 445 // return;
444 catList.sort(); 446 catList.sort();
445 QString categoriesStr = catList.join(","); 447 QString categoriesStr = catList.join(",");
446 int i; 448 int i;
447 QStringList itemList; 449 QStringList itemList;
448 QPtrList<KOListViewItem> sel ; 450 QPtrList<KOListViewItem> sel ;
449 QListViewItem *qitem = mListView->firstChild (); 451 QListViewItem *qitem = mListView->firstChild ();
450 while ( qitem ) { 452 while ( qitem ) {
451 if ( qitem->isSelected() ) { 453 if ( qitem->isSelected() ) {
452 sel.append(((KOListViewItem *)qitem)); 454 sel.append(((KOListViewItem *)qitem));
453 } 455 }
454 qitem = qitem->nextSibling(); 456 qitem = qitem->nextSibling();
455 } 457 }
456 KOListViewItem * item, *temp; 458 KOListViewItem * item, *temp;
457 item = sel.first(); 459 item = sel.first();
458 Incidence* inc; 460 Incidence* inc;
459 while ( item ) { 461 while ( item ) {
460 inc = item->data(); 462 inc = item->data();
461 if ( removeOld ) { 463 if ( removeOld ) {
462 inc->setCategories( categoriesStr ); 464 inc->setCategories( categoriesStr );
463 } else { 465 } else {
464 itemList = QStringList::split (",", inc->categoriesStr() ); 466 itemList = QStringList::split (",", inc->categoriesStr() );
465 for( i = 0; i< catList.count(); ++i ) { 467 for( i = 0; i< catList.count(); ++i ) {
466 if ( !itemList.contains (catList[i])) 468 if ( !itemList.contains (catList[i]))
467 itemList.append( catList[i] ); 469 itemList.append( catList[i] );
468 } 470 }
469 itemList.sort(); 471 itemList.sort();
470 inc->setCategories( itemList.join(",") ); 472 inc->setCategories( itemList.join(",") );
471 } 473 }
472 temp = item; 474 temp = item;
473 item = sel.next(); 475 item = sel.next();
474 mUidDict.remove( inc->uid() ); 476 mUidDict.remove( inc->uid() );
475 delete temp;; 477 delete temp;;
476 addIncidence( inc ); 478 addIncidence( inc );
477 } 479 }
480 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
478} 481}
479 482
480void KOListView::beamSelected() 483void KOListView::beamSelected()
481{ 484{
482 int icount = 0; 485 int icount = 0;
483 QPtrList<Incidence> delSel ; 486 QPtrList<Incidence> delSel ;
484 QListViewItem *item = mListView->firstChild (); 487 QListViewItem *item = mListView->firstChild ();
485 while ( item ) { 488 while ( item ) {
486 if ( item->isSelected() ) { 489 if ( item->isSelected() ) {
487 delSel.append(((KOListViewItem *)item)->data()); 490 delSel.append(((KOListViewItem *)item)->data());
488 ++icount; 491 ++icount;
489 } 492 }
490 493
491 item = item->nextSibling(); 494 item = item->nextSibling();
492 } 495 }
493 if ( icount ) { 496 if ( icount ) {
494 emit beamIncidenceList( delSel ); 497 emit beamIncidenceList( delSel );
495 return; 498 return;
496 QString fn ; 499 QString fn ;
497 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; 500 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs";
498 QString mes; 501 QString mes;
499 bool createbup = true; 502 bool createbup = true;
500 if ( createbup ) { 503 if ( createbup ) {
501 QString description = "\n"; 504 QString description = "\n";
@@ -678,48 +681,49 @@ void KOListView::writeToFile( bool iCal )
678 createbup = false; 681 createbup = false;
679 } 682 }
680 } 683 }
681 if ( createbup ) { 684 if ( createbup ) {
682 CalendarLocal cal; 685 CalendarLocal cal;
683 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 686 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
684 Incidence *incidence = delSel.first(); 687 Incidence *incidence = delSel.first();
685 while ( incidence ) { 688 while ( incidence ) {
686 cal.addIncidence( incidence->clone() ); 689 cal.addIncidence( incidence->clone() );
687 incidence = delSel.next(); 690 incidence = delSel.next();
688 } 691 }
689 if ( iCal ) { 692 if ( iCal ) {
690 ICalFormat format; 693 ICalFormat format;
691 format.save( &cal, fn ); 694 format.save( &cal, fn );
692 } else { 695 } else {
693 696
694 VCalFormat format; 697 VCalFormat format;
695 format.save( &cal, fn ); 698 format.save( &cal, fn );
696 } 699 }
697 mes = i18n("KO/Pi:Saved %1").arg(fn ); 700 mes = i18n("KO/Pi:Saved %1").arg(fn );
698 KOPrefs::instance()->mLastSaveFile = fn; 701 KOPrefs::instance()->mLastSaveFile = fn;
699 topLevelWidget()->setCaption(mes); 702 topLevelWidget()->setCaption(mes);
700 } 703 }
701 } 704 }
705 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
702} 706}
703void KOListView::deleteAll() 707void KOListView::deleteAll()
704{ 708{
705 int icount = 0; 709 int icount = 0;
706 QPtrList<Incidence> delSel ; 710 QPtrList<Incidence> delSel ;
707 QListViewItem *item = mListView->firstChild (); 711 QListViewItem *item = mListView->firstChild ();
708 while ( item ) { 712 while ( item ) {
709 if ( item->isSelected() ) { 713 if ( item->isSelected() ) {
710 delSel.append(((KOListViewItem *)item)->data()); 714 delSel.append(((KOListViewItem *)item)->data());
711 ++icount; 715 ++icount;
712 } 716 }
713 717
714 item = item->nextSibling(); 718 item = item->nextSibling();
715 } 719 }
716 if ( icount ) { 720 if ( icount ) {
717 Incidence *incidence = delSel.first(); 721 Incidence *incidence = delSel.first();
718 Incidence *toDelete; 722 Incidence *toDelete;
719 KOPrefs *p = KOPrefs::instance(); 723 KOPrefs *p = KOPrefs::instance();
720 bool confirm = p->mConfirm; 724 bool confirm = p->mConfirm;
721 QString mess; 725 QString mess;
722 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); 726 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount );
723 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { 727 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) {
724 p->mConfirm = false; 728 p->mConfirm = false;
725 int delCounter = 0; 729 int delCounter = 0;
@@ -808,50 +812,53 @@ void KOListView::showDates(bool show)
808 } else { 812 } else {
809 mListView->setColumnWidth(1, oldColWidth1); 813 mListView->setColumnWidth(1, oldColWidth1);
810 mListView->setColumnWidth(3, oldColWidth3); 814 mListView->setColumnWidth(3, oldColWidth3);
811 } 815 }
812 mListView->repaint(); 816 mListView->repaint();
813} 817}
814 818
815void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, 819void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd,
816 const QDate &td) 820 const QDate &td)
817{ 821{
818#ifndef KORG_NOPRINTER 822#ifndef KORG_NOPRINTER
819 calPrinter->preview(CalPrinter::Day, fd, td); 823 calPrinter->preview(CalPrinter::Day, fd, td);
820#endif 824#endif
821} 825}
822 826
823void KOListView::showDates() 827void KOListView::showDates()
824{ 828{
825 showDates(true); 829 showDates(true);
826} 830}
827 831
828void KOListView::hideDates() 832void KOListView::hideDates()
829{ 833{
830 showDates(false); 834 showDates(false);
831} 835}
836
832void KOListView::resetFocus() 837void KOListView::resetFocus()
833{ 838{
839 topLevelWidget()->setActiveWindow();
840 topLevelWidget()->raise();
834 mListView->setFocus(); 841 mListView->setFocus();
835} 842}
836void KOListView::updateView() 843void KOListView::updateView()
837{ 844{
838 mListView->setFocus(); 845 mListView->setFocus();
839 if ( mListView->firstChild () ) 846 if ( mListView->firstChild () )
840 mListView->setCurrentItem( mListView->firstChild () ); 847 mListView->setCurrentItem( mListView->firstChild () );
841} 848}
842void KOListView::updateConfig() 849void KOListView::updateConfig()
843{ 850{
844 851
845 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 852 mListView->setFont ( KOPrefs::instance()->mListViewFont );
846 updateView(); 853 updateView();
847 854
848} 855}
849void KOListView::setStartDate(const QDate &start) 856void KOListView::setStartDate(const QDate &start)
850{ 857{
851 mStartDate = start; 858 mStartDate = start;
852} 859}
853 860
854void KOListView::showDates(const QDate &start, const QDate &end) 861void KOListView::showDates(const QDate &start, const QDate &end)
855{ 862{
856 clear(); 863 clear();
857 mStartDate = start; 864 mStartDate = start;
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index bb0e23e..eb5bb6e 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -238,54 +238,54 @@ class KOListView : public KOEventView
238 Q_OBJECT 238 Q_OBJECT
239 public: 239 public:
240 KOListView(Calendar *calendar, QWidget *parent = 0, 240 KOListView(Calendar *calendar, QWidget *parent = 0,
241 const char *name = 0); 241 const char *name = 0);
242 ~KOListView(); 242 ~KOListView();
243 243
244 virtual int maxDatesHint(); 244 virtual int maxDatesHint();
245 virtual int currentDateCount(); 245 virtual int currentDateCount();
246 virtual QPtrList<Incidence> selectedIncidences(); 246 virtual QPtrList<Incidence> selectedIncidences();
247 virtual DateList selectedDates(); 247 virtual DateList selectedDates();
248 248
249 void showDates(bool show); 249 void showDates(bool show);
250 Incidence* currentItem(); 250 Incidence* currentItem();
251 void addTodos(QPtrList<Todo> eventList); 251 void addTodos(QPtrList<Todo> eventList);
252 void addJournals(QPtrList<Journal> eventList); 252 void addJournals(QPtrList<Journal> eventList);
253 virtual void printPreview(CalPrinter *calPrinter, 253 virtual void printPreview(CalPrinter *calPrinter,
254 const QDate &, const QDate &); 254 const QDate &, const QDate &);
255 255
256 void readSettings(KConfig *config, QString setting = "KOListView Layout"); 256 void readSettings(KConfig *config, QString setting = "KOListView Layout");
257 void writeSettings(KConfig *config, QString setting = "KOListView Layout"); 257 void writeSettings(KConfig *config, QString setting = "KOListView Layout");
258 void updateList(); 258 void updateList();
259 void setStartDate(const QDate &start); 259 void setStartDate(const QDate &start);
260 int count(); 260 int count();
261 QString getWhatsThisText(QPoint p); 261 QString getWhatsThisText(QPoint p);
262 void resetFocus();
263 signals: 262 signals:
264 void signalNewEvent(); 263 void signalNewEvent();
265 void beamIncidenceList(QPtrList<Incidence>); 264 void beamIncidenceList(QPtrList<Incidence>);
266 265
267 public slots: 266 public slots:
267 void resetFocus();
268 virtual void updateView(); 268 virtual void updateView();
269 virtual void showDates(const QDate &start, const QDate &end); 269 virtual void showDates(const QDate &start, const QDate &end);
270 virtual void showEvents(QPtrList<Event> eventList); 270 virtual void showEvents(QPtrList<Event> eventList);
271 void clearSelection(); 271 void clearSelection();
272 void allSelection(); 272 void allSelection();
273 273
274 void clear(); 274 void clear();
275 void beamDone( Ir *ir ); 275 void beamDone( Ir *ir );
276 void showDates(); 276 void showDates();
277 void hideDates(); 277 void hideDates();
278 void deleteAll(); 278 void deleteAll();
279 void saveToFile(); 279 void saveToFile();
280 void saveToFileVCS(); 280 void saveToFileVCS();
281 void saveDescriptionToFile(); 281 void saveDescriptionToFile();
282 void beamSelected(); 282 void beamSelected();
283 void updateConfig(); 283 void updateConfig();
284 void addCat(); 284 void addCat();
285 void setCat(); 285 void setCat();
286 void setAlarm(); 286 void setAlarm();
287 void setCategories( bool removeOld ); 287 void setCategories( bool removeOld );
288 void changeEventDisplay(Event *, int); 288 void changeEventDisplay(Event *, int);
289 289
290 void defaultItemAction(QListViewItem *item); 290 void defaultItemAction(QListViewItem *item);
291 void popupMenu(QListViewItem *item,const QPoint &,int); 291 void popupMenu(QListViewItem *item,const QPoint &,int);
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 2b7e41f..843526d 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -266,71 +266,67 @@ void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
266 266
267void KNoScrollListBox::mousePressEvent(QMouseEvent *e) 267void KNoScrollListBox::mousePressEvent(QMouseEvent *e)
268{ 268{
269 QListBox::mousePressEvent(e); 269 QListBox::mousePressEvent(e);
270 270
271 if(e->button() == RightButton) { 271 if(e->button() == RightButton) {
272 emit rightClick(); 272 emit rightClick();
273 } 273 }
274} 274}
275 275
276MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) 276MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
277 : QListBoxItem() 277 : QListBoxItem()
278{ 278{
279 mblockRepaint = true; 279 mblockRepaint = true;
280 setText( s ); 280 setText( s );
281 mMultiday = 0; 281 mMultiday = 0;
282 mIncidence = incidence; 282 mIncidence = incidence;
283 mDate = qd; 283 mDate = qd;
284 mRecur = false; 284 mRecur = false;
285 mAlarm = false; 285 mAlarm = false;
286 mReply = false; 286 mReply = false;
287 mInfo = false; 287 mInfo = false;
288 mdayPos = 0; 288 mdayPos = 0;
289 isWeekItem = KOPrefs::instance()->mMonthViewWeek; 289 isWeekItem = KOPrefs::instance()->mMonthViewWeek;
290 //qDebug("NEWWWWWWWWWWWWW ");
291} 290}
292void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) 291void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s)
293{ 292{
294 setText( s ); 293 setText( s );
295 mMultiday = 0; 294 mMultiday = 0;
296 mIncidence = incidence; 295 mIncidence = incidence;
297 mDate = qd; 296 mDate = qd;
298 mRecur = false; 297 mRecur = false;
299 mAlarm = false; 298 mAlarm = false;
300 mReply = false; 299 mReply = false;
301 mInfo = false; 300 mInfo = false;
302 mdayPos = 0; 301 mdayPos = 0;
303 //qDebug("recucleeeeeeeeeeeeeeeee ");
304} 302}
305 303
306void MonthViewItem::paint(QPainter *p) 304void MonthViewItem::paint(QPainter *p)
307{ 305{
308 if ( mblockRepaint ) { 306 if ( mblockRepaint ) {
309 //qDebug("block ");
310 return; 307 return;
311 } 308 }
312 //qDebug("NON block ");
313#if QT_VERSION >= 0x030000 309#if QT_VERSION >= 0x030000
314 bool sel = isSelected(); 310 bool sel = isSelected();
315#else 311#else
316 bool sel = selected(); 312 bool sel = selected();
317#endif 313#endif
318 314
319 315
320 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) 316 if (KOPrefs::instance()->mMonthViewUsesCategoryColor)
321 { 317 {
322 p->setBackgroundColor( palette().color( QPalette::Normal, \ 318 p->setBackgroundColor( palette().color( QPalette::Normal, \
323 sel ? QColorGroup::Highlight : QColorGroup::Background ) ); 319 sel ? QColorGroup::Highlight : QColorGroup::Background ) );
324 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); 320 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) );
325 } 321 }
326 int x = 1; 322 int x = 1;
327 //int y = 3;//(height() - mRecurPixmap.height()) /2; 323 //int y = 3;//(height() - mRecurPixmap.height()) /2;
328 int size = PIXMAP_SIZE; 324 int size = PIXMAP_SIZE;
329 if ( QApplication::desktop()->width() < 300 ) 325 if ( QApplication::desktop()->width() < 300 )
330 size = 3; 326 size = 3;
331 int heihei = height( listBox () ); 327 int heihei = height( listBox () );
332 int y = (heihei - size -1 ) /2; 328 int y = (heihei - size -1 ) /2;
333 329
334 if ( KOPrefs::instance()->mMonthShowIcons ) { 330 if ( KOPrefs::instance()->mMonthShowIcons ) {
335 if ( mInfo ) { 331 if ( mInfo ) {
336 p->fillRect ( x, y,size,size, Qt::darkGreen ); 332 p->fillRect ( x, y,size,size, Qt::darkGreen );
@@ -439,49 +435,48 @@ int MonthViewItem::width(const QListBox *lb) const
439 if ( QApplication::desktop()->width() < 300 ) 435 if ( QApplication::desktop()->width() < 300 )
440 size = 3; 436 size = 3;
441 int x = 1; 437 int x = 1;
442 if ( KOPrefs::instance()->mMonthShowIcons ) { 438 if ( KOPrefs::instance()->mMonthShowIcons ) {
443 if ( mInfo ) { 439 if ( mInfo ) {
444 x += size + 1; 440 x += size + 1;
445 } 441 }
446 if( mRecur ) { 442 if( mRecur ) {
447 x += size+1; 443 x += size+1;
448 } 444 }
449 if( mAlarm ) { 445 if( mAlarm ) {
450 x += size+1; 446 x += size+1;
451 } 447 }
452 if( mReply ) { 448 if( mReply ) {
453 x += size+1; 449 x += size+1;
454 } 450 }
455 } 451 }
456 if( mMultiday ) { 452 if( mMultiday ) {
457 x += size+1+2+size/2; 453 x += size+1+2+size/2;
458 } 454 }
459 return( x + lb->fontMetrics().width( text() ) + 1 ); 455 return( x + lb->fontMetrics().width( text() ) + 1 );
460 } 456 }
461 if ( ! lb ) 457 if ( ! lb )
462 return 10; 458 return 10;
463 //qDebug("ret wid %d ", lb->width());
464 return lb->width(); 459 return lb->width();
465} 460}
466 461
467 462
468MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) 463MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
469 : KNoScrollListBox( par ), 464 : KNoScrollListBox( par ),
470 mMonthView( parent ) 465 mMonthView( parent )
471{ 466{
472 //QVBoxLayout *topLayout = new QVBoxLayout( this ); 467 //QVBoxLayout *topLayout = new QVBoxLayout( this );
473 currentPalette = 0; 468 currentPalette = 0;
474 // mLabel = new QLabel( this );QPushButton 469 // mLabel = new QLabel( this );QPushButton
475 mLabel = new QPushButton( this ); 470 mLabel = new QPushButton( this );
476 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); 471 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain );
477 //mLabel->setLineWidth( 1 ); 472 //mLabel->setLineWidth( 1 );
478 //mLabel->setAlignment( AlignCenter ); 473 //mLabel->setAlignment( AlignCenter );
479 mLabel->setFlat( true ); 474 mLabel->setFlat( true );
480 mLabel->setFocusPolicy(NoFocus); 475 mLabel->setFocusPolicy(NoFocus);
481 //mItemList = new KNoScrollListBox( this ); 476 //mItemList = new KNoScrollListBox( this );
482 setMinimumSize( 10, 10 ); 477 setMinimumSize( 10, 10 );
483 setFrameStyle( QFrame::Panel | QFrame::Plain ); 478 setFrameStyle( QFrame::Panel | QFrame::Plain );
484 setLineWidth( 1 ); 479 setLineWidth( 1 );
485 //topLayout->addWidget( mItemList ); 480 //topLayout->addWidget( mItemList );
486 mLabel->raise(); 481 mLabel->raise();
487 // QColor( 0,0,255 ) QColor( 160,1600,255 ) 482 // QColor( 0,0,255 ) QColor( 160,1600,255 )
@@ -591,54 +586,49 @@ void MonthViewCell::setHoliday( const QString &holiday )
591{ 586{
592 mHolidayString = holiday; 587 mHolidayString = holiday;
593 588
594 if ( !holiday.isEmpty() ) { 589 if ( !holiday.isEmpty() ) {
595 setHoliday( true ); 590 setHoliday( true );
596 } 591 }
597} 592}
598 593
599void MonthViewCell::startUpdateCell() 594void MonthViewCell::startUpdateCell()
600{ 595{
601 mdayCount = 0; 596 mdayCount = 0;
602 setFocusPolicy(NoFocus); 597 setFocusPolicy(NoFocus);
603 if ( !mMonthView->isUpdatePossible() ) 598 if ( !mMonthView->isUpdatePossible() )
604 return; 599 return;
605 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 600 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
606 while ( mitem ) { 601 while ( mitem ) {
607 mitem->setBlockRepaint( true ); 602 mitem->setBlockRepaint( true );
608 mitem = (MonthViewItem *)mitem->next(); 603 mitem = (MonthViewItem *)mitem->next();
609 } 604 }
610 if ( mAvailItemList.count() > 20 ) { 605 if ( mAvailItemList.count() > 20 ) {
611 mAvailItemList.setAutoDelete( true ); 606 mAvailItemList.setAutoDelete( true );
612 mAvailItemList.clear(); 607 mAvailItemList.clear();
613 mAvailItemList.setAutoDelete( false ); 608 mAvailItemList.setAutoDelete( false );
614 } 609 }
615 /* 610
616 if ( !isVisible() ){
617 return;
618 }
619 */
620 // qDebug("MonthViewCell::updateCell() ");
621 setPrimary( mDate.month()%2 ); 611 setPrimary( mDate.month()%2 );
622 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); 612 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays);
623 if ( mDate == QDate::currentDate() ) { 613 if ( mDate == QDate::currentDate() ) {
624 setLineWidth( 3 ); 614 setLineWidth( 3 );
625 } else { 615 } else {
626 setLineWidth( 1 ); 616 setLineWidth( 1 );
627 } 617 }
628 MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); 618 MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem ();
629 //clear(); 619 //clear();
630 while ( CurrentAvailItem ) { 620 while ( CurrentAvailItem ) {
631 MonthViewItem *item = CurrentAvailItem; 621 MonthViewItem *item = CurrentAvailItem;
632 CurrentAvailItem = (MonthViewItem *)item->next(); 622 CurrentAvailItem = (MonthViewItem *)item->next();
633 mAvailItemList.append( item ); 623 mAvailItemList.append( item );
634 takeItem ( item ); 624 takeItem ( item );
635 } 625 }
636 626
637#ifdef DESKTOP_VERSION 627#ifdef DESKTOP_VERSION
638 QToolTip::remove(this); 628 QToolTip::remove(this);
639#endif 629#endif
640 mToolTip.clear(); 630 mToolTip.clear();
641 //qApp->processEvents(); 631 //qApp->processEvents();
642#if 0 632#if 0
643 if ( !mHolidayString.isEmpty() ) { 633 if ( !mHolidayString.isEmpty() ) {
644 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); 634 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString );
@@ -850,49 +840,48 @@ void MonthViewCell::repaintfinishUpdateCell()
850 updateItem ( mitem ); 840 updateItem ( mitem );
851 mitem = (MonthViewItem *)mitem->next(); 841 mitem = (MonthViewItem *)mitem->next();
852 } 842 }
853} 843}
854void MonthViewCell::finishUpdateCell() 844void MonthViewCell::finishUpdateCell()
855{ 845{
856 846
857 847
858 848
859#ifdef DESKTOP_VERSION 849#ifdef DESKTOP_VERSION
860 if (mToolTip.count() > 0 ) { 850 if (mToolTip.count() > 0 ) {
861 mToolTip.sort(); 851 mToolTip.sort();
862 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); 852 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),"");
863 } 853 }
864#endif 854#endif
865 //sort(); 855 //sort();
866 //setMyPalette(); 856 //setMyPalette();
867 setMyPalette(); 857 setMyPalette();
868 858
869 resizeEvent( 0 ); 859 resizeEvent( 0 );
870 860
871} 861}
872void MonthViewCell::updateCell() 862void MonthViewCell::updateCell()
873{ 863{
874 //qDebug("MonthViewCell::updateCell() ");
875 if ( !mMonthView->isUpdatePossible() ) 864 if ( !mMonthView->isUpdatePossible() )
876 return; 865 return;
877 startUpdateCell(); 866 startUpdateCell();
878 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 867 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
879 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); 868 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
880 Event *event; 869 Event *event;
881 for( event = events.first(); event; event = events.next() ) { // for event 870 for( event = events.first(); event; event = events.next() ) { // for event
882 insertEvent(event); 871 insertEvent(event);
883 } 872 }
884 // insert due todos 873 // insert due todos
885 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); 874 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
886 Todo *todo; 875 Todo *todo;
887 for(todo = todos.first(); todo; todo = todos.next()) { 876 for(todo = todos.first(); todo; todo = todos.next()) {
888 insertTodo( todo ); 877 insertTodo( todo );
889 } 878 }
890 finishUpdateCell(); 879 finishUpdateCell();
891 // if ( isVisible()) 880 // if ( isVisible())
892 //qApp->processEvents(); 881 //qApp->processEvents();
893} 882}
894 883
895void MonthViewCell::updateConfig( bool bigFont ) // = false 884void MonthViewCell::updateConfig( bool bigFont ) // = false
896{ 885{
897 886
898 if ( bigFont ) { 887 if ( bigFont ) {
@@ -1032,49 +1021,48 @@ void MonthViewCell::defaultAction( QListBoxItem *item )
1032{ 1021{
1033 1022
1034 if ( !item ) { 1023 if ( !item ) {
1035 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1024 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1036 emit newEventSignal( dt ); 1025 emit newEventSignal( dt );
1037 return; 1026 return;
1038 } 1027 }
1039 1028
1040 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1029 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1041 Incidence *incidence = eventItem->incidence(); 1030 Incidence *incidence = eventItem->incidence();
1042 if ( incidence ) mMonthView->defaultAction( incidence ); 1031 if ( incidence ) mMonthView->defaultAction( incidence );
1043} 1032}
1044void MonthViewCell::showDay() 1033void MonthViewCell::showDay()
1045{ 1034{
1046 emit showDaySignal( date() ); 1035 emit showDaySignal( date() );
1047} 1036}
1048void MonthViewCell::newEvent() 1037void MonthViewCell::newEvent()
1049{ 1038{
1050 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1039 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1051 emit newEventSignal( dt ); 1040 emit newEventSignal( dt );
1052} 1041}
1053void MonthViewCell::cellClicked( QListBoxItem *item ) 1042void MonthViewCell::cellClicked( QListBoxItem *item )
1054{ 1043{
1055 mMonthView->setSelectedCell( this ); 1044 mMonthView->setSelectedCell( this );
1056 qDebug("CELL ");
1057 if ( item == 0 ) { 1045 if ( item == 0 ) {
1058 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1046 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1059 emit newEventSignal( dt ); 1047 emit newEventSignal( dt );
1060 return; 1048 return;
1061 } 1049 }
1062 1050
1063} 1051}
1064 1052
1065void MonthViewCell::contextMenu( QListBoxItem *item ) 1053void MonthViewCell::contextMenu( QListBoxItem *item )
1066{ 1054{
1067 mMonthView->setPopupCell( this ); 1055 mMonthView->setPopupCell( this );
1068 if ( !item ) { 1056 if ( !item ) {
1069 mMonthView->showContextMenu( 0 ); 1057 mMonthView->showContextMenu( 0 );
1070 return; 1058 return;
1071 } 1059 }
1072 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1060 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1073 Incidence *incidence = eventItem->incidence(); 1061 Incidence *incidence = eventItem->incidence();
1074 if ( incidence ) mMonthView->showContextMenu( incidence ); 1062 if ( incidence ) mMonthView->showContextMenu( incidence );
1075} 1063}
1076 1064
1077void MonthViewCell::selection( QListBoxItem *item ) 1065void MonthViewCell::selection( QListBoxItem *item )
1078{ 1066{
1079 if ( !item ) return; 1067 if ( !item ) return;
1080 1068
diff --git a/korganizer/korganizer.pro b/korganizer/korganizer.pro
index 1a81c7d..d88c300 100644
--- a/korganizer/korganizer.pro
+++ b/korganizer/korganizer.pro
@@ -114,49 +114,48 @@ HEADERS += datenavigatorcontainer.h \
114 koglobals.h \ 114 koglobals.h \
115 koincidenceeditor.h \ 115 koincidenceeditor.h \
116 kojournalview.h \ 116 kojournalview.h \
117 kolistview.h \ 117 kolistview.h \
118 kolocationbox.h \ 118 kolocationbox.h \
119 komonthview.h \ 119 komonthview.h \
120 koprefs.h \ 120 koprefs.h \
121 koprefsdialog.h \ 121 koprefsdialog.h \
122 kotimespanview.h \ 122 kotimespanview.h \
123 kotodoeditor.h \ 123 kotodoeditor.h \
124 kotodoview.h \ 124 kotodoview.h \
125 kotodoviewitem.h \ 125 kotodoviewitem.h \
126 koviewmanager.h \ 126 koviewmanager.h \
127 kowhatsnextview.h \ 127 kowhatsnextview.h \
128 ktimeedit.h \ 128 ktimeedit.h \
129 lineview.h \ 129 lineview.h \
130 mainwindow.h \ 130 mainwindow.h \
131 navigatorbar.h \ 131 navigatorbar.h \
132 outgoingdialog.h \ 132 outgoingdialog.h \
133 outgoingdialog_base.h \ 133 outgoingdialog_base.h \
134 publishdialog.h \ 134 publishdialog.h \
135 publishdialog_base.h \ 135 publishdialog_base.h \
136 savetemplatedialog.h \ 136 savetemplatedialog.h \
137 searchdialog.h \ 137 searchdialog.h \
138 simplealarmclient.h \
139 statusdialog.h \ 138 statusdialog.h \
140 timeline.h \ 139 timeline.h \
141 timespanview.h \ 140 timespanview.h \
142 version.h \ 141 version.h \
143 ../kalarmd/alarmdialog.h \ 142 ../kalarmd/alarmdialog.h \
144 143
145 144
146SOURCES += datenavigatorcontainer.cpp \ 145SOURCES += datenavigatorcontainer.cpp \
147filteredit_base.cpp \ 146filteredit_base.cpp \
148 calendarview.cpp \ 147 calendarview.cpp \
149 datenavigator.cpp \ 148 datenavigator.cpp \
150 docprefs.cpp \ 149 docprefs.cpp \
151 filtereditdialog.cpp \ 150 filtereditdialog.cpp \
152 incomingdialog.cpp \ 151 incomingdialog.cpp \
153 incomingdialog_base.cpp \ 152 incomingdialog_base.cpp \
154 journalentry.cpp \ 153 journalentry.cpp \
155 kdatenavigator.cpp \ 154 kdatenavigator.cpp \
156 koagenda.cpp \ 155 koagenda.cpp \
157 koagendaitem.cpp \ 156 koagendaitem.cpp \
158 koagendaview.cpp \ 157 koagendaview.cpp \
159 kocounterdialog.cpp \ 158 kocounterdialog.cpp \
160 kodaymatrix.cpp \ 159 kodaymatrix.cpp \
161 kodialogmanager.cpp \ 160 kodialogmanager.cpp \
162 koeditordetails.cpp \ 161 koeditordetails.cpp \
@@ -174,37 +173,36 @@ filteredit_base.cpp \
174 koincidenceeditor.cpp \ 173 koincidenceeditor.cpp \
175 kojournalview.cpp \ 174 kojournalview.cpp \
176 kolistview.cpp \ 175 kolistview.cpp \
177 kolocationbox.cpp \ 176 kolocationbox.cpp \
178 komonthview.cpp \ 177 komonthview.cpp \
179 koprefs.cpp \ 178 koprefs.cpp \
180 koprefsdialog.cpp \ 179 koprefsdialog.cpp \
181 kotimespanview.cpp \ 180 kotimespanview.cpp \
182 kotodoeditor.cpp \ 181 kotodoeditor.cpp \
183 kotodoview.cpp \ 182 kotodoview.cpp \
184 kotodoviewitem.cpp \ 183 kotodoviewitem.cpp \
185 koviewmanager.cpp \ 184 koviewmanager.cpp \
186 kowhatsnextview.cpp \ 185 kowhatsnextview.cpp \
187 ktimeedit.cpp \ 186 ktimeedit.cpp \
188 lineview.cpp \ 187 lineview.cpp \
189 main.cpp \ 188 main.cpp \
190 mainwindow.cpp \ 189 mainwindow.cpp \
191 navigatorbar.cpp \ 190 navigatorbar.cpp \
192 outgoingdialog.cpp \ 191 outgoingdialog.cpp \
193 outgoingdialog_base.cpp \ 192 outgoingdialog_base.cpp \
194 publishdialog.cpp \ 193 publishdialog.cpp \
195 publishdialog_base.cpp \ 194 publishdialog_base.cpp \
196 savetemplatedialog.cpp \ 195 savetemplatedialog.cpp \
197 searchdialog.cpp \ 196 searchdialog.cpp \
198 simplealarmclient.cpp \
199 statusdialog.cpp \ 197 statusdialog.cpp \
200 timeline.cpp \ 198 timeline.cpp \
201 timespanview.cpp \ 199 timespanview.cpp \
202 ../kalarmd/alarmdialog.cpp 200 ../kalarmd/alarmdialog.cpp
203 201
204HEADERS += calprintbase.h calprinter.h calprintplugins.h cellitem.h 202HEADERS += calprintbase.h calprinter.h calprintplugins.h cellitem.h
205INTERFACES += calprintdayconfig_base.ui \ 203INTERFACES += calprintdayconfig_base.ui \
206 calprintmonthconfig_base.ui \ 204 calprintmonthconfig_base.ui \
207 calprinttodoconfig_base.ui \ 205 calprinttodoconfig_base.ui \
208 calprintweekconfig_base.ui 206 calprintweekconfig_base.ui
209SOURCES += calprintbase.cpp calprinter.cpp calprintplugins.cpp cellitem.cpp 207SOURCES += calprintbase.cpp calprinter.cpp calprintplugins.cpp cellitem.cpp
210 208
diff --git a/korganizer/korganizerE.pro b/korganizer/korganizerE.pro
index 91b5a01..553c265 100644
--- a/korganizer/korganizerE.pro
+++ b/korganizer/korganizerE.pro
@@ -64,49 +64,48 @@ HEADERS = datenavigatorcontainer.h \
64 koglobals.h \ 64 koglobals.h \
65 koincidenceeditor.h \ 65 koincidenceeditor.h \
66 kojournalview.h \ 66 kojournalview.h \
67 kolistview.h \ 67 kolistview.h \
68 kolocationbox.h \ 68 kolocationbox.h \
69 komonthview.h \ 69 komonthview.h \
70 koprefs.h \ 70 koprefs.h \
71 koprefsdialog.h \ 71 koprefsdialog.h \
72 kotimespanview.h \ 72 kotimespanview.h \
73 kotodoeditor.h \ 73 kotodoeditor.h \
74 kotodoview.h \ 74 kotodoview.h \
75 kotodoviewitem.h \ 75 kotodoviewitem.h \
76 koviewmanager.h \ 76 koviewmanager.h \
77 kowhatsnextview.h \ 77 kowhatsnextview.h \
78 ktimeedit.h \ 78 ktimeedit.h \
79 lineview.h \ 79 lineview.h \
80 mainwindow.h \ 80 mainwindow.h \
81 navigatorbar.h \ 81 navigatorbar.h \
82 outgoingdialog.h \ 82 outgoingdialog.h \
83 outgoingdialog_base.h \ 83 outgoingdialog_base.h \
84 publishdialog.h \ 84 publishdialog.h \
85 publishdialog_base.h \ 85 publishdialog_base.h \
86 savetemplatedialog.h \ 86 savetemplatedialog.h \
87 searchdialog.h \ 87 searchdialog.h \
88 simplealarmclient.h \
89 statusdialog.h \ 88 statusdialog.h \
90 timeline.h \ 89 timeline.h \
91 timespanview.h \ 90 timespanview.h \
92 version.h \ 91 version.h \
93 ../kalarmd/alarmdialog.h 92 ../kalarmd/alarmdialog.h
94 93
95SOURCES = datenavigatorcontainer.cpp \ 94SOURCES = datenavigatorcontainer.cpp \
96 filteredit_base.cpp \ 95 filteredit_base.cpp \
97 calendarview.cpp \ 96 calendarview.cpp \
98 datenavigator.cpp \ 97 datenavigator.cpp \
99 docprefs.cpp \ 98 docprefs.cpp \
100 filtereditdialog.cpp \ 99 filtereditdialog.cpp \
101 incomingdialog.cpp \ 100 incomingdialog.cpp \
102 incomingdialog_base.cpp \ 101 incomingdialog_base.cpp \
103 journalentry.cpp \ 102 journalentry.cpp \
104 kdatenavigator.cpp \ 103 kdatenavigator.cpp \
105 koagenda.cpp \ 104 koagenda.cpp \
106 koagendaitem.cpp \ 105 koagendaitem.cpp \
107 koagendaview.cpp \ 106 koagendaview.cpp \
108 kocounterdialog.cpp \ 107 kocounterdialog.cpp \
109 kodaymatrix.cpp \ 108 kodaymatrix.cpp \
110 kodialogmanager.cpp \ 109 kodialogmanager.cpp \
111 koeditordetails.cpp \ 110 koeditordetails.cpp \
112 koeditorgeneral.cpp \ 111 koeditorgeneral.cpp \
@@ -123,30 +122,29 @@ SOURCES = datenavigatorcontainer.cpp \
123 koincidenceeditor.cpp \ 122 koincidenceeditor.cpp \
124 kojournalview.cpp \ 123 kojournalview.cpp \
125 kolistview.cpp \ 124 kolistview.cpp \
126 kolocationbox.cpp \ 125 kolocationbox.cpp \
127 komonthview.cpp \ 126 komonthview.cpp \
128 koprefs.cpp \ 127 koprefs.cpp \
129 koprefsdialog.cpp \ 128 koprefsdialog.cpp \
130 kotimespanview.cpp \ 129 kotimespanview.cpp \
131 kotodoeditor.cpp \ 130 kotodoeditor.cpp \
132 kotodoview.cpp \ 131 kotodoview.cpp \
133 kotodoviewitem.cpp \ 132 kotodoviewitem.cpp \
134 koviewmanager.cpp \ 133 koviewmanager.cpp \
135 kowhatsnextview.cpp \ 134 kowhatsnextview.cpp \
136 ktimeedit.cpp \ 135 ktimeedit.cpp \
137 lineview.cpp \ 136 lineview.cpp \
138 main.cpp \ 137 main.cpp \
139 mainwindow.cpp \ 138 mainwindow.cpp \
140 navigatorbar.cpp \ 139 navigatorbar.cpp \
141 outgoingdialog.cpp \ 140 outgoingdialog.cpp \
142 outgoingdialog_base.cpp \ 141 outgoingdialog_base.cpp \
143 publishdialog.cpp \ 142 publishdialog.cpp \
144 publishdialog_base.cpp \ 143 publishdialog_base.cpp \
145 savetemplatedialog.cpp \ 144 savetemplatedialog.cpp \
146 searchdialog.cpp \ 145 searchdialog.cpp \
147 simplealarmclient.cpp \
148 statusdialog.cpp \ 146 statusdialog.cpp \
149 timeline.cpp \ 147 timeline.cpp \
150 timespanview.cpp \ 148 timespanview.cpp \
151 ../kalarmd/alarmdialog.cpp 149 ../kalarmd/alarmdialog.cpp
152 150
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index dd2c081..0a608dc 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -687,61 +687,55 @@ void KOTodoView::updateView()
687 while ( todo ) { 687 while ( todo ) {
688 bool next = true; 688 bool next = true;
689 // qDebug("todo %s ", todo->summary().latin1()); 689 // qDebug("todo %s ", todo->summary().latin1());
690 Incidence *incidence = todo->relatedTo(); 690 Incidence *incidence = todo->relatedTo();
691 while ( incidence ) { 691 while ( incidence ) {
692 if ( incidence->type() == "Todo") { 692 if ( incidence->type() == "Todo") {
693 //qDebug("related %s ",incidence->summary().latin1() ); 693 //qDebug("related %s ",incidence->summary().latin1() );
694 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { 694 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) {
695 //qDebug("related not found "); 695 //qDebug("related not found ");
696 todoList.remove( ); 696 todoList.remove( );
697 todo = todoList.current(); 697 todo = todoList.current();
698 next = false; 698 next = false;
699 incidence = 0; 699 incidence = 0;
700 700
701 } else { 701 } else {
702 //qDebug("related found "); 702 //qDebug("related found ");
703 incidence = incidence->relatedTo(); 703 incidence = incidence->relatedTo();
704 } 704 }
705 } else 705 } else
706 incidence = 0; 706 incidence = 0;
707 } 707 }
708 if ( next ) 708 if ( next )
709 todo = todoList.next(); 709 todo = todoList.next();
710 } 710 }
711// qDebug("again .... "); 711
712// for(todo = todoList.first(); todo; todo = todoList.next()) {
713
714// qDebug("yytodo %s ", todo->summary().latin1());
715// }
716 //qDebug("for ");
717 for(todo = todoList.first(); todo; todo = todoList.next()) { 712 for(todo = todoList.first(); todo; todo = todoList.next()) {
718 if (!mTodoMap.contains(todo) && checkTodo( todo ) ) 713 if (!mTodoMap.contains(todo) && checkTodo( todo ) )
719 { 714 {
720 insertTodoItem(todo); 715 insertTodoItem(todo);
721 } 716 }
722 } 717 }
723 //qDebug("for end ");
724 // Restore opened/closed state 718 // Restore opened/closed state
725 mTodoListView->blockSignals( true ); 719 mTodoListView->blockSignals( true );
726 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); 720 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
727 mTodoListView->blockSignals( false ); 721 mTodoListView->blockSignals( false );
728 resetCurrentItem(); 722 resetCurrentItem();
729 processSelectionChange(); 723 processSelectionChange();
730} 724}
731 725
732void KOTodoView::storeCurrentItem() 726void KOTodoView::storeCurrentItem()
733{ 727{
734 mCurItem = 0; 728 mCurItem = 0;
735 mCurItemRootParent = 0; 729 mCurItemRootParent = 0;
736 mCurItemParent = 0; 730 mCurItemParent = 0;
737 mCurItemAbove = 0; 731 mCurItemAbove = 0;
738 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 732 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
739 if (mActiveItem) { 733 if (mActiveItem) {
740 mCurItem = mActiveItem->todo(); 734 mCurItem = mActiveItem->todo();
741 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); 735 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove ();
742 if ( activeItemAbove ) 736 if ( activeItemAbove )
743 mCurItemAbove = activeItemAbove->todo(); 737 mCurItemAbove = activeItemAbove->todo();
744 mCurItemRootParent = mCurItem; 738 mCurItemRootParent = mCurItem;
745 mCurItemParent = mCurItemRootParent->relatedTo(); 739 mCurItemParent = mCurItemRootParent->relatedTo();
746 while ( mCurItemRootParent->relatedTo() != 0 ) 740 while ( mCurItemRootParent->relatedTo() != 0 )
747 mCurItemRootParent = mCurItemRootParent->relatedTo(); 741 mCurItemRootParent = mCurItemRootParent->relatedTo();
@@ -891,49 +885,48 @@ QPtrList<Todo> KOTodoView::selectedTodos()
891void KOTodoView::changeEventDisplay(Event *, int) 885void KOTodoView::changeEventDisplay(Event *, int)
892{ 886{
893 updateView(); 887 updateView();
894} 888}
895 889
896void KOTodoView::showDates(const QDate &, const QDate &) 890void KOTodoView::showDates(const QDate &, const QDate &)
897{ 891{
898} 892}
899 893
900void KOTodoView::showEvents(QPtrList<Event>) 894void KOTodoView::showEvents(QPtrList<Event>)
901{ 895{
902 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; 896 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl;
903} 897}
904 898
905void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, 899void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd,
906 const QDate &td) 900 const QDate &td)
907{ 901{
908#ifndef KORG_NOPRINTER 902#ifndef KORG_NOPRINTER
909 calPrinter->preview(CalPrinter::Todolist, fd, td); 903 calPrinter->preview(CalPrinter::Todolist, fd, td);
910#endif 904#endif
911} 905}
912 906
913void KOTodoView::editItem(QListViewItem *item ) 907void KOTodoView::editItem(QListViewItem *item )
914{ 908{
915 // qDebug("editItem(QListViewItem *item ) ");
916 emit editTodoSignal(((KOTodoViewItem *)item)->todo()); 909 emit editTodoSignal(((KOTodoViewItem *)item)->todo());
917} 910}
918 911
919void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) 912void KOTodoView::showItem(QListViewItem *item,const QPoint &,int)
920{ 913{
921 emit showTodoSignal(((KOTodoViewItem *)item)->todo()); 914 emit showTodoSignal(((KOTodoViewItem *)item)->todo());
922} 915}
923 916
924void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) 917void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column)
925{ 918{
926 pendingSubtodo = 0; 919 pendingSubtodo = 0;
927 mActiveItem = (KOTodoViewItem *)item; 920 mActiveItem = (KOTodoViewItem *)item;
928 if (item) { 921 if (item) {
929 switch (column){ 922 switch (column){
930 case 1: 923 case 1:
931 mPriorityPopupMenu->popup(QCursor::pos ()); break; 924 mPriorityPopupMenu->popup(QCursor::pos ()); break;
932 case 2: 925 case 2:
933 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; 926 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break;
934 case 3: 927 case 3:
935 moveTodo(); 928 moveTodo();
936 break; 929 break;
937 case 8: 930 case 8:
938 getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; 931 getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break;
939 default: 932 default:
@@ -1075,49 +1068,49 @@ void KOTodoView::changedCategories(int index)
1075 categories.remove (mCategory[index]); 1068 categories.remove (mCategory[index]);
1076 else 1069 else
1077 categories.insert (categories.end(), mCategory[index]); 1070 categories.insert (categories.end(), mCategory[index]);
1078 categories.sort (); 1071 categories.sort ();
1079 if ( !colcat.isEmpty() ) { 1072 if ( !colcat.isEmpty() ) {
1080 if ( categories.find ( colcat ) != categories.end () ) { 1073 if ( categories.find ( colcat ) != categories.end () ) {
1081 categories.remove( colcat ); 1074 categories.remove( colcat );
1082 categories.prepend( colcat ); 1075 categories.prepend( colcat );
1083 } 1076 }
1084 } 1077 }
1085 mActiveItem->todo()->setCategories (categories); 1078 mActiveItem->todo()->setCategories (categories);
1086 mActiveItem->construct(); 1079 mActiveItem->construct();
1087 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1080 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1088 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 1081 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
1089 } 1082 }
1090} 1083}
1091void KOTodoView::itemDoubleClicked(QListViewItem *item) 1084void KOTodoView::itemDoubleClicked(QListViewItem *item)
1092{ 1085{
1093 if ( pendingSubtodo != 0 ) { 1086 if ( pendingSubtodo != 0 ) {
1094 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1087 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1095 } 1088 }
1096 pendingSubtodo = 0; 1089 pendingSubtodo = 0;
1097 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); 1090 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
1098 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); 1091 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() );
1099 qDebug("ROW %d ", row); 1092 //qDebug("ROW %d ", row);
1100 if (!item) { 1093 if (!item) {
1101 newTodo(); 1094 newTodo();
1102 return; 1095 return;
1103 } else { 1096 } else {
1104 if ( row == 2 || row == 1 ) { 1097 if ( row == 2 || row == 1 ) {
1105 mActiveItem = (KOTodoViewItem *) item; 1098 mActiveItem = (KOTodoViewItem *) item;
1106 newSubTodo(); 1099 newSubTodo();
1107 return; 1100 return;
1108 } 1101 }
1109 if ( row == 5 || row == 6 ) { 1102 if ( row == 5 || row == 6 ) {
1110 mActiveItem = (KOTodoViewItem *) item; 1103 mActiveItem = (KOTodoViewItem *) item;
1111 toggleRunningItem(); 1104 toggleRunningItem();
1112 return; 1105 return;
1113 } 1106 }
1114 } 1107 }
1115 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1108 if ( KOPrefs::instance()->mEditOnDoubleClick )
1116 editItem( item ); 1109 editItem( item );
1117 else 1110 else
1118 showItem( item , QPoint(), 0 ); 1111 showItem( item , QPoint(), 0 );
1119} 1112}
1120void KOTodoView::toggleRunningItem() 1113void KOTodoView::toggleRunningItem()
1121{ 1114{
1122 // qDebug("KOTodoView::toggleRunning() "); 1115 // qDebug("KOTodoView::toggleRunning() ");
1123 if ( ! mActiveItem ) 1116 if ( ! mActiveItem )
@@ -1149,67 +1142,49 @@ void KOTodoView::itemClicked(QListViewItem *item)
1149 return; 1142 return;
1150 } 1143 }
1151 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1144 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1152 if ( pendingSubtodo != 0 ) { 1145 if ( pendingSubtodo != 0 ) {
1153 bool allowReparent = true; 1146 bool allowReparent = true;
1154 QListViewItem *par = item; 1147 QListViewItem *par = item;
1155 while ( par ) { 1148 while ( par ) {
1156 if ( par == pendingSubtodo ) { 1149 if ( par == pendingSubtodo ) {
1157 allowReparent = false; 1150 allowReparent = false;
1158 break; 1151 break;
1159 } 1152 }
1160 par = par->parent(); 1153 par = par->parent();
1161 } 1154 }
1162 if ( !allowReparent ) { 1155 if ( !allowReparent ) {
1163 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 1156 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
1164 pendingSubtodo = 0; 1157 pendingSubtodo = 0;
1165 } else { 1158 } else {
1166 Todo* newParent = todoItem->todo(); 1159 Todo* newParent = todoItem->todo();
1167 Todo* newSub = pendingSubtodo->todo(); 1160 Todo* newSub = pendingSubtodo->todo();
1168 pendingSubtodo = 0; 1161 pendingSubtodo = 0;
1169 emit reparentTodoSignal( newParent,newSub ); 1162 emit reparentTodoSignal( newParent,newSub );
1170 return; 1163 return;
1171 } 1164 }
1172 } 1165 }
1173#if 0 1166
1174 // handled by the item itself
1175 bool completed = todoItem->todo()->isCompleted(); // Completed or not?
1176 qDebug("com %d ",completed );
1177 qDebug("itemclicked ");
1178 if (todoItem->isOn()) {
1179 qDebug("on ");
1180 if (!completed) {
1181 qDebug("set true ");
1182 todoItem->todo()->setCompleted(QDateTime::currentDateTime());
1183 }
1184 } else {
1185 qDebug("not on ");
1186 if (completed) {
1187 qDebug("set false ");
1188 todoItem->todo()->setCompleted(false);
1189 }
1190 }
1191#endif
1192} 1167}
1193 1168
1194void KOTodoView::setDocumentId( const QString &id ) 1169void KOTodoView::setDocumentId( const QString &id )
1195{ 1170{
1196 1171
1197 mDocPrefs->setDoc( id ); 1172 mDocPrefs->setDoc( id );
1198} 1173}
1199 1174
1200void KOTodoView::itemStateChanged( QListViewItem *item ) 1175void KOTodoView::itemStateChanged( QListViewItem *item )
1201{ 1176{
1202 if (!item) return; 1177 if (!item) return;
1203 1178
1204 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1179 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1205 1180
1206// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 1181// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
1207 1182
1208 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 1183 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
1209} 1184}
1210 1185
1211void KOTodoView::saveLayout(KConfig *config, const QString &group) const 1186void KOTodoView::saveLayout(KConfig *config, const QString &group) const
1212{ 1187{
1213 mTodoListView->saveLayout(config,group); 1188 mTodoListView->saveLayout(config,group);
1214} 1189}
1215 1190
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index f1f2dd2..3aa9b6c 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -529,57 +529,49 @@ void KOViewManager::showDayView()
529 mMainView->dateNavigator()->selectDates( 1 ); 529 mMainView->dateNavigator()->selectDates( 1 );
530 mCurrentAgendaView = 1 ; 530 mCurrentAgendaView = 1 ;
531 531
532} 532}
533 533
534void KOViewManager::showWorkWeekView() 534void KOViewManager::showWorkWeekView()
535{ 535{
536 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 536 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
537 mFlagShowNextxDays = false; 537 mFlagShowNextxDays = false;
538 globalFlagBlockAgenda = 1; 538 globalFlagBlockAgenda = 1;
539 globalFlagBlockLabel = 1; 539 globalFlagBlockLabel = 1;
540 if ( mCurrentAgendaView != 5 ) 540 if ( mCurrentAgendaView != 5 )
541 mCurrentAgendaView = -1; 541 mCurrentAgendaView = -1;
542 showAgendaView(); 542 showAgendaView();
543 qApp->processEvents(); 543 qApp->processEvents();
544 globalFlagBlockAgenda = 2; 544 globalFlagBlockAgenda = 2;
545 globalFlagBlockLabel = 0; 545 globalFlagBlockLabel = 0;
546 mMainView->dateNavigator()->selectWorkWeek(); 546 mMainView->dateNavigator()->selectWorkWeek();
547 mCurrentAgendaView = 5 ; 547 mCurrentAgendaView = 5 ;
548 548
549} 549}
550 550
551void KOViewManager::showWeekView() 551void KOViewManager::showWeekView()
552{ 552{
553 /* 553
554 globalFlagBlockAgenda = 2;
555 qDebug("4globalFlagBlockAgenda = 2; ");
556 //globalFlagBlockPainting = true;
557 mMainView->dateNavigator()->selectWeek();
558 showAgendaView();
559 */
560
561
562 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 554 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
563 mFlagShowNextxDays = false; 555 mFlagShowNextxDays = false;
564 globalFlagBlockAgenda = 1; 556 globalFlagBlockAgenda = 1;
565 globalFlagBlockLabel = 1; 557 globalFlagBlockLabel = 1;
566 if ( mCurrentAgendaView != 7 ) 558 if ( mCurrentAgendaView != 7 )
567 mCurrentAgendaView = -1; 559 mCurrentAgendaView = -1;
568 showAgendaView(); 560 showAgendaView();
569 qApp->processEvents(); 561 qApp->processEvents();
570 globalFlagBlockAgenda = 2; 562 globalFlagBlockAgenda = 2;
571 globalFlagBlockLabel = 0; 563 globalFlagBlockLabel = 0;
572 mMainView->dateNavigator()->selectWeek(); 564 mMainView->dateNavigator()->selectWeek();
573 mCurrentAgendaView = 7 ; 565 mCurrentAgendaView = 7 ;
574} 566}
575 567
576void KOViewManager::showNextXView() 568void KOViewManager::showNextXView()
577{ 569{
578 570
579 globalFlagBlockAgenda = 1; 571 globalFlagBlockAgenda = 1;
580 if ( mCurrentAgendaView != 3 ) 572 if ( mCurrentAgendaView != 3 )
581 mCurrentAgendaView = -1; 573 mCurrentAgendaView = -1;
582 showAgendaView(KOPrefs::instance()->mFullViewMonth); 574 showAgendaView(KOPrefs::instance()->mFullViewMonth);
583 globalFlagBlockAgenda = 2; 575 globalFlagBlockAgenda = 2;
584 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 576 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
585 KOPrefs::instance()->mNextXDays ); 577 KOPrefs::instance()->mNextXDays );
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 8473db9..65d8ac3 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -63,51 +63,49 @@ void WhatsNextTextBrowser::printMe()
63{ 63{
64#ifdef DESKTOP_VERSION 64#ifdef DESKTOP_VERSION
65 KOPrintPrefs pp ( this ); 65 KOPrintPrefs pp ( this );
66 if (!pp.exec() ) 66 if (!pp.exec() )
67 return; 67 return;
68 int scaleval = pp.printMode() ; 68 int scaleval = pp.printMode() ;
69 69
70 QPrinter printer; 70 QPrinter printer;
71 if (!printer.setup() ) 71 if (!printer.setup() )
72 return; 72 return;
73 QPainter p; 73 QPainter p;
74 p.begin ( &printer ); 74 p.begin ( &printer );
75 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); 75 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
76 float dx, dy; 76 float dx, dy;
77 int wid = (m.width() * 9)/10; 77 int wid = (m.width() * 9)/10;
78 dx = (float) wid/(float)contentsWidth (); 78 dx = (float) wid/(float)contentsWidth ();
79 dy = (float)(m.height()) / (float)contentsHeight (); 79 dy = (float)(m.height()) / (float)contentsHeight ();
80 float scale; 80 float scale;
81 // scale to fit the width or height of the paper 81 // scale to fit the width or height of the paper
82 if ( dx < dy ) 82 if ( dx < dy )
83 scale = dx; 83 scale = dx;
84 else 84 else
85 scale = dy; 85 scale = dy;
86 p.translate( m.width()/10,0 ); 86 p.translate( m.width()/10,0 );
87 qDebug("Scale: %f ", scale );
88 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { 87 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) {
89 qDebug("SCALE ");
90 p.scale( scale, scale ); 88 p.scale( scale, scale );
91 } 89 }
92 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); 90 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
93 p.end(); 91 p.end();
94#endif 92#endif
95} 93}
96 94
97KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, 95KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
98 const char *name) 96 const char *name)
99 : KOrg::BaseView(calendar, parent, name) 97 : KOrg::BaseView(calendar, parent, name)
100{ 98{
101 // mDateLabel = 99 // mDateLabel =
102 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); 100 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this);
103 // mDateLabel->setMargin(2); 101 // mDateLabel->setMargin(2);
104 // mDateLabel->setAlignment(AlignCenter); 102 // mDateLabel->setAlignment(AlignCenter);
105 setFont( KOPrefs::instance()->mWhatsNextFont ); 103 setFont( KOPrefs::instance()->mWhatsNextFont );
106 mView = new WhatsNextTextBrowser(this); 104 mView = new WhatsNextTextBrowser(this);
107 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); 105 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &)));
108 QStyleSheet* stsh = mView->styleSheet(); 106 QStyleSheet* stsh = mView->styleSheet();
109 QStyleSheetItem * style ; 107 QStyleSheetItem * style ;
110 style = stsh->item ("h2" ); 108 style = stsh->item ("h2" );
111 if ( style ) { 109 if ( style ) {
112 style->setMargin(QStyleSheetItem::MarginAll,0); 110 style->setMargin(QStyleSheetItem::MarginAll,0);
113 } 111 }
diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp
index 61a0931..df9b2fc 100644
--- a/korganizer/ktimeedit.cpp
+++ b/korganizer/ktimeedit.cpp
@@ -316,60 +316,58 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
316 if ( cpos > 0) { 316 if ( cpos > 0) {
317 lineEdit()->setCursorPosition(--cpos); 317 lineEdit()->setCursorPosition(--cpos);
318 setSelect ( cpos , 1 ); 318 setSelect ( cpos , 1 );
319 } 319 }
320 else 320 else
321 setSelect ( 0 , 1 ); 321 setSelect ( 0 , 1 );
322 break; 322 break;
323 // set cursor to correct place 323 // set cursor to correct place
324 case Key_Right: 324 case Key_Right:
325 if ( cpos == 1 ) 325 if ( cpos == 1 )
326 ++cpos; 326 ++cpos;
327 if ( cpos < maxpos ) { 327 if ( cpos < maxpos ) {
328 lineEdit()->setCursorPosition(++cpos); 328 lineEdit()->setCursorPosition(++cpos);
329 setSelect ( cpos , 1 ); 329 setSelect ( cpos , 1 );
330 } 330 }
331 break; 331 break;
332 // rest 332 // rest
333 case Key_Prior: 333 case Key_Prior:
334 subTime(QTime(1,0,0)); 334 subTime(QTime(1,0,0));
335 break; 335 break;
336 case Key_Next: 336 case Key_Next:
337 addTime(QTime(1,0,0)); 337 addTime(QTime(1,0,0));
338 break; 338 break;
339 case Key_Backspace: 339 case Key_Backspace:
340 qDebug("+++++++++++back ");
341 if ( cpos > 0) { 340 if ( cpos > 0) {
342 if ( cpos == 3 ) 341 if ( cpos == 3 )
343 --cpos; 342 --cpos;
344 if ( cpos > 5) 343 if ( cpos > 5)
345 cpos = 5; 344 cpos = 5;
346 text.at( cpos-1 ) = '0'; 345 text.at( cpos-1 ) = '0';
347 lineEdit()->setText( text ); 346 lineEdit()->setText( text );
348 lineEdit()->setCursorPosition(--cpos); 347 lineEdit()->setCursorPosition(--cpos);
349 setSelect ( cpos , 1 ); 348 setSelect ( cpos , 1 );
350 changedText(); 349 changedText();
351 qDebug("---------back ");
352 } 350 }
353 break; 351 break;
354 } // switch arrows 352 } // switch arrows
355 353
356 // if cursor at string end, alltext market and keyEvent don't ArrowLeft -> deselect and cpos 354 // if cursor at string end, alltext market and keyEvent don't ArrowLeft -> deselect and cpos
357 if( cpos > 4 && lineEdit()->markedText().length() == 5 && e->key() != Key_Left ) { 355 if( cpos > 4 && lineEdit()->markedText().length() == 5 && e->key() != Key_Left ) {
358 lineEdit()->deselect(); 356 lineEdit()->deselect();
359 cpos = 0; 357 cpos = 0;
360 lineEdit()->setCursorPosition(cpos); 358 lineEdit()->setCursorPosition(cpos);
361 setSelect(cpos , 1); 359 setSelect(cpos , 1);
362 } 360 }
363 361
364 if ( cpos == 2 ) { 362 if ( cpos == 2 ) {
365 lineEdit()->setCursorPosition(++cpos); 363 lineEdit()->setCursorPosition(++cpos);
366 } 364 }
367 365
368 // num keys when cursorPos preEnd 366 // num keys when cursorPos preEnd
369 if ( cpos < 5 ) { 367 if ( cpos < 5 ) {
370 // switch another keys 368 // switch another keys
371 switch(e->key()) { 369 switch(e->key()) {
372 case Key_Delete: 370 case Key_Delete:
373 text.at( cpos ) = '0'; 371 text.at( cpos ) = '0';
374 lineEdit()->setText( text ); 372 lineEdit()->setText( text );
375 lineEdit()->setCursorPosition(cpos); 373 lineEdit()->setCursorPosition(cpos);
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 8e5d108..95bef66 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -39,49 +39,48 @@
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40#include <libkcal/phoneformat.h> 40#include <libkcal/phoneformat.h>
41#include <libkdepim/ksyncprofile.h> 41#include <libkdepim/ksyncprofile.h>
42#include <libkdepim/phoneaccess.h> 42#include <libkdepim/phoneaccess.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "calendarview.h" 46#include "calendarview.h"
47#include "koviewmanager.h" 47#include "koviewmanager.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49#include "koagendaview.h" 49#include "koagendaview.h"
50#include "koagenda.h" 50#include "koagenda.h"
51#include "kodialogmanager.h" 51#include "kodialogmanager.h"
52#include "kdialogbase.h" 52#include "kdialogbase.h"
53#include "kapplication.h" 53#include "kapplication.h"
54#include "kofilterview.h" 54#include "kofilterview.h"
55#include "kstandarddirs.h" 55#include "kstandarddirs.h"
56#include "koprefs.h" 56#include "koprefs.h"
57#include "kfiledialog.h" 57#include "kfiledialog.h"
58#include "koglobals.h" 58#include "koglobals.h"
59#include "kglobal.h" 59#include "kglobal.h"
60#include "ktoolbar.h" 60#include "ktoolbar.h"
61#include "klocale.h" 61#include "klocale.h"
62#include "kconfig.h" 62#include "kconfig.h"
63#include "simplealarmclient.h"
64#include "externalapphandler.h" 63#include "externalapphandler.h"
65 64
66using namespace KCal; 65using namespace KCal;
67#ifndef _WIN32_ 66#ifndef _WIN32_
68#include <unistd.h> 67#include <unistd.h>
69#else 68#else
70#ifdef _OL_IMPORT_ 69#ifdef _OL_IMPORT_
71#include "koimportoldialog.h" 70#include "koimportoldialog.h"
72#endif 71#endif
73#endif 72#endif
74#include "mainwindow.h" 73#include "mainwindow.h"
75 74
76 75
77class KOex2phonePrefs : public QDialog 76class KOex2phonePrefs : public QDialog
78{ 77{
79 public: 78 public:
80 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
81 QDialog( parent, name, true ) 80 QDialog( parent, name, true )
82 { 81 {
83 setCaption( i18n("Export to phone options") ); 82 setCaption( i18n("Export to phone options") );
84 QVBoxLayout* lay = new QVBoxLayout( this ); 83 QVBoxLayout* lay = new QVBoxLayout( this );
85 lay->setSpacing( 3 ); 84 lay->setSpacing( 3 );
86 lay->setMargin( 3 ); 85 lay->setMargin( 3 );
87 QLabel *lab; 86 QLabel *lab;
@@ -264,49 +263,48 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
264 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 263 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
265 mSyncManager->setBlockSave(false); 264 mSyncManager->setBlockSave(false);
266 mView->setSyncManager(mSyncManager); 265 mView->setSyncManager(mSyncManager);
267#ifndef DESKTOP_VERSION 266#ifndef DESKTOP_VERSION
268 iconToolBar->show(); 267 iconToolBar->show();
269 qApp->processEvents(); 268 qApp->processEvents();
270#endif 269#endif
271 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 270 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
272 int vh = height() ; 271 int vh = height() ;
273 int vw = width(); 272 int vw = width();
274 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 273 //qDebug("Toolbar hei %d ",iconToolBar->height() );
275 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 274 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
276 vh -= iconToolBar->height(); 275 vh -= iconToolBar->height();
277 } else { 276 } else {
278 vw -= iconToolBar->height(); 277 vw -= iconToolBar->height();
279 } 278 }
280 //mView->setMaximumSize( splash->size() ); 279 //mView->setMaximumSize( splash->size() );
281 //mView->resize( splash->size() ); 280 //mView->resize( splash->size() );
282 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 281 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
283 mView->readSettings(); 282 mView->readSettings();
284 bool newFile = false; 283 bool newFile = false;
285 if( !QFile::exists( defaultFileName() ) ) { 284 if( !QFile::exists( defaultFileName() ) ) {
286 QFileInfo finfo ( defaultFileName() ); 285 QFileInfo finfo ( defaultFileName() );
287 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 286 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
288 qDebug("oldfile %s ", oldFile.latin1());
289 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 287 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
290 finfo.setFile( oldFile ); 288 finfo.setFile( oldFile );
291 if (finfo.exists() ) { 289 if (finfo.exists() ) {
292 KMessageBox::information( this, message); 290 KMessageBox::information( this, message);
293 mView->openCalendar( oldFile ); 291 mView->openCalendar( oldFile );
294 qApp->processEvents(); 292 qApp->processEvents();
295 } else { 293 } else {
296 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 294 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
297 finfo.setFile( oldFile ); 295 finfo.setFile( oldFile );
298 if (finfo.exists() ) { 296 if (finfo.exists() ) {
299 KMessageBox::information( this, message); 297 KMessageBox::information( this, message);
300 mView->openCalendar( oldFile ); 298 mView->openCalendar( oldFile );
301 qApp->processEvents(); 299 qApp->processEvents();
302 } 300 }
303 } 301 }
304 mView->saveCalendar( defaultFileName() ); 302 mView->saveCalendar( defaultFileName() );
305 newFile = true; 303 newFile = true;
306 } 304 }
307 305
308 QTime neededSaveTime = QDateTime::currentDateTime().time(); 306 QTime neededSaveTime = QDateTime::currentDateTime().time();
309 mView->openCalendar( defaultFileName() ); 307 mView->openCalendar( defaultFileName() );
310 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 308 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
311 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 309 qDebug("KO: Calendar loading time: %d ms",msNeeded );
312 310
@@ -397,55 +395,55 @@ void MainWindow::disableBR(bool b)
397 } else { 395 } else {
398 if ( mBRdisabled ) { 396 if ( mBRdisabled ) {
399 mBRdisabled = false; 397 mBRdisabled = false;
400 //makes no sense,because other cal ap is probably running 398 //makes no sense,because other cal ap is probably running
401 // toggleBeamReceive(); 399 // toggleBeamReceive();
402 } 400 }
403 } 401 }
404#endif 402#endif
405 403
406} 404}
407bool MainWindow::beamReceiveEnabled() 405bool MainWindow::beamReceiveEnabled()
408{ 406{
409#ifndef DESKTOP_VERSION 407#ifndef DESKTOP_VERSION
410 return ( infrared != 0 ); 408 return ( infrared != 0 );
411#endif 409#endif
412 return false; 410 return false;
413} 411}
414 412
415void MainWindow::toggleBeamReceive() 413void MainWindow::toggleBeamReceive()
416{ 414{
417 if ( mBRdisabled ) 415 if ( mBRdisabled )
418 return; 416 return;
419#ifndef DESKTOP_VERSION 417#ifndef DESKTOP_VERSION
420 if ( infrared ) { 418 if ( infrared ) {
421 qDebug("disable BeamReceive "); 419 qDebug("KO: Disable BeamReceive ");
422 delete infrared; 420 delete infrared;
423 infrared = 0; 421 infrared = 0;
424 brAction->setOn(false); 422 brAction->setOn(false);
425 return; 423 return;
426 } 424 }
427 qDebug("enable BeamReceive "); 425 qDebug("KO: Enable BeamReceive ");
428 brAction->setOn(true); 426 brAction->setOn(true);
429 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 427 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
430 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 428 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
431#endif 429#endif
432} 430}
433void MainWindow::showMaximized () 431void MainWindow::showMaximized ()
434{ 432{
435#ifndef DESKTOP_VERSION 433#ifndef DESKTOP_VERSION
436 if ( ! globalFlagBlockStartup ) 434 if ( ! globalFlagBlockStartup )
437 if ( mClosed ) 435 if ( mClosed )
438 mView->goToday(); 436 mView->goToday();
439#endif 437#endif
440 QWidget::showMaximized () ; 438 QWidget::showMaximized () ;
441 mClosed = false; 439 mClosed = false;
442} 440}
443void MainWindow::closeEvent( QCloseEvent* ce ) 441void MainWindow::closeEvent( QCloseEvent* ce )
444{ 442{
445 443
446 444
447 445
448 if ( ! KOPrefs::instance()->mAskForQuit ) { 446 if ( ! KOPrefs::instance()->mAskForQuit ) {
449 saveOnClose(); 447 saveOnClose();
450 mClosed = true; 448 mClosed = true;
451 ce->accept(); 449 ce->accept();
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index f2a6c60..45ed04d 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,64 +1,56 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qmenubar.h> 8#include <qmenubar.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <qregexp.h> 10#include <qregexp.h>
11 11
12#include <libkcal/incidence.h> 12#include <libkcal/incidence.h>
13#include "simplealarmclient.h"
14#include <ksyncmanager.h> 13#include <ksyncmanager.h>
15#ifndef DESKTOP_VERSION 14#ifndef DESKTOP_VERSION
16#include <qcopchannel_qws.h> 15#include <qcopchannel_qws.h>
17#endif 16#endif
18class QAction; 17class QAction;
19class CalendarView; 18class CalendarView;
20class KSyncProfile; 19class KSyncProfile;
21#ifdef DESKTOP_VERSION 20#ifdef DESKTOP_VERSION
22 21
23#define QPEToolBar QToolBar 22#define QPEToolBar QToolBar
24#define QPEMenuBar QMenuBar 23#define QPEMenuBar QMenuBar
25#endif 24#endif
26class QPEToolBar; 25class QPEToolBar;
27class QPEMenuBar; 26class QPEMenuBar;
28 27
29 28
30namespace KCal { 29namespace KCal {
31class CalendarLocal; 30class CalendarLocal;
32} 31}
33 32
34class KOMenuBar : public QMenuBar
35{
36 public:
37 KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;}
38 QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );}
39};
40
41using namespace KCal; 33using namespace KCal;
42 34
43class MainWindow : public QMainWindow 35class MainWindow : public QMainWindow
44{ 36{
45 Q_OBJECT 37 Q_OBJECT
46 public: 38 public:
47 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 39 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
48 ~MainWindow(); 40 ~MainWindow();
49 bool beamReceiveEnabled(); 41 bool beamReceiveEnabled();
50 static QString defaultFileName(); 42 static QString defaultFileName();
51 static QString syncFileName(); 43 static QString syncFileName();
52 static QString resourcePath(); 44 static QString resourcePath();
53 public slots: 45 public slots:
54 void setCaption ( const QString & ); 46 void setCaption ( const QString & );
55 void updateWeekNum(const KCal::DateList &); 47 void updateWeekNum(const KCal::DateList &);
56 void updateWeek(QDate); 48 void updateWeek(QDate);
57 void updateFilterToolbar(); 49 void updateFilterToolbar();
58 virtual void showMaximized (); 50 virtual void showMaximized ();
59 void configureAgenda( int ); 51 void configureAgenda( int );
60 void recieve( const QCString& msg, const QByteArray& data ); 52 void recieve( const QCString& msg, const QByteArray& data );
61 protected slots: 53 protected slots:
62 void setCaptionToDates(); 54 void setCaptionToDates();
63 void weekAction(); 55 void weekAction();
64 void about(); 56 void about();
@@ -143,33 +135,32 @@ class MainWindow : public QMainWindow
143 QPopupMenu *selectFilterMenuTB; 135 QPopupMenu *selectFilterMenuTB;
144 QPopupMenu *configureAgendaMenu, *syncMenu; 136 QPopupMenu *configureAgendaMenu, *syncMenu;
145 CalendarLocal *mCalendar; 137 CalendarLocal *mCalendar;
146 CalendarView *mView; 138 CalendarView *mView;
147 QAction *mNewSubTodoAction; 139 QAction *mNewSubTodoAction;
148 QAction *mWeekAction; 140 QAction *mWeekAction;
149 QFont mWeekFont; 141 QFont mWeekFont;
150 QPixmap mWeekPixmap; 142 QPixmap mWeekPixmap;
151 QColor mWeekBgColor; 143 QColor mWeekBgColor;
152 144
153 QAction *mShowAction; 145 QAction *mShowAction;
154 QAction *mEditAction; 146 QAction *mEditAction;
155 QAction *mDeleteAction; 147 QAction *mDeleteAction;
156 QAction *mCloneAction; 148 QAction *mCloneAction;
157 QAction *mMoveAction; 149 QAction *mMoveAction;
158 QAction *mBeamAction; 150 QAction *mBeamAction;
159 QAction *mCancelAction; 151 QAction *mCancelAction;
160 152
161 QAction *mToggleNav; 153 QAction *mToggleNav;
162 QAction *mToggleFilter; 154 QAction *mToggleFilter;
163 QAction *mToggleAllday; 155 QAction *mToggleAllday;
164 QAction *actionFilterMenuTB; 156 QAction *actionFilterMenuTB;
165 157
166 void closeEvent( QCloseEvent* ce ); 158 void closeEvent( QCloseEvent* ce );
167 SimpleAlarmClient mAlarmClient;
168 QTimer mSaveTimer; 159 QTimer mSaveTimer;
169 //bool mBlockSaveFlag; 160 //bool mBlockSaveFlag;
170 bool mCalendarModifiedFlag; 161 bool mCalendarModifiedFlag;
171 QPixmap loadPixmap( QString ); 162 QPixmap loadPixmap( QString );
172}; 163};
173 164
174 165
175#endif 166#endif
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index 7a945e3..de65b53 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -424,43 +424,42 @@ void SearchDialog::search(const QRegExp &re)
424 Journal* journ; 424 Journal* journ;
425 425
426 for(journ=journals.first();journ;journ=journals.next()) { 426 for(journ=journals.first();journ;journ=journals.next()) {
427 if ( journ->dtStart().date() <= mEndDate->date() 427 if ( journ->dtStart().date() <= mEndDate->date()
428 &&journ->dtStart().date() >= mStartDate->date()) { 428 &&journ->dtStart().date() >= mStartDate->date()) {
429#if QT_VERSION >= 0x030000 429#if QT_VERSION >= 0x030000
430 if (re.search(journ->description()) != -1) 430 if (re.search(journ->description()) != -1)
431#else 431#else
432 if (re.match(journ->description()) != -1) 432 if (re.match(journ->description()) != -1)
433#endif 433#endif
434 { 434 {
435 mMatchedJournals.append(journ); 435 mMatchedJournals.append(journ);
436 continue; 436 continue;
437 } 437 }
438 } 438 }
439 } 439 }
440 } 440 }
441 441
442} 442}
443 443
444void SearchDialog::keyPressEvent ( QKeyEvent *e) 444void SearchDialog::keyPressEvent ( QKeyEvent *e)
445{ 445{
446 switch ( e->key() ) { 446 switch ( e->key() ) {
447 case Qt::Key_Escape: 447 case Qt::Key_Escape:
448 hide(); 448 close();
449 break; 449 break;
450 case Qt::Key_F: 450 case Qt::Key_F:
451 if ( e->state() == Qt::ControlButton ) { 451 if ( e->state() == Qt::ControlButton ) {
452 qDebug("full ");
453 452
454 } 453 }
455 break; 454 break;
456 case Qt::Key_Return: 455 case Qt::Key_Return:
457 case Qt::Key_Enter: 456 case Qt::Key_Enter:
458 doSearch(); 457 doSearch();
459 break; 458 break;
460 459
461 default: 460 default:
462 e->ignore(); 461 e->ignore();
463 } 462 }
464} 463}
465 464
466//mMatchedJournals; 465//mMatchedJournals;