summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-20 15:25:04 (UTC)
committer zautrix <zautrix>2004-09-20 15:25:04 (UTC)
commit6b6a28919908134ccbb3badcb24c2dcae0d426a5 (patch) (side-by-side diff)
tree72b3f69fa1f40bd4cfbd945d9f41699229604ae6
parentf222bd1339ac8323e3c99af84a6f83c21cacb8f8 (diff)
downloadkdepimpi-6b6a28919908134ccbb3badcb24c2dcae0d426a5.zip
kdepimpi-6b6a28919908134ccbb3badcb24c2dcae0d426a5.tar.gz
kdepimpi-6b6a28919908134ccbb3badcb24c2dcae0d426a5.tar.bz2
Several bugfixes
Diffstat (more/less context) (ignore 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.cpp159
-rw-r--r--libkcal/incidence.cpp8
-rw-r--r--libkcal/incidencebase.cpp4
6 files changed, 104 insertions, 77 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index ba0e6c6..bbed05b 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1931,17 +1931,17 @@ void CalendarView::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();
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index fc2bc77..ba77b45 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -218,16 +218,22 @@ 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);
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h
index f814c36..26b22be 100644
--- a/korganizer/koviewmanager.h
+++ b/korganizer/koviewmanager.h
@@ -48,17 +48,17 @@ 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 *);
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index b2001ec..2a8a7c1 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -258,61 +258,56 @@ void KOWhatsNextView::updateView()
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) {
- 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 += "<table>\n";
+ 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 +="<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, true);
}
- replys++;
- appendEvent(to);
}
}
- 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 );
@@ -389,84 +384,106 @@ void KOWhatsNextView::changeEventDisplay(Event *, int action)
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") )
- return;
+ 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 );
- 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();
}
- 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>";
+
+ 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 {
+ mText += i18n("Allday:");
+ }
}
} else {
mTodos.append( ev );
mText += i18n("ToDo:");
- 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);
+ if (reply) {
+ mText += " ";
+ if ( noc != cdt ) {
+ mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
+ }
} 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 );
+ 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;
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 56c9801..55ac6d4 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -585,15 +585,19 @@ QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const
}
}
} 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
@@ -266,17 +266,17 @@ Attendee *IncidenceBase::getAttendee(const char *n) const
#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)
{
@@ -284,17 +284,17 @@ Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QStrin
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;
}