-rw-r--r-- | korganizer/calendarview.cpp | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 42166ab..608b73b 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -139,13 +139,13 @@ extern int globalFlagBlockStartup; MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent) { mAlarms = alarms; - setBackgroundColor( QColor( 86, 153, 205 ) ); + viewport()->setBackgroundColor( QColor( 255, 255, 255 ) ); QString mText = "<table width=\"100%\">\n"; //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; #ifdef DESKTOP_VERSION mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; #else mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>"; @@ -156,17 +156,17 @@ MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Inciden //mEventDate = QDate::currentDate(); #ifdef DESKTOP_VERSION mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>"; #else mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>"; #endif - mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; + //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; Incidence * inc = getNextInc( start ); int time = 0; - mText += "<table>"; + //mText += "<table>"; while ( inc ) { QDateTime dt ; QString tempText = "<a "; bool ok; dt = inc->getNextOccurence( start, &ok ); if ( !ok ) continue; @@ -184,24 +184,31 @@ MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Inciden tempText += i18n("-no summary-"); QString timestr; if (!inc->doesFloat()) timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": "; else timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": "; - if ( dt.date() == QDate::currentDate() && time == 0 ) { + if ( dt.date() < QDate::currentDate() && time == 0 ) { + mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; + mText += "<table>"; time = 1; - mText +="</table>"; + } + if ( dt.date() == QDate::currentDate() && time <= 1 ) { + if ( time > 0 ) + mText +="</table>"; mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>"; mText += "<table>"; + time = 2; } - if ( dt.date() > QDate::currentDate() && time != 2 ) { - time = 2; - mText +="</table>"; + if ( dt.date() > QDate::currentDate() && time <= 2 ) { + if ( time > 0 ) + mText +="</table>"; mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>"; mText += "<table>"; + time = 3; } mText +="<tr><td><b>"; mText += timestr; mText += "</b></td><td>"; mText += tempText; mText += "</td></tr>\n"; @@ -631,13 +638,13 @@ CalendarView::~CalendarView() void CalendarView::checkAlarms() { KConfig *config = KOGlobals::config(); config->setGroup( "AppRun" ); QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); int secs = config->readNumEntry( "LatestProgramStop" ) - 30; - secs -= ( 3600 * 24*3 ); // debug only + //secs -= ( 3600 * 24*3 ); // debug only QDateTime latest = dt.addSecs ( secs ); qDebug("KO: Last termination on %s ", latest.toString().latin1()); QPtrList<Incidence> el = mCalendar->rawIncidences(); QPtrList<Incidence> al; Incidence* inL = el.first(); while ( inL ) { @@ -659,16 +666,23 @@ void CalendarView::checkAlarms() QVBoxLayout* lay = new QVBoxLayout( dia ); lay->setSpacing( 0 ); lay->setMargin( 0 ); MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); lay->addWidget( matb ); - int si = 220; - if ( QApplication::desktop()->width() > 470 ) - si = 400; - dia->resize(si,si/2); + if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { + int wid = 210; + int x = QApplication::desktop()->width() - wid - 7; + int y = QApplication::desktop()->height() - wid - 70; + dia->setGeometry ( x,y,wid,wid); + } else { + int si = 220; + if ( QApplication::desktop()->width() > 470 ) + si = 400; + dia->resize(si,si/2); + } dia->setBackgroundColor( QColor( 255, 255, 255 ) ); dia->show(); } } void CalendarView::showDay( QDate d ) |