summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/komonthview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/komonthview.cpp35
1 files changed, 20 insertions, 15 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 4fc447e..2289977 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -201,9 +201,9 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
e->ignore();
break;
}
if ( count () ) {
- if ( currentItem()+1 == count () ) {
+ if ( ((uint)currentItem()+1) == count () ) {
emit nextCell();
} else {
setCurrentItem((currentItem()+1)%count());
if(!itemVisible(currentItem())) {
@@ -242,9 +242,9 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
void KNoScrollListBox::oneDown()
{
if ( count () ) {
- if ( currentItem()+1 == count () ) {
+ if ( ((uint)currentItem()+1) == count () ) {
emit nextCell();
} else {
resetOnFocusIn = false;
setCurrentItem((currentItem()+1)%count());
@@ -1291,8 +1291,10 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
i18n("Journal"),this,
SLOT(slotEditJournal()),false);
+ connect (mContextMenu ,SIGNAL(categoryChanged( Incidence * )),this,
+ SLOT( catChanged( Incidence * ) ));
QString pathString = "";
if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
@@ -1347,8 +1349,12 @@ KOMonthView::~KOMonthView()
{
delete mContextMenu;
}
+void KOMonthView::catChanged( Incidence * )
+{
+ updateView();
+}
void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday )
{
static Incidence * lastInc = 0;
static MonthViewCell * lastCell = 0;
@@ -1359,9 +1365,9 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int
lastCell = mc;
//qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday );
bool weekview = false;
- int index = 0;
+ uint index = 0;
for (uint i = 0; i < mCellsW.count(); ++i) {
if ( mCellsW[i] == mc ) {
weekview = true;
index = i;
@@ -1385,9 +1391,9 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int
}
if ( ! inc )
return;
- int count = (*cells).count();
+ uint count = (*cells).count();
bool goLeft = (mday > 1 && index > 0);
bool goRight = (mday < 3 && mday > 0 && index < count -1);
for (uint iii = 1; iii < count; ++iii) {
if ( goLeft ) {
@@ -1398,9 +1404,9 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int
} else
goLeft = false;
}
if ( goRight ) {
- int right = index + iii;
+ uint right = index + iii;
if ( right < count ) {
if ( (*cells)[right]->doHighLight(inc) )
goRight = false;
@@ -1488,17 +1494,17 @@ DateList KOMonthView::selectedDates()
}
return selected;
}
-
+#if 0
void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd,
const QDate &td)
{
#ifndef KORG_NOPRINTER
calPrinter->preview(CalPrinter::Month, fd, td);
#endif
}
-
+#endif
void KOMonthView::updateConfig()
{
int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
@@ -1582,9 +1588,9 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
QPtrVector<MonthViewCell> *cells;
QPtrVector<QLabel> *dayLabels;
QPtrVector<KOWeekButton> *weekLabels;
- int weekNum = 6;
+ uint weekNum = 6;
mStartDate = start;
if ( mShowWeekView ) {
weekNum = 1;
cells = &mCellsW;
@@ -1608,9 +1614,8 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) {
mStartDate = mStartDate.addDays( -1 );
}
- bool primary = false;
uint i;
for( i = 0; i < (*cells).size(); ++i ) {
QDate date = mStartDate.addDays( i );
(*cells)[i]->setDate( date );
@@ -1678,9 +1683,8 @@ void KOMonthView::updateView()
QPtrList<Event> events = calendar()->events();
Event *event;
QDateTime dt;
- bool ok;
QDate endDate = mStartDate.addDays( timeSpan );
for( event = events.first(); event; event = events.next() ) { // for event
if ( event->doesRecur() ) {
bool last;
@@ -1810,8 +1814,9 @@ void KOMonthView::resizeEvent(QResizeEvent * e)
//qDebug("KOMonthView::isVisible ");
slotComputeLayout();
} else
mComputeLayoutTimer->start( 100 );
+ KOEventView::resizeEvent( e );
}
void KOMonthView::slotComputeLayout()
{
@@ -1860,9 +1865,8 @@ void KOMonthView::computeLayoutWeek()
int weeklabelwid = fm.width( "888" );
wid -= weeklabelwid;
int colWid = wid / daysToShow;
- int lastCol = wid - ( colWid*6 );
int dayLabelHei = mDayLabelsW[0]->sizeHint().height();
int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow );
int colModulo = wid % daysToShow;
int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1;
@@ -1904,9 +1908,10 @@ void KOMonthView::computeLayoutWeek()
y= dayLabelHei;
w = colWid;
h = cellHei;
int max = 0;
- for ( i = 0; i < mCellsW.count(); ++i) {
+ int w_count = mCellsW.count();
+ for ( i = 0; i < w_count; ++i) {
if ( i > 6 ) {
mCellsW[i]->hide();
continue;
}
@@ -1996,9 +2001,8 @@ void KOMonthView::computeLayout()
int weeklabelwid = fm.width( "888" );
wid -= weeklabelwid;
int colWid = wid / daysToShow;
- int lastCol = wid - ( colWid*6 );
int dayLabelHei = mDayLabels[0]->sizeHint().height();
int cellHei = (hei - dayLabelHei) /6;
int colModulo = wid % daysToShow;
int rowModulo = (hei- dayLabelHei) % 6;
@@ -2031,9 +2035,10 @@ void KOMonthView::computeLayout()
y= dayLabelHei;
w = colWid;
h = cellHei ;
int max = 0;
- for ( i = 0; i < mCells.count(); ++i) {
+ int mc_count = mCells.count();
+ for ( i = 0; i < mc_count; ++i) {
//qDebug("iii %d ", i);
w = colWid;
if ( ((i) % 7) >= 7-colModulo ) {
++w;
@@ -2209,9 +2214,9 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
}
void KOMonthView::nextCell()
{
- bool res = focusNextPrevChild ( true );
+ focusNextPrevChild ( true );
}
void KOMonthView::prevCell()
{
focusNextPrevChild ( false );