summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp10
-rw-r--r--korganizer/kolistview.h1
-rw-r--r--korganizer/komonthview.cpp35
-rw-r--r--korganizer/komonthview.h6
4 files changed, 35 insertions, 17 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,
324 SLOT( populateCalPopup() )); 324 SLOT( populateCalPopup() ));
325 QObject::connect(mCalPopup,SIGNAL(activated( int )),this, 325 QObject::connect(mCalPopup,SIGNAL(activated( int )),this,
326 SLOT( setCalendar( int ) )); 326 SLOT( setCalendar( int ) ));
327 QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this,
328 SLOT( catChanged( Incidence * ) ));
327 QPopupMenu * exportPO = new QPopupMenu ( this ); 329 QPopupMenu * exportPO = new QPopupMenu ( this );
328 mPopupMenu->insertItem( i18n("Export"), exportPO ); 330 mPopupMenu->insertItem( i18n("Export"), exportPO );
329 exportPO->insertItem( i18n("As iCal (ics) file..."),this, 331 exportPO->insertItem( i18n("As iCal (ics) file..."),this,
@@ -380,6 +382,14 @@ KOListView::~KOListView()
380#endif 382#endif
381} 383}
382 384
385void KOListView::catChanged( Incidence* inc)
386{
387 KOListViewItem* item = getItemForEvent(inc);
388 if (item) {
389 ListItemVisitor v(item, mStartDate );
390 inc->accept(v);
391 }
392}
383QString KOListView::getWhatsThisText(QPoint p) 393QString KOListView::getWhatsThisText(QPoint p)
384{ 394{
385 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 395 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
294 294
295 protected slots: 295 protected slots:
296 void processSelectionChange(QListViewItem *); 296 void processSelectionChange(QListViewItem *);
297 void catChanged( Incidence* );
297 298
298 protected: 299 protected:
299 void writeToFile( bool iCal ); 300 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)
202 break; 202 break;
203 } 203 }
204 if ( count () ) { 204 if ( count () ) {
205 if ( currentItem()+1 == count () ) { 205 if ( ((uint)currentItem()+1) == count () ) {
206 emit nextCell(); 206 emit nextCell();
207 } else { 207 } else {
208 setCurrentItem((currentItem()+1)%count()); 208 setCurrentItem((currentItem()+1)%count());
@@ -243,7 +243,7 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
243void KNoScrollListBox::oneDown() 243void KNoScrollListBox::oneDown()
244{ 244{
245 if ( count () ) { 245 if ( count () ) {
246 if ( currentItem()+1 == count () ) { 246 if ( ((uint)currentItem()+1) == count () ) {
247 emit nextCell(); 247 emit nextCell();
248 } else { 248 } else {
249 resetOnFocusIn = false; 249 resetOnFocusIn = false;
@@ -1292,6 +1292,8 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1292 i18n("Journal"),this, 1292 i18n("Journal"),this,
1293 SLOT(slotEditJournal()),false); 1293 SLOT(slotEditJournal()),false);
1294 1294
1295 connect (mContextMenu ,SIGNAL(categoryChanged( Incidence * )),this,
1296 SLOT( catChanged( Incidence * ) ));
1295 1297
1296 1298
1297 QString pathString = ""; 1299 QString pathString = "";
@@ -1348,6 +1350,10 @@ KOMonthView::~KOMonthView()
1348 delete mContextMenu; 1350 delete mContextMenu;
1349} 1351}
1350 1352
1353void KOMonthView::catChanged( Incidence * )
1354{
1355 updateView();
1356}
1351void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday ) 1357void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday )
1352{ 1358{
1353 static Incidence * lastInc = 0; 1359 static Incidence * lastInc = 0;
@@ -1360,7 +1366,7 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int
1360 //qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); 1366 //qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday );
1361 1367
1362 bool weekview = false; 1368 bool weekview = false;
1363 int index = 0; 1369 uint index = 0;
1364 for (uint i = 0; i < mCellsW.count(); ++i) { 1370 for (uint i = 0; i < mCellsW.count(); ++i) {
1365 if ( mCellsW[i] == mc ) { 1371 if ( mCellsW[i] == mc ) {
1366 weekview = true; 1372 weekview = true;
@@ -1386,7 +1392,7 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int
1386 if ( ! inc ) 1392 if ( ! inc )
1387 return; 1393 return;
1388 1394
1389 int count = (*cells).count(); 1395 uint count = (*cells).count();
1390 bool goLeft = (mday > 1 && index > 0); 1396 bool goLeft = (mday > 1 && index > 0);
1391 bool goRight = (mday < 3 && mday > 0 && index < count -1); 1397 bool goRight = (mday < 3 && mday > 0 && index < count -1);
1392 for (uint iii = 1; iii < count; ++iii) { 1398 for (uint iii = 1; iii < count; ++iii) {
@@ -1399,7 +1405,7 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int
1399 goLeft = false; 1405 goLeft = false;
1400 } 1406 }
1401 if ( goRight ) { 1407 if ( goRight ) {
1402 int right = index + iii; 1408 uint right = index + iii;
1403 if ( right < count ) { 1409 if ( right < count ) {
1404 if ( (*cells)[right]->doHighLight(inc) ) 1410 if ( (*cells)[right]->doHighLight(inc) )
1405 goRight = false; 1411 goRight = false;
@@ -1489,7 +1495,7 @@ DateList KOMonthView::selectedDates()
1489 1495
1490 return selected; 1496 return selected;
1491} 1497}
1492 1498#if 0
1493void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1499void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1494 const QDate &td) 1500 const QDate &td)
1495{ 1501{
@@ -1497,7 +1503,7 @@ void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1497 calPrinter->preview(CalPrinter::Month, fd, td); 1503 calPrinter->preview(CalPrinter::Month, fd, td);
1498#endif 1504#endif
1499} 1505}
1500 1506#endif
1501void KOMonthView::updateConfig() 1507void KOMonthView::updateConfig()
1502{ 1508{
1503 1509
@@ -1583,7 +1589,7 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
1583 QPtrVector<MonthViewCell> *cells; 1589 QPtrVector<MonthViewCell> *cells;
1584 QPtrVector<QLabel> *dayLabels; 1590 QPtrVector<QLabel> *dayLabels;
1585 QPtrVector<KOWeekButton> *weekLabels; 1591 QPtrVector<KOWeekButton> *weekLabels;
1586 int weekNum = 6; 1592 uint weekNum = 6;
1587 mStartDate = start; 1593 mStartDate = start;
1588 if ( mShowWeekView ) { 1594 if ( mShowWeekView ) {
1589 weekNum = 1; 1595 weekNum = 1;
@@ -1609,7 +1615,6 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
1609 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { 1615 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) {
1610 mStartDate = mStartDate.addDays( -1 ); 1616 mStartDate = mStartDate.addDays( -1 );
1611 } 1617 }
1612 bool primary = false;
1613 uint i; 1618 uint i;
1614 for( i = 0; i < (*cells).size(); ++i ) { 1619 for( i = 0; i < (*cells).size(); ++i ) {
1615 QDate date = mStartDate.addDays( i ); 1620 QDate date = mStartDate.addDays( i );
@@ -1679,7 +1684,6 @@ void KOMonthView::updateView()
1679 QPtrList<Event> events = calendar()->events(); 1684 QPtrList<Event> events = calendar()->events();
1680 Event *event; 1685 Event *event;
1681 QDateTime dt; 1686 QDateTime dt;
1682 bool ok;
1683 QDate endDate = mStartDate.addDays( timeSpan ); 1687 QDate endDate = mStartDate.addDays( timeSpan );
1684 for( event = events.first(); event; event = events.next() ) { // for event 1688 for( event = events.first(); event; event = events.next() ) { // for event
1685 if ( event->doesRecur() ) { 1689 if ( event->doesRecur() ) {
@@ -1811,6 +1815,7 @@ void KOMonthView::resizeEvent(QResizeEvent * e)
1811 slotComputeLayout(); 1815 slotComputeLayout();
1812 } else 1816 } else
1813 mComputeLayoutTimer->start( 100 ); 1817 mComputeLayoutTimer->start( 100 );
1818 KOEventView::resizeEvent( e );
1814} 1819}
1815 1820
1816void KOMonthView::slotComputeLayout() 1821void KOMonthView::slotComputeLayout()
@@ -1861,7 +1866,6 @@ void KOMonthView::computeLayoutWeek()
1861 wid -= weeklabelwid; 1866 wid -= weeklabelwid;
1862 1867
1863 int colWid = wid / daysToShow; 1868 int colWid = wid / daysToShow;
1864 int lastCol = wid - ( colWid*6 );
1865 int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); 1869 int dayLabelHei = mDayLabelsW[0]->sizeHint().height();
1866 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); 1870 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow );
1867 int colModulo = wid % daysToShow; 1871 int colModulo = wid % daysToShow;
@@ -1905,7 +1909,8 @@ void KOMonthView::computeLayoutWeek()
1905 w = colWid; 1909 w = colWid;
1906 h = cellHei; 1910 h = cellHei;
1907 int max = 0; 1911 int max = 0;
1908 for ( i = 0; i < mCellsW.count(); ++i) { 1912 int w_count = mCellsW.count();
1913 for ( i = 0; i < w_count; ++i) {
1909 if ( i > 6 ) { 1914 if ( i > 6 ) {
1910 mCellsW[i]->hide(); 1915 mCellsW[i]->hide();
1911 continue; 1916 continue;
@@ -1997,7 +2002,6 @@ void KOMonthView::computeLayout()
1997 wid -= weeklabelwid; 2002 wid -= weeklabelwid;
1998 2003
1999 int colWid = wid / daysToShow; 2004 int colWid = wid / daysToShow;
2000 int lastCol = wid - ( colWid*6 );
2001 int dayLabelHei = mDayLabels[0]->sizeHint().height(); 2005 int dayLabelHei = mDayLabels[0]->sizeHint().height();
2002 int cellHei = (hei - dayLabelHei) /6; 2006 int cellHei = (hei - dayLabelHei) /6;
2003 int colModulo = wid % daysToShow; 2007 int colModulo = wid % daysToShow;
@@ -2032,7 +2036,8 @@ void KOMonthView::computeLayout()
2032 w = colWid; 2036 w = colWid;
2033 h = cellHei ; 2037 h = cellHei ;
2034 int max = 0; 2038 int max = 0;
2035 for ( i = 0; i < mCells.count(); ++i) { 2039 int mc_count = mCells.count();
2040 for ( i = 0; i < mc_count; ++i) {
2036 //qDebug("iii %d ", i); 2041 //qDebug("iii %d ", i);
2037 w = colWid; 2042 w = colWid;
2038 if ( ((i) % 7) >= 7-colModulo ) { 2043 if ( ((i) % 7) >= 7-colModulo ) {
@@ -2210,7 +2215,7 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
2210 2215
2211void KOMonthView::nextCell() 2216void KOMonthView::nextCell()
2212{ 2217{
2213 bool res = focusNextPrevChild ( true ); 2218 focusNextPrevChild ( true );
2214} 2219}
2215void KOMonthView::prevCell() 2220void KOMonthView::prevCell()
2216{ 2221{
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index a41eb54..4d62e9b 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -196,7 +196,7 @@ public slots:
196 void showDay(); 196 void showDay();
197 void deHighLight(); 197 void deHighLight();
198 void repaintfinishUpdateCell(); 198 void repaintfinishUpdateCell();
199 protected slots: 199 protected slots:
200 void defaultAction( QListBoxItem * ); 200 void defaultAction( QListBoxItem * );
201 void contextMenu( QListBoxItem * ); 201 void contextMenu( QListBoxItem * );
202 void selection( QListBoxItem * ); 202 void selection( QListBoxItem * );
@@ -250,9 +250,10 @@ class KOMonthView: public KOEventView
250 250
251 /** returns dates of the currently selected events */ 251 /** returns dates of the currently selected events */
252 virtual DateList selectedDates(); 252 virtual DateList selectedDates();
253 253#if 0
254 virtual void printPreview(CalPrinter *calPrinter, 254 virtual void printPreview(CalPrinter *calPrinter,
255 const QDate &, const QDate &); 255 const QDate &, const QDate &);
256#endif
256 bool isMonthView() { return !mShowWeekView; } 257 bool isMonthView() { return !mShowWeekView; }
257 bool isUpdatePossible() { return updatePossible; } 258 bool isUpdatePossible() { return updatePossible; }
258 259
@@ -281,6 +282,7 @@ class KOMonthView: public KOEventView
281 void setKeyBFocus(); 282 void setKeyBFocus();
282 283
283 protected slots: 284 protected slots:
285 void catChanged( Incidence * );
284 void setKeyBoardFocus(); 286 void setKeyBoardFocus();
285 void slotNewTodo(); 287 void slotNewTodo();
286 void slotNewEvent(); 288 void slotNewEvent();