summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.cpp
authorzautrix <zautrix>2005-07-02 17:31:20 (UTC)
committer zautrix <zautrix>2005-07-02 17:31:20 (UTC)
commit0233482f5f4baf7a0af45229b02c5deaab17a412 (patch) (side-by-side diff)
treef22927da2ae116c53dc87026ce60b56704309e56 /korganizer/komonthview.cpp
parent78866028c185f4227bfb653ee2050d7feb2e2b78 (diff)
downloadkdepimpi-0233482f5f4baf7a0af45229b02c5deaab17a412.zip
kdepimpi-0233482f5f4baf7a0af45229b02c5deaab17a412.tar.gz
kdepimpi-0233482f5f4baf7a0af45229b02c5deaab17a412.tar.bz2
mv warnings removed
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
@@ -193,25 +193,25 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
setTopItem(topItem()-1);
}
}
}
}
break;
case Key_Down:
if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
e->ignore();
break;
}
if ( count () ) {
- if ( currentItem()+1 == count () ) {
+ if ( ((uint)currentItem()+1) == count () ) {
emit nextCell();
} else {
setCurrentItem((currentItem()+1)%count());
if(!itemVisible(currentItem())) {
if(currentItem() == 0) {
setTopItem(0);
} else {
setTopItem(topItem()+1);
}
}
}
}
@@ -234,25 +234,25 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
case Key_Shift:
emit shiftDown();
break;
default:
e->ignore();
break;
}
}
void KNoScrollListBox::oneDown()
{
if ( count () ) {
- if ( currentItem()+1 == count () ) {
+ if ( ((uint)currentItem()+1) == count () ) {
emit nextCell();
} else {
resetOnFocusIn = false;
setCurrentItem((currentItem()+1)%count());
if(!itemVisible(currentItem())) {
if(currentItem() == 0) {
setTopItem(0);
} else {
setTopItem(topItem()+1);
}
}
}
@@ -1283,24 +1283,26 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
//connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) );
mContextMenu = eventPopup();
mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
i18n("New Event..."),this,
SLOT(slotNewEvent()),false);
mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
i18n("New Todo..."),this,
SLOT(slotNewTodo()),false);
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 ) {
if ( QApplication::desktop()->width() < 480 )
pathString += "icons16/";
} else
pathString += "iconsmini/";
mNewItemMenu = new QPopupMenu( this );
mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent()));
mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false);
mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false);
@@ -1339,37 +1341,41 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
if ( mShowWeekView )
mWidStack->raiseWidget( mWeekView );
else
mWidStack->raiseWidget( mMonthView );
}
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;
if ( lastInc == inc && lastCell == mc )
return;
lastInc = inc;
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;
break;
}
}
QPtrVector<MonthViewCell> *cells;
if ( weekview )
cells = &mCellsW;
else {
for (uint i = 0; i < mCells.count(); ++i) {
@@ -1377,38 +1383,38 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int
index = i;
break;
}
}
cells = &mCells;
}
for (uint i = 0; i < (*cells).count(); ++i) {
(*cells)[i]->deHighLight();
}
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 ) {
int left = index - iii;
if ( left >= 0 ) {
if ( (*cells)[(uint)left]->doHighLight(inc) )
goLeft = false;
} else
goLeft = false;
}
if ( goRight ) {
- int right = index + iii;
+ uint right = index + iii;
if ( right < count ) {
if ( (*cells)[right]->doHighLight(inc) )
goRight = false;
} else
goRight = false;
}
}
#if 0
if ( mday > 1 && index > 0 )
for (int i = index-1; i >= 0; --i) {
@@ -1480,33 +1486,33 @@ QPtrList<Incidence> KOMonthView::selectedIncidences()
DateList KOMonthView::selectedDates()
{
DateList selected;
if ( mSelectedCell ) {
QDate qd = mSelectedCell->selectedIncidenceDate();
if ( qd.isValid() ) selected.append( qd );
}
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();
if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) {
mWeekStartsMonday = true;
}
QFontMetrics fontmetric(mDayLabels[0]->font());
mWidthLongDayLabel = 0;
for (int i = 0; i < 7; i++) {
@@ -1574,25 +1580,25 @@ void KOMonthView::clearList()
}
for( i = 0; i < mCellsW.size(); ++i ) {
mCellsW[i]->clear();
}
}
void KOMonthView::showDates(const QDate &start, const QDate &)
{
// kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl;
QPtrVector<MonthViewCell> *cells;
QPtrVector<QLabel> *dayLabels;
QPtrVector<KOWeekButton> *weekLabels;
- int weekNum = 6;
+ uint weekNum = 6;
mStartDate = start;
if ( mShowWeekView ) {
weekNum = 1;
cells = &mCellsW;
dayLabels = &mDayLabelsW;
weekLabels = &mWeekLabelsW;
if ( !KGlobal::locale()->weekStartsMonday() ) {
mStartDate = mStartDate.addDays( 1 );
}
} else {
cells = &mCells;
dayLabels = &mDayLabels;
@@ -1600,25 +1606,24 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
}
int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) {
mWeekStartsMonday = true;
}
int startWeekDay = mWeekStartsMonday ? 1 : 7;
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 );
#ifndef KORG_NOPLUGINS
// add holiday, if present
QString hstring(KOCore::self()->holiday(date));
(*cells)[i]->setHoliday( hstring );
#endif
}
@@ -1670,25 +1675,24 @@ void KOMonthView::updateView()
#if 1
int i;
int timeSpan = (*cells).size()-1;
if ( KOPrefs::instance()->mMonthViewWeek )
timeSpan = 6;
for( i = 0; i < timeSpan + 1; ++i ) {
(*cells)[i]->startUpdateCell();
}
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;
QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last );
QDateTime incidenceEnd;
int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() );
bool invalid = false;
while( true ) {
if ( incidenceStart.isValid() ) {
incidenceEnd = incidenceStart.addDays( eventlen );
int st = incidenceStart.date().daysTo( endDate );
@@ -1802,24 +1806,25 @@ void KOMonthView::setKeyBFocus()
//qDebug("KOMonthView::setKeyBFocus() ");
mKBFcounter = 10;
QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) );
}
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 ( isVisible() ) {
//qDebug("KOMonthView::isVisible ");
slotComputeLayout();
} else
mComputeLayoutTimer->start( 100 );
+ KOEventView::resizeEvent( e );
}
void KOMonthView::slotComputeLayout()
{
mComputeLayoutTimer->stop();
//qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() );
computeLayout();
clPending = true;
setKeyBFocus();
}
void KOMonthView::computeLayoutWeek()
{
@@ -1852,25 +1857,24 @@ void KOMonthView::computeLayoutWeek()
daysToShow = 2;
else
daysToShow = 3;
mShowSatSunComp = true;
combinedSatSun = true;
//qDebug("KOMonthView::computeLayout() WWW ------------------------------------ ");
QFontMetrics fm ( mWeekLabels[0]->font() );
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;
//qDebug("rowmod %d ", rowModulo);
int i;
int x,y,w,h;
x= 0;
y= 0;
w = colWid;
h = dayLabelHei ;
for ( i = 0; i < 7; i++) {
@@ -1896,25 +1900,26 @@ void KOMonthView::computeLayoutWeek()
if ( !(( i+1) % daysToShow)) {
wi = width() - x - weeklabelwid;
}
mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h);
}
x += w;
}
x= 0;
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;
}
w = colWid;
if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
++w;
}
if ( i == (daysToShow-1-rowModulo)*7)
++h;
@@ -1988,25 +1993,24 @@ void KOMonthView::computeLayout()
//qDebug("KOMonthview::No compute layout needed ");
return;
}
lastWid = width();
lastHei = height();
//qDebug("KOMonthView::computeLayout() MMM ------------------- ");
QFontMetrics fm ( mWeekLabels[0]->font() );
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;
//qDebug("rowmod %d ", rowModulo);
int i;
int x,y,w,h;
x= 0;
y= 0;
w = colWid;
h = dayLabelHei ;
for ( i = 0; i < 7; i++) {
@@ -2023,25 +2027,26 @@ void KOMonthView::computeLayout()
}
else
mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
} else
mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
x += w;
}
x= 0;
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;
}
if ( i == (6-rowModulo)*7)
++h;
if ( combinedSatSun ) {
if ( (i)%7 >= daysToShow-1 ) {
if ( (i)%7 == daysToShow-1 ) {
w = width()-x-weeklabelwid;
max = h/2;
@@ -2201,25 +2206,25 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
} else {
e->ignore();
}
break;
default:
e->ignore();
break;
}
}
void KOMonthView::nextCell()
{
- bool res = focusNextPrevChild ( true );
+ focusNextPrevChild ( true );
}
void KOMonthView::prevCell()
{
focusNextPrevChild ( false );
}
void KOMonthView::slotNewTodo()
{
//qDebug("KOMonthView::slotNewTodo() ");
if ( mPopupCell ){
QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
emit newTodoSignal(dt,true);