summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (show 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.h4
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
@@ -323,8 +323,10 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this,
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,
SLOT(saveToFile()));
@@ -379,8 +381,16 @@ KOListView::~KOListView()
delete mKOListViewWhatsThis;
#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 );
if ( item )
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index a54b550..99d0561 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -293,8 +293,9 @@ class KOListView : public KOEventView
void populateCalPopup();
protected slots:
void processSelectionChange(QListViewItem *);
+ void catChanged( Incidence* );
protected:
void writeToFile( bool iCal );
void addEvents(QPtrList<Event> eventList);
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 );
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index a41eb54..4d62e9b 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -249,11 +249,12 @@ class KOMonthView: public KOEventView
virtual QPtrList<Incidence> selectedIncidences();
/** 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; }
MonthViewCell * selectedCell();
@@ -280,8 +281,9 @@ class KOMonthView: public KOEventView
void switchView();
void setKeyBFocus();
protected slots:
+ void catChanged( Incidence * );
void setKeyBoardFocus();
void slotNewTodo();
void slotNewEvent();
void slotEditJournal();