-rw-r--r-- | korganizer/kolistview.cpp | 10 | ||||
-rw-r--r-- | korganizer/kolistview.h | 1 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 35 | ||||
-rw-r--r-- | korganizer/komonthview.h | 4 |
4 files changed, 34 insertions, 16 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 1b4397f..db3f802 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -324,6 +324,8 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, SLOT( populateCalPopup() )); QObject::connect(mCalPopup,SIGNAL(activated( int )),this, SLOT( setCalendar( int ) )); + QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this, + SLOT( catChanged( Incidence * ) )); QPopupMenu * exportPO = new QPopupMenu ( this ); mPopupMenu->insertItem( i18n("Export"), exportPO ); exportPO->insertItem( i18n("As iCal (ics) file..."),this, @@ -380,6 +382,14 @@ KOListView::~KOListView() #endif } +void KOListView::catChanged( Incidence* inc) +{ + KOListViewItem* item = getItemForEvent(inc); + if (item) { + ListItemVisitor v(item, mStartDate ); + inc->accept(v); + } +} QString KOListView::getWhatsThisText(QPoint p) { KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index a54b550..99d0561 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h @@ -294,6 +294,7 @@ class KOListView : public KOEventView protected slots: void processSelectionChange(QListViewItem *); + void catChanged( Incidence* ); protected: void writeToFile( bool iCal ); diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 4fc447e..2289977 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -202,7 +202,7 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) break; } if ( count () ) { - if ( currentItem()+1 == count () ) { + if ( ((uint)currentItem()+1) == count () ) { emit nextCell(); } else { setCurrentItem((currentItem()+1)%count()); @@ -243,7 +243,7 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) void KNoScrollListBox::oneDown() { if ( count () ) { - if ( currentItem()+1 == count () ) { + if ( ((uint)currentItem()+1) == count () ) { emit nextCell(); } else { resetOnFocusIn = false; @@ -1292,6 +1292,8 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) i18n("Journal"),this, SLOT(slotEditJournal()),false); + connect (mContextMenu ,SIGNAL(categoryChanged( Incidence * )),this, + SLOT( catChanged( Incidence * ) )); QString pathString = ""; @@ -1348,6 +1350,10 @@ KOMonthView::~KOMonthView() delete mContextMenu; } +void KOMonthView::catChanged( Incidence * ) +{ + updateView(); +} void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday ) { static Incidence * lastInc = 0; @@ -1360,7 +1366,7 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int //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; @@ -1386,7 +1392,7 @@ 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) { @@ -1399,7 +1405,7 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int goLeft = false; } if ( goRight ) { - int right = index + iii; + uint right = index + iii; if ( right < count ) { if ( (*cells)[right]->doHighLight(inc) ) goRight = false; @@ -1489,7 +1495,7 @@ DateList KOMonthView::selectedDates() return selected; } - +#if 0 void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td) { @@ -1497,7 +1503,7 @@ void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, calPrinter->preview(CalPrinter::Month, fd, td); #endif } - +#endif void KOMonthView::updateConfig() { @@ -1583,7 +1589,7 @@ 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; @@ -1609,7 +1615,6 @@ 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 ); @@ -1679,7 +1684,6 @@ 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() ) { @@ -1811,6 +1815,7 @@ void KOMonthView::resizeEvent(QResizeEvent * e) slotComputeLayout(); } else mComputeLayoutTimer->start( 100 ); + KOEventView::resizeEvent( e ); } void KOMonthView::slotComputeLayout() @@ -1861,7 +1866,6 @@ void KOMonthView::computeLayoutWeek() 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; @@ -1905,7 +1909,8 @@ void KOMonthView::computeLayoutWeek() 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; @@ -1997,7 +2002,6 @@ void KOMonthView::computeLayout() 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; @@ -2032,7 +2036,8 @@ void KOMonthView::computeLayout() 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 ) { @@ -2210,7 +2215,7 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e ) void KOMonthView::nextCell() { - bool res = focusNextPrevChild ( true ); + focusNextPrevChild ( true ); } void KOMonthView::prevCell() { diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index a41eb54..4d62e9b 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -250,9 +250,10 @@ class KOMonthView: public KOEventView /** returns dates of the currently selected events */ virtual DateList selectedDates(); - +#if 0 virtual void printPreview(CalPrinter *calPrinter, const QDate &, const QDate &); +#endif bool isMonthView() { return !mShowWeekView; } bool isUpdatePossible() { return updatePossible; } @@ -281,6 +282,7 @@ class KOMonthView: public KOEventView void setKeyBFocus(); protected slots: + void catChanged( Incidence * ); void setKeyBoardFocus(); void slotNewTodo(); void slotNewEvent(); |