-rw-r--r-- | korganizer/koagendaview.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 6428757..b5596d9 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -203,3 +203,38 @@ void TimeLabels::setAgenda(KOAgenda* agenda) } + +void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) +{ + mMouseDownY = e->pos().y(); +} + +void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) +{ + int diff = mMouseDownY - e->pos().y(); + if ( diff < 10 && diff > -10 ) + return; + int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; + if ( tSize < 4 ) + tSize = 4; + if ( tSize > 18 ) + tSize = 18; + tSize = (tSize-2)/2; + topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); +} +void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) +{ + int diff = mMouseDownY - e->pos().y(); + if ( diff < 10 && diff > -10 ) + return; + int tSize = KOPrefs::instance()->mHourSize + (diff/10); + if ( tSize < 4 ) + tSize = 4; + if ( tSize > 18 ) + tSize = 18; + tSize = (tSize/2)*2; + if ( tSize == KOPrefs::instance()->mHourSize ) + return; + KOPrefs::instance()->mHourSize = tSize; + emit scaleChanged(); +} @@ -412,2 +447,4 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : agendaLayout->addWidget(mTimeLabels,1,0); + connect(mTimeLabels,SIGNAL( scaleChanged()), + this,SLOT(updateConfig())); |