summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp2
-rw-r--r--korganizer/koviewmanager.cpp6
-rw-r--r--korganizer/koviewmanager.h2
-rw-r--r--korganizer/kowhatsnextview.cpp45
-rw-r--r--libkcal/incidence.cpp4
-rw-r--r--libkcal/incidencebase.cpp4
6 files changed, 45 insertions, 18 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index ba0e6c6..bbed05b 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1915,49 +1915,49 @@ void CalendarView::eventChanged(Event *event)
//updateUnmanagedViews();
}
void CalendarView::eventAdded(Event *event)
{
changeEventDisplay(event,KOGlobals::EVENTADDED);
}
void CalendarView::eventToBeDeleted(Event *)
{
kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
}
void CalendarView::eventDeleted()
{
changeEventDisplay(0,KOGlobals::EVENTDELETED);
}
void CalendarView::changeTodoDisplay(Todo *which, int action)
{
changeIncidenceDisplay((Incidence *)which, action);
mDateNavigator->updateView(); //LR
//mDialogManager->updateSearchDialog();
if (which) {
- //mViewManager->currentView()->updateView();//LR
+ mViewManager->updateWNview();
//mTodoList->updateView();
}
}
void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
{
updateUnmanagedViews();
//qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
if ( action == KOGlobals::EVENTDELETED ) { //delete
mCalendar->checkAlarmForIncidence( 0, true );
if ( mEventViewerDialog )
mEventViewerDialog->hide();
}
else
mCalendar->checkAlarmForIncidence( which , false );
}
// most of the changeEventDisplays() right now just call the view's
// total update mode, but they SHOULD be recoded to be more refresh-efficient.
void CalendarView::changeEventDisplay(Event *which, int action)
{
// kdDebug() << "CalendarView::changeEventDisplay" << endl;
changeIncidenceDisplay((Incidence *)which, action);
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index fc2bc77..ba77b45 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -202,48 +202,54 @@ void KOViewManager::raiseCurrentView( bool fullScreen )
}
//qDebug("raiseCurrentView ende ");
}
void KOViewManager::updateView()
{
// qDebug("KOViewManager::updateView() ");
// if we are updating mTodoView, we get endless recursion
if ( mTodoView == mCurrentView )
return;
if ( mCurrentView ) mCurrentView->updateView();
}
void KOViewManager::updateView(const QDate &start, const QDate &end)
{
// kdDebug() << "KOViewManager::updateView()" << endl;
if (mCurrentView) mCurrentView->showDates(start, end);
if (mTodoView) mTodoView->updateView();
}
+void KOViewManager::updateWNview()
+{
+ if ( mCurrentView == mWhatsNextView && mWhatsNextView )
+ mWhatsNextView->updateView();
+
+}
void KOViewManager::showWhatsNextView()
{
if (!mWhatsNextView) {
mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
"KOViewManager::WhatsNextView");
mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
addView(mWhatsNextView);
}
globalFlagBlockAgenda = 1;
showView(mWhatsNextView, true );
mWhatsNextView->updateView();
}
void KOViewManager::showListView()
{
if (!mListView) {
mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
addView(mListView);
connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
mMainView, SLOT(showIncidence(Incidence *)));
connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h
index f814c36..26b22be 100644
--- a/korganizer/koviewmanager.h
+++ b/korganizer/koviewmanager.h
@@ -32,49 +32,49 @@ class CalendarView;
class KOListView;
class KOAgendaView;
class KOMonthView;
class KOTimeSpanView;
class KOTodoView;
class KOWhatsNextView;
class KOJournalView;
using namespace KCal;
/**
This class manages the views of the calendar. It owns the objects and handles
creation and selection.
*/
class KOViewManager : public QObject
{
Q_OBJECT
public:
KOViewManager( CalendarView * );
virtual ~KOViewManager();
/** changes the view to be the currently selected view */
void showView(KOrg::BaseView *, bool fullScreen = false );
-
+ void updateWNview();
void readSettings(KConfig *config);
void writeSettings(KConfig *config);
bool showsNextDays();
/** Read which view was shown last from config file */
void readCurrentView(KConfig *);
/** Write which view is currently shown to config file */
void writeCurrentView(KConfig *);
KOrg::BaseView *currentView();
void setDocumentId( const QString & );
void updateView();
void updateView( const QDate &start, const QDate &end );
void raiseCurrentView( bool fullScreen = false );
void addView(KOrg::BaseView *);
Incidence *currentSelection();
QDate currentSelectionDate();
KOAgendaView *agendaView() const { return mAgendaView; }
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index b2001ec..2a8a7c1 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -242,93 +242,88 @@ void KOWhatsNextView::updateView()
}
if ( gotone ) {
gotone = false;
++priosFound;
if ( priosFound == topmostPrios )
break;
}
priority++;
// kdDebug() << "adding the todos..." << endl;
}
mText += "</ul>\n";
}
int replys = 0;
events = calendar()->events(QDate::currentDate(), QDate(2975,12,6));
if (events.count() > 0) {
Event *ev = events.first();
while(ev) {
Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
if (me!=0) {
if (me->status()==Attendee::NeedsAction && me->RSVP()) {
if (replys == 0) {
mText += "<p></p>";
// kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
- mText += "<h2>";
+ //mText += "<h2>";
//<img src=\"";
// mText += ipath;
// mText += "\">";
- mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n";
+ //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n";
+ mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n";
mText += "<table>\n";
}
replys++;
appendEvent(ev,true);
}
}
ev = events.next();
}
}
todos = calendar()->todos();
if (todos.count() > 0) {
Todo *to = todos.first();
while(to) {
+ if ( !to->isCompleted() ){
Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
if (me!=0) {
if (me->status()==Attendee::NeedsAction && me->RSVP()) {
if (replys == 0) {
- mText += "<p></p>";
- // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
- mText += "<h2>";
- //<img src=\"";
- // mText += ipath;
- // mText += "\">";
- mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n";
+ mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n";
mText += "<table>\n";
}
replys++;
- appendEvent(to);
+ appendEvent(to, true);
+ }
}
}
- kdDebug () << "check for todo-replys..." << endl;
to = todos.next();
}
}
if (replys > 0 ) mText += "</table>\n";
mText += "</td></tr>\n</table>\n";
- kdDebug() << "KOWhatsNextView::updateView: text: " << mText << endl;
mView->setText(mText);
mView->setFocus();
// QPixmap bPix = SmallIcon( "back" );
// qDebug("xxxxxxxxxxxxxxxxxxxxx ");
// QWidget* test = new QWidget();
// test->setBackgroundMode(FixedPixmap );
// test->setBackgroundPixmap ( bPix );
// test->resize( 300, 400 );
// test->show();
// mView->setBackgroundMode(FixedPixmap );
// mView->setBackgroundPixmap ( bPix );
}
void KOWhatsNextView::appendDay( int i, QDate eventDate )
{
QString date;
QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer);
if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) {
if ( i == 0 ) {
mText += "<table>\n";
return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>";
}
else if ( i == 1 )
@@ -373,118 +368,140 @@ void KOWhatsNextView::showDates(const QDate &, const QDate &)
void KOWhatsNextView::showEvents(QPtrList<Event>)
{
}
void KOWhatsNextView::changeEventDisplay(Event *, int action)
{
switch(action) {
case KOGlobals::EVENTADDED:
updateView();
break;
case KOGlobals::EVENTEDITED:
updateView();
break;
case KOGlobals::EVENTDELETED:
updateView();
break;
default:
updateView();
kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl;
}
}
void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed )
{
- if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(21) == QString("last-syncEvent-device") )
+ if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") )
return;
QDateTime cdt = QDateTime::currentDateTime();
+ QDateTime noc;
+ bool ok = true;
+ if ( reply ) {
+ noc = ev->getNextOccurence( cdt, &ok );
+ if (! ok && ev->type() == "Event")
+ return;
+ }
mText += "<tr><td><b>";
if (ev->type()=="Event") {
+ if (reply) {
+ if (!ev->doesFloat())
+ mText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": ";
+ else
+ mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
+ } else {
if (!ev->doesFloat()) {
Event *event = static_cast<Event *>(ev);
QDateTime st,end;
if ( event->recurrence()->doesRecur() ) {
QDate recDate= mEventDate;
int days = event->dtStart().date().daysTo (event->dtEnd().date() );
while ( ! event->recursOn( recDate ) ) {
recDate = recDate.addDays( -1 );
}
st = QDateTime ( recDate, event->dtStart().time() );
end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() );
}
else {
st = event->dtStart();
end = event->dtEnd();
}
- if (reply) mText += "on " + event->dtStartDateStr() + ": ";
+
QString dateText;
// qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() );
if ( st.date() < mEventDate )
dateText = "++:++-";
else
dateText = event->dtStartTimeStr() + "-";
if ( end.date() > mEventDate )
dateText += "++:++";
else
dateText += event->dtEndTimeStr();
if ( notRed )
mText += dateText;
else {
if ( end < cdt )
mText += "<font color=\"#F00000\">" + dateText + "</font>";
else if ( st < cdt )
mText += "<font color=\"#008000\">" + dateText + "</font>";
else
mText += dateText;
+
}
} else {
mText += i18n("Allday:");
}
+ }
} else {
mTodos.append( ev );
mText += i18n("ToDo:");
+ if (reply) {
+ mText += " ";
+ if ( noc != cdt ) {
+ mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
+ }
+ } else {
if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) {
// mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
QString dfs = KGlobal::locale()->dateFormatShort();
KGlobal::locale()->setDateFormatShort("%d.%b");
mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>";
KGlobal::locale()->setDateFormatShort(dfs);
} else {
if (!ev->doesFloat() )
if( ( (Todo*)ev)->dtDue() < cdt ) {
mText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>";
} else
mText +=((Todo*)ev)->dtDueTimeStr();
mTodos.append( ev );
}
}
+ }
mText += "</b></td><td>";
bool needClose = false;
if ( ev->cancelled() ) {
mText += "<font color=\"#F00000\">[c";
needClose =true;
}
if ( ev->isAlarmEnabled() ) {
if ( !needClose)
mText +="[";
mText += "a";
needClose =true;
}
if ( ev->description().length() > 0 ) {
if ( !needClose)
mText +="[";
mText += "i";
needClose =true;
}
if ( ev->recurrence()->doesRecur() ) {
if ( !needClose)
mText +="[";
mText += "r";
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 56c9801..55ac6d4 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -569,31 +569,35 @@ QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const
if ( !last ) {
while ( !last ) {
++count;
incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last );
if ( recursOn( incidenceStart.date() ) ) {
last = true; // exit while llop
} else {
if ( last ) { // no alarm on last recurrence
return QDateTime ();
}
int year = incidenceStart.date().year();
// workaround for bug in recurrence
if ( count == 100 || year < 1980 || year > 5000 ) {
return QDateTime ();
}
incidenceStart = incidenceStart.addSecs( 1 );
}
}
} else {
return QDateTime ();
}
} else {
if ( hasStartDate () ) {
incidenceStart = dtStart();
+ }
+ if ( type() =="Todo" ) {
+ if ( ((Todo*)this)->hasDueDate() )
+ incidenceStart = ((Todo*)this)->dtDue();
}
}
if ( incidenceStart > dt )
*ok = true;
return incidenceStart;
}
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index 64a343c..b36dc1a 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -250,67 +250,67 @@ void IncidenceBase::clearAttendees()
mAttendees.clear();
}
#if 0
Attendee *IncidenceBase::getAttendee(const char *n) const
{
QPtrListIterator<Attendee> qli(mAttendees);
qli.toFirst();
while (qli) {
if (qli.current()->getName() == n)
return qli.current();
++qli;
}
return 0L;
}
#endif
Attendee *IncidenceBase::attendeeByMail(const QString &email)
{
QPtrListIterator<Attendee> qli(mAttendees);
qli.toFirst();
while (qli) {
- if (qli.current()->email() == email)
+ if (qli.current()->email().lower() == email.lower())
return qli.current();
++qli;
}
return 0L;
}
Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QString& email)
{
QPtrListIterator<Attendee> qli(mAttendees);
QStringList mails = emails;
if (!email.isEmpty()) {
mails.append(email);
}
qli.toFirst();
while (qli) {
for ( QStringList::Iterator it = mails.begin(); it != mails.end(); ++it ) {
- if (qli.current()->email() == *it)
+ if (qli.current()->email().lower() == (*it).lower())
return qli.current();
}
++qli;
}
return 0L;
}
void IncidenceBase::setDuration(int seconds)
{
mDuration = seconds;
setHasDuration(true);
}
int IncidenceBase::duration() const
{
return mDuration;
}
void IncidenceBase::setHasDuration(bool b)
{
mHasDuration = b;
}