summaryrefslogtreecommitdiffabout
path: root/korganizer/kowhatsnextview.cpp
authorzautrix <zautrix>2004-10-29 21:05:07 (UTC)
committer zautrix <zautrix>2004-10-29 21:05:07 (UTC)
commit3c0edb4b4c4a77b334331749dfde776911c3a3a0 (patch) (side-by-side diff)
tree89de7078a1a062c19b2f13ededd49f471c362abf /korganizer/kowhatsnextview.cpp
parenta7e2fe5bb10af47a239b8b014a210568cc79287a (diff)
downloadkdepimpi-3c0edb4b4c4a77b334331749dfde776911c3a3a0.zip
kdepimpi-3c0edb4b4c4a77b334331749dfde776911c3a3a0.tar.gz
kdepimpi-3c0edb4b4c4a77b334331749dfde776911c3a3a0.tar.bz2
KO WN view fix
Diffstat (limited to 'korganizer/kowhatsnextview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kowhatsnextview.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index aa33588..2f7409d 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -67,28 +67,20 @@ KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
// mDateLabel->setAlignment(AlignCenter);
setFont( KOPrefs::instance()->mWhatsNextFont );
mView = new WhatsNextTextBrowser(this);
connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &)));
QStyleSheet* stsh = mView->styleSheet();
QStyleSheetItem * style ;
- style = stsh->item ("a" );
- if ( style ) {
- style->setMargin(QStyleSheetItem::MarginAll,0);
- }
style = stsh->item ("h2" );
if ( style ) {
style->setMargin(QStyleSheetItem::MarginAll,0);
}
style = stsh->item ("h3" );
if ( style ) {
style->setMargin(QStyleSheetItem::MarginAll,0);
}
- style = stsh->item ("table" );
- if ( style ) {
- style->setMargin(QStyleSheetItem::MarginAll,0);
- }
mEventViewer = 0;
QBoxLayout *topLayout = new QVBoxLayout(this);
// topLayout->addWidget(mDateLabel);
topLayout->addWidget(mView);
mTimer = new QTimer( this );
@@ -158,13 +150,13 @@ void KOWhatsNextView::updateView()
//qDebug("KOWhatsNextView::updateView() ");
// mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate()));
KIconLoader kil("korganizer");
QString ipath;// = new QString();
// kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath);
//<big><big><strong>" + date + "</strong></big></big>\n";
- mText = "<qt><table width=\"100%\">\n";
+ mText = "<table width=\"100%\">\n";
//mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
#ifdef DESKTOP_VERSION
mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>";
#else
mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
#endif
@@ -213,20 +205,24 @@ void KOWhatsNextView::updateView()
// mText += "<h2>";
//mText += " <img src=\"";
//mText += ipath;
//mText += "\">";
if ( ! itemAdded ) {
appendDay ( iii, mEventDate );
- itemAdded = true;
}
+ // for first day (iii == 0)
+ // we may have syncevents, or events in the past, which maybe should nor be diaplayed
+ // for that reason we cannot append <table> in appendDay () for iii == 0
+ // we must append it in the first successful call of appendEvent()
Event *ev = events.first();
while(ev) {
//qDebug("+++++event append %s", ev->summary().latin1());
if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) {
- appendEvent(ev, false , iii!= 0 );
+ if ( appendEvent(ev, false , iii!= 0,!itemAdded ) )
+ itemAdded = true;
}
ev = events.next();
}
//mText += "</table>\n";
}
@@ -239,20 +235,20 @@ void KOWhatsNextView::updateView()
itemAdded = true;
}
appendEvent(todo);
}
todo = todos.next();
}
- if ( !itemAdded && iii == 0 ) {
+ if ( !itemAdded && iii == 0 ) {
// appendDay ( iii, mEventDate );
//mText += "<table>";
// mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n";
mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do. ") +"</em></font></h3>\n";
//mText +="</table>";
}
- if ( itemAdded )
+ if ( itemAdded )
mText += "</table>\n";
mEventDate = mEventDate.addDays( 1 );
}
int topmostPrios = KOPrefs::instance()->mWhatsNextPrios;
if (todos.count() > 0 && topmostPrios > 0 ) {
@@ -340,13 +336,13 @@ void KOWhatsNextView::updateView()
to = todos.next();
}
}
if (replys > 0 ) mText += "</table>\n";
- mText += "</td></tr>\n</table></qt>\n";
+ mText += "</td></tr>\n</table>\n";
mView->setText(mText);
mView->setFocus();
// QPixmap bPix = SmallIcon( "back" );
// qDebug("xxxxxxxxxxxxxxxxxxxxx ");
@@ -354,22 +350,22 @@ void KOWhatsNextView::updateView()
// test->setBackgroundMode(FixedPixmap );
// test->setBackgroundPixmap ( bPix );
// test->resize( 300, 400 );
// test->show();
// mView->setBackgroundMode(FixedPixmap );
// mView->setBackgroundPixmap ( bPix );
- // qDebug("%s ",mText.latin1());
+ qDebug("%s ",mText.latin1());
}
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";
+ //mText += "<table>\n";
return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>";
}
else if ( i == 1 )
date = "<em><font color=\"#000080\">" + day + "</font></em>" ;
else date = "<em><font color=\"#000080\">" + day + "</font></em>";
mText += "<h2>" + date + "</h2>\n";
@@ -377,13 +373,13 @@ void KOWhatsNextView::appendDay( int i, QDate eventDate )
mText += "<table>\n";
} else {
if ( i == 0 ) {
- mText += "<table>\n";
+ //mText += "<table>\n";
return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>";
}
#ifdef DESKTOP_VERSION
else if ( i == 1 ) {
date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ;
@@ -427,24 +423,27 @@ void KOWhatsNextView::changeEventDisplay(Event *, int action)
default:
updateView();
kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl;
}
}
-void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed )
+bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable )
{
if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") )
- return;
+ return false;
QDateTime cdt = QDateTime::currentDateTime();
QDateTime noc;
QString tempText;
+ if ( appendTable && !notRed ) {
+ tempText = "<table>";
+ }
bool ok = true;
if ( reply ) {
noc = ev->getNextOccurence( cdt, &ok );
if (! ok && ev->type() == "Event")
- return;
+ return false;
}
tempText += "<tr><td><b>";
if (ev->type()=="Event") {
if (reply) {
if (!ev->doesFloat())
tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": ";
@@ -483,13 +482,13 @@ void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed )
dateText += event->dtEndTimeStr();
if ( notRed )
tempText += dateText;
else {
if ( end < cdt ) {
if ( !KOPrefs::instance()->mWNViewShowsPast )
- return;
+ return false;
tempText += "<font color=\"#F00000\">" + dateText + "</font>";
}
else if ( st < cdt )
tempText += "<font color=\"#008000\">" + dateText + "</font>";
else
tempText += dateText;
@@ -572,12 +571,13 @@ void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed )
if ( !ev->location().isEmpty() )
tempText += " ("+ev->location() +")";
if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents)
tempText += " ["+ev->relatedTo()->summary() +"]";
tempText += "</td></tr>\n";
mText += tempText;
+ return true;
}
bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
{
if ( mTodos.find( ev ) != mTodos.end() ) return false;