summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp70
-rw-r--r--korganizer/calendarview.h2
-rw-r--r--korganizer/kolistview.cpp39
-rw-r--r--korganizer/komonthview.cpp124
-rw-r--r--korganizer/komonthview.h2
-rw-r--r--korganizer/koprefs.cpp1
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--korganizer/koprefsdialog.cpp4
8 files changed, 192 insertions, 51 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 9a114d0..e766b8f 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2720,2 +2720,6 @@ void CalendarView::changeEventDisplay(Event *which, int action)
mTodoList->updateView();
+ if ( action != KOGlobals::EVENTDELETED ) {
+ mConflictingEvent = which ;
+ QTimer::singleShot( 1000, this, SLOT ( checkConflictForEvent() ) );
+ }
// }
@@ -2725,3 +2729,69 @@ void CalendarView::changeEventDisplay(Event *which, int action)
}
+void CalendarView::checkConflictForEvent()
+{
+
+ if (!KOPrefs::instance()->mConfirm)
+ return;
+ if ( ! mConflictingEvent ) return;
+ if ( mConflictingEvent->doesFloat() ) {
+ mConflictingEvent = 0;
+ return;
+ }
+ bool all = false;
+ bool allday = false;
+ Event * ev = mConflictingEvent;
+ mConflictingEvent = 0;
+ QDate start = ev->dtStart().date();
+ QDate end = ev->dtEnd().date().addDays(1);
+ while ( start < end ) {
+ QPtrList<Event> test = calendar()->events( start );
+ //qDebug("found %d on %s ", eventList.count(), start.toString().latin1());
+ Event * t_ev = test.first();
+ QDateTime es = ev->dtStart();
+ QDateTime ee = ev->dtEnd();
+ if ( ev->doesFloat() )
+ ee = ee.addDays( 1 );
+ if ( ! all ) {
+ if ( ev->doesFloat() != allday )
+ t_ev = 0;
+ }
+ while ( t_ev ) {
+ bool skip = false;
+ if ( ! all ) {
+ if ( t_ev->doesFloat() != allday )
+ skip = true;
+ }
+ if ( !skip && ev != t_ev ) {
+ QDateTime ets = t_ev->dtStart();
+ QDateTime ete = t_ev->dtEnd();
+ if ( t_ev->doesFloat() )
+ ete = ete.addDays( 1 );
+ //qDebug("test %s -- %s -------- %s -- %s ", es.toString().latin1() , ee.toString().latin1(), ets.toString().latin1() , ete.toString().latin1() );
+ if ( es < ete && ets < ee ) {
+ QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( ev->summary(),0 ) ).arg( KGlobal::formatMessage ( t_ev->summary(),0 )).arg(KGlobal::locale()->formatDate(start) ) ;
+ qApp->processEvents();
+ int km = KMessageBox::warningContinueCancel(this,mess,
+ i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!"));
+ if ( km != KMessageBox::Continue )
+ return;
+
+ if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 )
+ mViewManager->showDayView();
+ mNavigator->slotDaySelect( start );
+ int hour = es.time().hour();
+ if ( ets > es )
+ hour = ets.time().hour();
+ mViewManager->agendaView()->setStartHour( hour );
+ topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( ev->summary().left( 20 ) ).arg( t_ev->summary().left( 20 ) ) );
+ return;
+ }
+ }
+ t_ev = test.next();
+ }
+ start = start.addDays( 1 );
+ }
+ qDebug("No conflict found ");
+
+}
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 51eb1d4..706d05d 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -510,2 +510,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
void selectWeekNum ( int );
+ void checkConflictForEvent();
@@ -536,2 +537,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
protected:
+ Event *mConflictingEvent;
void schedule(Scheduler::Method, Incidence *incidence = 0);
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 7783dd4..d25f671 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -519,2 +519,19 @@ void KOListView::setAlarm()
inc->newAlarm();
+ Alarm *alarm = inc->alarms().first();
+ alarm->setEnabled(true);
+ int j = kap.mAlarmTimeEdit->value()* -60;
+ if (kap.mAlarmIncrCombo->currentItem() == 1)
+ j = j * 60;
+ else if (kap.mAlarmIncrCombo->currentItem() == 2)
+ j = j * (60 * 24);
+ alarm->setStartOffset( j );
+
+ if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
+ alarm->setProcedureAlarm(kap.mAlarmProgram);
+ }
+ else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
+ alarm->setAudioAlarm(kap.mAlarmSound);
+ else
+ alarm->setType(Alarm::Invalid);
+ } else {
QPtrList<Alarm> alarms = inc->alarms();
@@ -522,24 +539,2 @@ void KOListView::setAlarm()
for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
- alarm->setEnabled(true);
- int j = kap.mAlarmTimeEdit->value()* -60;
- if (kap.mAlarmIncrCombo->currentItem() == 1)
- j = j * 60;
- else if (kap.mAlarmIncrCombo->currentItem() == 2)
- j = j * (60 * 24);
- alarm->setStartOffset( j );
-
- if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
- alarm->setProcedureAlarm(kap.mAlarmProgram);
- }
- else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
- alarm->setAudioAlarm(kap.mAlarmSound);
- else
- alarm->setType(Alarm::Invalid);
- //alarm->setAudioAlarm("default");
- // TODO: Deal with multiple alarms
- break; // For now, stop after the first alarm
- }
- } else {
- Alarm* alarm = inc->alarms().first();
- if ( alarm ) {
alarm->setEnabled(false);
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 2289977..53bbe28 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1526,3 +1526,4 @@ void KOMonthView::updateConfig()
computeLayout();
- }
+ } else
+ doComputeLayoutWeek();
updateDayLabels();
@@ -1817,3 +1818,4 @@ void KOMonthView::resizeEvent(QResizeEvent * e)
mComputeLayoutTimer->start( 100 );
- KOEventView::resizeEvent( e );
+ if ( e )
+ KOEventView::resizeEvent( e );
}
@@ -1828,6 +1830,6 @@ void KOMonthView::slotComputeLayout()
}
-void KOMonthView::computeLayoutWeek()
+
+void KOMonthView::doComputeLayoutWeek()
{
- static int lastWid = 0;
- static int lastHei = 0;
+
int daysToShow;
@@ -1838,23 +1840,13 @@ void KOMonthView::computeLayoutWeek()
}
- int tWid = topLevelWidget()->size().width();
- int tHei = topLevelWidget()->size().height();
-
int wid = width();//e
int hei = height()-1-mNavigatorBar->height();
-
- if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
- return;
-
- if ( lastWid == width() && lastHei == height() ) {
- //qDebug("KOListWeekView::No compute layout needed ");
- return;
- }
- lastWid = width();
- lastHei = height();
-
-
- if ( wid < hei )
+ if ( !KOPrefs::instance()->mMonthViewWeekRowlayout ) {
daysToShow = 2;
- else
- daysToShow = 3;
+ } else {
+ if ( wid < hei )
+ daysToShow = 2;
+ else
+ daysToShow = 3;
+ }
+ bool landscape = (daysToShow == 3);
mShowSatSunComp = true;
@@ -1888,2 +1880,3 @@ void KOMonthView::computeLayoutWeek()
}
+ int xC,yC,wC,hC;
if ( i >= 5 ) {
@@ -1891,5 +1884,11 @@ void KOMonthView::computeLayoutWeek()
if ( i == 5 ) {
- mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi/2+wi%2,h);
+ xC = x+weeklabelwid;
+ yC = y;
+ wC = wi/2+wi%2;
+ hC = h;
} else {
- mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h);
+ xC = x+weeklabelwid;
+ yC = y;
+ wC = wi;
+ hC = h;
}
@@ -1902,4 +1901,10 @@ void KOMonthView::computeLayoutWeek()
}
- mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h);
+ xC = x+weeklabelwid;
+ yC = y;
+ wC = wi;
+ hC = h;
}
+ mDayLabelsW[mapWeekLayout(i,landscape)]->setGeometry( xC,yC,wC,hC);
+
+
x += w;
@@ -1925,2 +1930,3 @@ void KOMonthView::computeLayoutWeek()
+ int xC,yC,wC,hC;
if ( i >= 5 ) {
@@ -1928,3 +1934,6 @@ void KOMonthView::computeLayoutWeek()
max = h/2;
- mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max );
+ xC = x+weeklabelwid;
+ yC = y;
+ wC = w;
+ hC = max;
x -= w ;y += h/2;
@@ -1935,3 +1944,6 @@ void KOMonthView::computeLayoutWeek()
max = h-h/2;
- mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max );
+ xC = x+weeklabelwid;
+ yC = y;
+ wC = w;
+ hC = max;
y -= h/2;
@@ -1940,4 +1952,8 @@ void KOMonthView::computeLayoutWeek()
max = h;
- mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h );
+ xC = x+weeklabelwid;
+ yC = y;
+ wC = w;
+ hC = h;
}
+ mCellsW[mapWeekLayout(i,landscape)]->setGeometry ( xC,yC,wC,hC );
@@ -1965,2 +1981,52 @@ void KOMonthView::computeLayoutWeek()
}
+void KOMonthView::computeLayoutWeek()
+{
+ static int lastWid = 0;
+ static int lastHei = 0;
+ int tWid = topLevelWidget()->size().width();
+ int tHei = topLevelWidget()->size().height();
+ int wid = width();//e
+ int hei = height()-1-mNavigatorBar->height();
+ if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
+ return;
+
+ if ( lastWid == width() && lastHei == height() ) {
+ //qDebug("KOListWeekView::No compute layout needed ");
+ return;
+ }
+ lastWid = width();
+ lastHei = height();
+ doComputeLayoutWeek();
+}
+int KOMonthView::mapWeekLayout( int index, bool landscape )
+{
+ if ( KOPrefs::instance()->mMonthViewWeekRowlayout )
+ return index;
+ int diff = 0;
+ if ( !landscape ) diff = 1;
+ switch( index ) {
+ case 0:
+ case 5:
+ case 6:
+ return index;
+ break;
+ case 1:
+ return 2+diff;
+ break;
+ case 2:
+ return 4-(3*diff);
+ break;
+ case 3:
+ return 1+(3*diff);
+ break;
+ case 4:
+ return 3-diff;
+ break;
+ default:
+ qDebug("KO: Error in mapping week layout ");
+ return index;
+ break;
+ }
+ return index;
+}
void KOMonthView::computeLayout()
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 4d62e9b..61a141a 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -304,2 +304,3 @@ class KOMonthView: public KOEventView
void updateDayLabels();
+ int mapWeekLayout( int, bool );
@@ -323,2 +324,3 @@ class KOMonthView: public KOEventView
void computeLayoutWeek();
+ void doComputeLayoutWeek();
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index a63297e..9e7f18c 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -266,2 +266,3 @@ KOPrefs::KOPrefs() :
addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true);
+ addItemBool("MonthViewWeekRowlayout",&mMonthViewWeekRowlayout,true);
addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 392360d..2ff03fa 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -185,2 +185,3 @@ class KOPrefs : public KPimPrefs
bool mMonthViewWeek;
+ bool mMonthViewWeekRowlayout;
QColor mAppColor1;
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index ebcff33..05bd73f 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -705,2 +705,6 @@ void KOPrefsDialog::setupViewsTab()
dummy =
+ addWidBool(i18n("Week view mode uses row layout"),
+ &(KOPrefs::instance()->mMonthViewWeekRowlayout),topFrame);
+ topLayout->addWidget(dummy->checkBox(),ii++,0);
+ dummy =
addWidBool(i18n("Show Sat/Sun together"),