summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/komonthview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp96
1 files changed, 54 insertions, 42 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 5926abe..ffb2e1e 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -93,5 +93,5 @@ QString KNoScrollListBox::getWhatsThisText(QPoint p)
QListBoxItem* item = itemAt ( p );
if ( ! item ) {
- return i18n("Click in the cell\nto add an event!");
+ return i18n("Click in the cell\nto add an event!");
}
return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence());
@@ -320,5 +320,5 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
SLOT( contextMenu( QListBoxItem * ) ) );
connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ),
- SLOT( selection( QListBoxItem * ) ) );
+ SLOT( selection( QListBoxItem * ) ) );
connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ),
SLOT( cellClicked( QListBoxItem * ) ) );
@@ -553,41 +553,42 @@ void MonthViewCell::insertEvent(Event *event)
void MonthViewCell::insertTodo(Todo *todo)
{
- QString text;
- if (todo->hasDueDate()) {
- if (!todo->doesFloat()) {
- text += KGlobal::locale()->formatTime(todo->dtDue().time());
- text += " ";
- }
+ QString text;
+ mItemList->setFocusPolicy(WheelFocus);
+ if (todo->hasDueDate()) {
+ if (!todo->doesFloat()) {
+ text += KGlobal::locale()->formatTime(todo->dtDue().time());
+ text += " ";
}
- text += i18n("Td: %1").arg(todo->summary());
-
- MonthViewItem *item = new MonthViewItem( todo, mDate, text );
- //item->setPalette( mStandardPalette );
- QPalette pal;
- if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
- QStringList categories = todo->categories();
- QString cat = categories.first();
- if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
- pal = getPalette();
- if (cat.isEmpty()) {
- pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
- } else {
- pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
- }
-
+ }
+ text += i18n("T: %1").arg(todo->summary());
+
+ MonthViewItem *item = new MonthViewItem( todo, mDate, text );
+ //item->setPalette( mStandardPalette );
+ QPalette pal;
+ if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
+ QStringList categories = todo->categories();
+ QString cat = categories.first();
+ if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
+ pal = getPalette();
+ if (cat.isEmpty()) {
+ pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
} else {
- if (cat.isEmpty()) {
- pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
- } else {
- pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
- }
+ pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
}
-
+
} else {
- pal = mStandardPalette ;
+ if (cat.isEmpty()) {
+ pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
+ } else {
+ pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
+ }
}
- item->setPalette( pal );
- mItemList->insertItem( item );
- mToolTip += text+"\n";
+
+ } else {
+ pal = mStandardPalette ;
+ }
+ item->setPalette( pal );
+ mItemList->insertItem( item );
+ mToolTip += text+"\n";
}
void MonthViewCell::finishUpdateCell()
@@ -783,5 +784,4 @@ void MonthViewCell::selection( QListBoxItem *item )
{
if ( !item ) return;
-
mMonthView->setSelectedCell( this );
}
@@ -1266,7 +1266,13 @@ void KOMonthView::resizeEvent(QResizeEvent * e)
qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
if ( ignoreResizeEvent ) {
- qDebug("KOMonthView::resizeEvent ignored ");
- --ignoreResizeEvent;
- return;
+ int diff = e->size().height() - e->oldSize().height();
+ if ( diff < 0 )
+ diff = diff * (-1);
+ if ( diff == ignoreResizeEventHeight ) {
+ qDebug("KOMonthView::resizeEvent ignored ");
+ --ignoreResizeEvent;
+ return;
+ }
+ ignoreResizeEvent = 0;
}
if ( e->size().width()+ e->size().height() < 240 )
@@ -1512,5 +1518,5 @@ MonthViewCell * KOMonthView::selectedCell( )
void KOMonthView::setSelectedCell( MonthViewCell *cell )
{
- // qDebug("KOMonthView::setSelectedCell ");
+ //qDebug("KOMonthView::setSelectedCell %x ", cell);
if ( mSelectedCell && mSelectedCell != cell ) {
MonthViewCell * mvc = mSelectedCell;
@@ -1551,5 +1557,8 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
{
emit prevMonth();
- mCells[0]->setFocus();
+ if ( mShowWeekView )
+ mCellsW[0]->setFocus();
+ else
+ mCells[0]->setFocus();
}
e->accept();
@@ -1558,6 +1567,9 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
{
emit nextMonth();
- mCells[0]->setFocus();
-
+ if ( mShowWeekView )
+ mCellsW[0]->setFocus();
+ else
+ mCells[0]->setFocus();
+
}
e->accept();