summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt4
-rw-r--r--korganizer/calendarview.cpp52
-rw-r--r--libkcal/event.cpp16
-rw-r--r--libkcal/event.h2
4 files changed, 45 insertions, 29 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index 43bc343..34e9b7f 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1477,41 +1477,41 @@
{ "Alarm Options","Alarm Einstellungen" },
{ "Delete selected...","Lösche Ausgewählte..." },
{ "None","Nichts" },
{ "Selection","Auswahl" },
{ "Set categories","Setze Kategorien" },
{ "This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!","Das fügt die ausgewählten\nEinträge dem Kalender\n%1\nhinzu und entfernt sie von\nihrem aktuellen Kalender!" },
{ "Reset","Neu setzen" },
{ "Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?","Möchten Sie Kategorien zu den ausgewählten Einträgen <b>hinzufügen</b> oder die Liste <b>neu setzen</b> (d.h. vorhandene Kategorien löschen)?" },
{ "The file\n%1\ndoes not exist!\nShall I create it for you?","Die Datei\n%1\nexistiert nicht!\nSoll sie neu angelegt werden?" },
{ "Sorry, cannot create the file\n%1!\nNo calendar added!","Kann leider die Datei\n%1\nnicht anlegen!\nKein Kalender hinzugefügt!" },
{ "\nNO\n WRITEABLE\n CALENDAR\n FOUND!\n\nPlease fix your calendar settings!\n","\nKEIN\n SCHREIBBARER\n KALENDER\n GEFUNDEN!\n\nBitte korrigieren Sie\nihre Kalendereinstellungen!\n" },
{ "\nThe file\n%1\non disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n","\nDie Datei\n%1\nwurde verändert!\nDatei Grösse: %2 Bytes.\nZuletzt geändert: %3\nMöchten Sie:\n\n - Speichern und die Datei überschreiben?\n - Mit Datei Synchronisieren, dann speichern?\n - Abbrechen ohne zu speichern? \n" },
{ "Edit","Edit" },
{ "Last Modified","Zuletzt geändert" },
{ "Journal viewer","Journal Anzeige" },
{ "Configure Calendar Files...","Konfiguriere Kalenderdateien..." },
{ "You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>.","Sie können <b>mehr als eine</b> Kalenderdatei in KO/Pi darstellen und benutzen. Eine Kalenderdatei wird <b>Resource</b> genannt. Um einen Kalender hinzuzufügen oder die Kalendereinstellungen zu ändern benutzen Sie bitte das Menu: <b>Ansicht -> Resourcenansicht umschalten</b>." },
{ "Hide Completed","Verstecke erledigte Todos" },
{ "Show not Running","Zeige nicht Laufende" },
{ "Click to add new Todo","Klick für neues Todo!" },
{ "Show next conflict for","Zeige nächsten Konflikt für" },
{ "All events","Alle Termine" },
{ "Allday events","Ganztagestermine" },
{ "Events with time","Termine mit Zeit" },
-{ "No conflict found within the next two years","Kein Konflikt innerhalb der nächsten zwei Jahre gefunden" },
+{ "No conflict found","Kein Konflikt gefunden" },
{ "Conflict %1 <-> %2","Konflikt %1 <-> %2" },
{ "<p><b>Q</b>: Show next date with conflicting events\n ","<p><b>Q</b>: Zeige nächstes Datum mit Terminen im Konflikt\n " },
{ "Week view mode uses row layout","Wochenansicht Modus nutzt Reihenlayout" },
{ "The event\n%1\nconflicts with event\n%2\nat date\n%3.\n","Der Termin\n%1\nist im Konflikt mit Termin\n%2\nam Datum\n%3.\n" },
{ "KO/Pi Conflict delected","KO/Pi Konflikt erkannt" },
{ "Show date","Zeige Datum" },
-{ "No problem!","Kein Problem!" },
+{ "No problem!","Null Problemo!" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 65750af..426e8f9 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -640,90 +640,105 @@ void CalendarView::init()
this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
#endif
mDateNavigator->setCalendar( mCalendar );
}
CalendarView::~CalendarView()
{
// kdDebug() << "~CalendarView()" << endl;
//qDebug("CalendarView::~CalendarView() ");
delete mDialogManager;
delete mViewManager;
delete mStorage;
delete mDateFrame ;
delete mEventViewerDialog;
//kdDebug() << "~CalendarView() done" << endl;
}
void CalendarView::nextConflict( bool all, bool allday )
{
QPtrList<Event> testlist = mCalendar->events();
Event * test = testlist.first();
while ( test ) {
test->setTagged( false );
+ test = testlist.next();
}
QDateTime startDT = QDateTime (mNavigator->selectedDates().first().addDays(1), QTime ( 0,0,0));
QDateTime conflict;
QDateTime retVal;
bool found = false;
Event * cE = 0;
+ Event * cE2 = 0;
QPtrList<Event> testlist2 = testlist;
+ test = testlist.first();
+ bool skip = false;
while ( test ) {
- Event * test2 = testlist2.first();
- while ( test2 ) {
- if ( !test2->isTagged() ) {
- if ( test->isOverlapping ( test2, &retVal, true ) ) {
- if ( ! found ) {
- if ( retVal >= startDT ) {
- conflict = retVal;
- cE = test;
- found = true;
- }
- } else {
- if ( retVal >= startDT && retVal < conflict ) {
- conflict = retVal;
- cE = test;
+ skip = false;
+ if ( !all ) skip = ( allday != test->doesFloat() );
+ if ( !skip ) {
+ Event * test2 = testlist2.first();
+ while ( test2 ) {
+ skip = false;
+ if ( !all ) skip = ( allday != test2->doesFloat() );
+ if ( !skip ) {
+ if ( !test2->isTagged() ) {
+ if ( test->isOverlapping ( test2, &retVal, &startDT ) ) {
+ //qDebug("overlap ");
+ if ( ! found ) {
+ if ( retVal >= startDT ) {
+ conflict = retVal;
+ cE = test;
+ cE2 = test2;
+ found = true;
+ }
+ } else {
+ if ( retVal >= startDT && retVal < conflict ) {
+ conflict = retVal;
+ cE = test;
+ cE2 = test2;
+ }
+ }
}
}
}
+ test2 = testlist2.next();
}
- test2 = testlist2.next();
}
test->setTagged( true );
test = testlist.next();
}
if ( found ) {
if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 )
mViewManager->showDayView();
mNavigator->slotDaySelect( conflict.date() );
int hour = conflict.time().hour();
mViewManager->agendaView()->setStartHour( hour );
- topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) );
+ topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) );
return;
}
- topLevelWidget()->setCaption( i18n("No conflict found within the next two years") );
+ topLevelWidget()->setCaption( i18n("No conflict found") );
qDebug("No conflict found ");
return;
#if 0
QDate end = start.addDays( 365*2);
while ( start < end ) {
QPtrList<Event> eventList = calendar()->events( start );
Event * ev = eventList.first();
QPtrList<Event> test = eventList;
while ( ev ) {
//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 )
@@ -2773,51 +2788,52 @@ void CalendarView::changeEventDisplay(Event *which, int action)
mConflictingEvent = which ;
QTimer::singleShot( 1000, this, SLOT ( checkConflictForEvent() ) );
}
// }
} else {
mViewManager->currentView()->updateView();
}
}
void CalendarView::checkConflictForEvent()
{
if (!KOPrefs::instance()->mConfirm)
return;
if ( ! mConflictingEvent ) return;
if ( mConflictingEvent->doesFloat() ) {
mConflictingEvent = 0;
return;
}
QPtrList<Event> testlist = mCalendar->events();
Event * test = testlist.first();
QDateTime conflict;
QDateTime retVal;
bool found = false;
Event * cE = 0;
+ QDateTime current = QDateTime::currentDateTime();
while ( test ) {
if ( !test->doesFloat() ) {
- if ( mConflictingEvent->isOverlapping ( test, &retVal, true ) ) {
+ if ( mConflictingEvent->isOverlapping ( test, &retVal, &current ) ) {
if ( ! found ) {
conflict = retVal;
cE = test;
} else {
if ( retVal < conflict ) {
conflict = retVal;
cE = test;
}
}
found = true;
}
}
test = testlist.next();
}
if ( found ) {
QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( mConflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ;
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();
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index 235ae55..46e8174 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -150,153 +150,153 @@ bool Event::hasEndDate() const
bool Event::isMultiDay() const
{
bool multi = !(dtStart().date() == dtEnd().date());
return multi;
}
void Event::setTransparency(Event::Transparency transparency)
{
if (mReadOnly) return;
mTransparency = transparency;
updated();
}
Event::Transparency Event::transparency() const
{
return mTransparency;
}
void Event::setDuration(int seconds)
{
setHasEndDate(false);
Incidence::setDuration(seconds);
}
-bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, bool inFutureOnly )
+bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, QDateTime* startDT )
{
if ( testEvent == this )
return false;
if ( ! doesRecur() && !testEvent->doesRecur() ) {
QDateTime te;
if ( testEvent->doesFloat() )
te = testEvent->mDtEnd.addDays( 1 );
else
te = testEvent->mDtEnd;
QDateTime e;
if ( doesFloat() )
e = mDtEnd.addDays( 1 );
else
e = mDtEnd;
if ( mDtStart < te && testEvent->mDtStart < e ) {
if ( mDtStart < testEvent->mDtStart )
*overlapDT = testEvent->mDtStart;
else
*overlapDT = mDtStart;
- if ( inFutureOnly )
- return (*overlapDT >= QDateTime::currentDateTime() );
+ if ( startDT )
+ return (*overlapDT >= *startDT );
return true;
}
return false;
}
Event *nonRecur = 0;
Event *recurEvent = 0;
if ( ! doesRecur() ) {
nonRecur = this;
recurEvent = testEvent;
}
else if ( !testEvent->doesRecur() ) {
nonRecur = testEvent;
recurEvent = this;
}
if ( nonRecur ) {
QDateTime enr;
if ( nonRecur->doesFloat() )
enr = nonRecur->mDtEnd.addDays( 1 );
else
enr = nonRecur->mDtEnd;
if ( enr < recurEvent->mDtStart )
return false;
- if ( inFutureOnly && enr < QDateTime::currentDateTime() )
+ if ( startDT && enr < *startDT )
return false;
int recDuration = recurEvent->mDtStart.secsTo( recurEvent->mDtEnd );
if ( recurEvent->doesFloat() )
recDuration += 86400;
bool ok = true;
QDateTime recStart = recurEvent->mDtStart.addSecs( -300);;
while ( ok ) {
recStart = recurEvent->getNextOccurence( recStart.addSecs( 60 ), &ok );
if ( ok ) {
if ( recStart > enr )
return false;
QDateTime recEnd = recStart.addSecs( recDuration );
if ( nonRecur->mDtStart < recEnd && recStart < nonRecur->mDtEnd ) {
if ( nonRecur->mDtStart < recStart )
*overlapDT = recStart;
else
*overlapDT = nonRecur->mDtStart;
- if ( inFutureOnly ) {
- if ( *overlapDT >= QDateTime::currentDateTime() )
+ if ( startDT ) {
+ if ( *overlapDT >= *startDT )
return true;
} else
return true;
}
}
}
return false;
}
QDateTime incidenceStart = mDtStart;
int duration = mDtStart.secsTo( mDtEnd );
if ( doesFloat() )
duration += 86400;
QDateTime testincidenceStart = testEvent->mDtStart;
int testduration = testEvent->mDtStart.secsTo( testEvent->mDtEnd );
if ( testEvent->doesFloat() )
testduration += 86400;
bool computeThis = false;
if ( incidenceStart < testincidenceStart )
computeThis = true;
bool ok = true;
if ( computeThis )
incidenceStart = incidenceStart.addSecs( -300 );
else
testincidenceStart = testincidenceStart.addSecs( -300 );
int count = 0;
while ( ok ) {
++count;
if ( count > 1000 ) break;
if ( computeThis )
incidenceStart = getNextOccurence( incidenceStart.addSecs( 60 ), &ok );
else
testincidenceStart = testEvent->getNextOccurence( testincidenceStart.addSecs( 60 ), &ok );
if ( ok ) {
if ( incidenceStart < testincidenceStart.addSecs( testduration ) && testincidenceStart < incidenceStart.addSecs( duration ) ) {
if ( incidenceStart < testincidenceStart )
*overlapDT = testincidenceStart;
else
*overlapDT = incidenceStart;
- if ( inFutureOnly ) {
- if ( *overlapDT >= QDateTime::currentDateTime() )
+ if ( startDT ) {
+ if ( *overlapDT >= *startDT )
return true;
} else
return true;
}
computeThis = ( incidenceStart < testincidenceStart );
}
}
return false;
}
QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const
{
*ok = false;
if ( !alarmEnabled() )
return QDateTime ();
bool yes;
QDateTime incidenceStart = getNextOccurence( start_dt, &yes );
if ( ! yes || cancelled() ) {
*ok = false;
return QDateTime ();
}
bool enabled = false;
Alarm* alarm;
diff --git a/libkcal/event.h b/libkcal/event.h
index 80c11c4..e6055a5 100644
--- a/libkcal/event.h
+++ b/libkcal/event.h
@@ -53,41 +53,41 @@ class Event : public Incidence
users locale settings */
QString dtEndTimeStr() const;
/** returns an event's end date as a string formatted according to the
users locale settings */
QString dtEndDateStr(bool shortfmt=true) const;
/** returns an event's end date and time as a string formatted according
to the users locale settings */
QString dtEndStr(bool shortfmt=true) const;
void setHasEndDate(bool);
/** Return whether the event has an end date/time. */
bool hasEndDate() const;
/** Return true if the event spans multiple days, otherwise return false. */
bool isMultiDay() const;
/** set the event's time transparency level. */
void setTransparency(Transparency transparency);
/** get the event's time transparency level. */
Transparency transparency() const;
void setDuration(int seconds);
bool contains ( Event*);
- bool isOverlapping ( Event*, QDateTime*, bool inFutureOnly );
+ bool isOverlapping ( Event*, QDateTime*, QDateTime* );
private:
bool accept(Visitor &v) { return v.visit(this); }
QDateTime mDtEnd;
bool mHasEndDate;
Transparency mTransparency;
};
bool operator==( const Event&, const Event& );
}
#endif