summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-02-02 19:56:42 (UTC)
committer zautrix <zautrix>2005-02-02 19:56:42 (UTC)
commit20191b4c5acf30282436a7f7215719f7b2ec8b01 (patch) (side-by-side diff)
treedd7ab3caab6d06a09200b3b45c37e98a977ccaff /korganizer
parentf94c5075fdd356c7a73b23150287034216ef0bdf (diff)
downloadkdepimpi-20191b4c5acf30282436a7f7215719f7b2ec8b01.zip
kdepimpi-20191b4c5acf30282436a7f7215719f7b2ec8b01.tar.gz
kdepimpi-20191b4c5acf30282436a7f7215719f7b2ec8b01.tar.bz2
ccc
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp47
-rw-r--r--korganizer/koagendaview.h1
2 files changed, 45 insertions, 3 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index c018dc7..f8301f8 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -419,30 +419,30 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
else
widebut = (widebut*3) / 2;
//mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed,
// QSizePolicy::Fixed ) );
mExpandButton->setFixedSize( widebut, widebut);
connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) );
mExpandButton->setFocusPolicy(NoFocus);
mAllDayAgenda = new KOAgenda(1,mAllDayFrame);
mAllDayAgenda->setFocusPolicy(NoFocus);
QVBox *dummyAllDayRight = new QVBox(mAllDayFrame);
QPushButton *dummyAllDayRightB = new QPushButton(dummyAllDayRight);
- QLabel * dummyAllDayRightL = new QLabel ( dummyAllDayRight );
+ mDummyAllDayRightL = new QLabel ( dummyAllDayRight );
dummyAllDayRightB->setFlat( true );
dummyAllDayRightB->setFocusPolicy(NoFocus);
// dummyAllDayRightB->setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding ));
- //dummyAllDayRightB->setFixedHeight( dummyAllDayRightB->sizeHint().height()/2 );
+ dummyAllDayRightB->setFixedHeight( (dummyAllDayRightB->sizeHint().height()/4)*3 );
QPopupMenu * wpo = new QPopupMenu (this);
wpo->insertItem( i18n("W#"), 0 );
int i;
for ( i = 1; i < 53; i++ )
wpo->insertItem( QString::number( i ),i );
//Qt bug - we must add some empty fields...
for ( i = 53; i < 54; ++i ) {
wpo->insertItem( "", 52 );
}
dummyAllDayRightB->setPopup( wpo );
connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) );
@@ -569,24 +569,37 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
SIGNAL( incidenceSelected( Incidence * ) ) );
connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
SIGNAL( incidenceSelected( Incidence * ) ) );
connect( mAgenda, SIGNAL( resizedSignal() ),
SLOT( updateConfig( ) ) );
connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ),
SLOT( addToCalSlot(Incidence *, Incidence * ) ) );
connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ),
SLOT( addToCalSlot(Incidence * , Incidence *) ) );
// connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
//connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
+ QFont dlf = KOPrefs::instance()->mTimeLabelsFont;
+ QFontMetrics fm ( dlf );
+ QString dayTest = "30";
+ int wid = fm.width( dayTest );
+ int maxWid = dummyAllDayRight->width();
+ int fontPoint = dlf.pointSize();
+ while ( wid > maxWid ) {
+ --fontPoint;
+ dlf.setPointSize( fontPoint );
+ QFontMetrics f( dlf );
+ wid = f.width( dayTest );
+ }
+ mDummyAllDayRightL->setFont( dlf );
}
void KOAgendaView::toggleAllDay()
{
if ( mSplitterAgenda->firstHandle() )
mSplitterAgenda->firstHandle()->toggle();
}
void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld )
{
calendar()->addIncidence( inc );
@@ -909,25 +922,26 @@ void KOAgendaView::updateView()
}
/*
Update configuration settings for the agenda view. This method is not
complete.
*/
void KOAgendaView::updateConfig()
{
if ( mBlockUpdating )
return;
- // kdDebug() << "KOAgendaView::updateConfig()" << endl;
+
+
// update config for children
mTimeLabels->updateConfig();
mAgenda->storePosition();
mAgenda->updateConfig();
mAllDayAgenda->updateConfig();
// widget synchronization
//TODO: find a better way, maybe signal/slot
mTimeLabels->positionChanged();
// for some reason, this needs to be called explicitly
mTimeLabels->repaint();
@@ -1075,24 +1089,51 @@ void KOAgendaView::fillAgenda()
if ( globalFlagBlockStartup )
return;
if ( globalFlagBlockAgenda == 1 )
return;
//if ( globalFlagBlockAgenda == 2 )
//globalFlagBlockAgenda = 0;
// globalFlagBlockPainting = false;
if ( globalFlagBlockAgenda == 0 )
globalFlagBlockAgenda = 1;
// clearView();
//qDebug("fillAgenda()++++ ");
globalFlagBlockAgendaItemPaint = 1;
+
+ int weekNum = 0;
+ QDate seda = mSelectedDates.first();
+ QDate d = QDate ( seda.year(), 1,1);
+ seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday
+ if ( seda.addDays(6).year() != seda.year() ) {
+ if ( seda.year() != d.year() ) {
+ if ( d.dayOfWeek() > 4 )
+ d = QDate ( seda.year(), 1,1);
+ else
+ weekNum = 1;
+ } else {
+ QDate dd( seda.year()+1, 1,1);
+ if ( dd.dayOfWeek() <= 4 )
+ weekNum = 1;
+ }
+ }
+ if ( weekNum == 0 ){
+ int dow = d.dayOfWeek();
+ if ( dow <= 4 )
+ d = d.addDays( 1-dow );
+ else // 5,6,7
+ d = d.addDays( 8-dow );
+ // we have the first week of the year.we are on monday
+ weekNum = d.daysTo( seda ) / 7 +1;
+ }
+ mDummyAllDayRightL->setText( QString::number( weekNum) );
mAllDayAgenda->changeColumns(mSelectedDates.count());
mAgenda->changeColumns(mSelectedDates.count());
qApp->processEvents();
mEventIndicatorTop->changeColumns(mSelectedDates.count());
mEventIndicatorBottom->changeColumns(mSelectedDates.count());
setHolidayMasks();
//mAgenda->hideUnused();
//mAllDayAgenda->hideUnused();
// mAgenda->blockNextRepaint( false );
// mAgenda->viewport()->repaint();
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index 4a058ce..ba9bc93 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -207,24 +207,25 @@ class KOAgendaView : public KOEventView {
void addToCalSlot(Incidence *, Incidence *);
signals:
void showDateView( int, QDate );
void newTodoSignal( QDateTime ,bool );
void toggleExpand();
void selectWeekNum( int );
void todoMoved( Todo *, int );
void incidenceChanged(Incidence * , int );
// void cloneIncidenceSignal(Incidence *);
protected:
+ QLabel * mDummyAllDayRightL;
KOAgendaButton* getNewDaylabel();
bool mBlockUpdating;
int mUpcomingWidth;
/** Fill agenda beginning with date startDate */
void fillAgenda(const QDate &startDate);
void resizeEvent( QResizeEvent* e );
/** Fill agenda using the current set value for the start date */
void fillAgenda();
/** Create labels for the selected dates. */
void createDayLabels();