author | zautrix <zautrix> | 2005-02-01 17:51:26 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-01 17:51:26 (UTC) |
commit | 81991bbbc7f815c82b37db654528ee3b224435dc (patch) (side-by-side diff) | |
tree | 7e556083803d359c3a598d3ecf724d1127703480 /korganizer | |
parent | b699d9cf03b5b5bb92609bcd04eef2651fe0028b (diff) | |
download | kdepimpi-81991bbbc7f815c82b37db654528ee3b224435dc.zip kdepimpi-81991bbbc7f815c82b37db654528ee3b224435dc.tar.gz kdepimpi-81991bbbc7f815c82b37db654528ee3b224435dc.tar.bz2 |
fff
-rw-r--r-- | korganizer/koagendaview.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 8c27c43..d3db89a 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -602,111 +602,112 @@ void KOAgendaView::resizeEvent( QResizeEvent* e ) mBlockUpdating = false; //mAgenda->setMinimumSize(800 , 600 ); //qDebug("mAgenda->resize+++++++++++++++ "); updateConfig(); //qDebug("KOAgendaView::Updating now possible "); } else createDayLabels(); //qDebug("resizeEvent end "); } void KOAgendaView::slotDaylabelClicked() { QString cap = ((QPushButton*) sender() )->caption(); QDate firstDate = mSelectedDates.first(); if ( cap == "0" ) emit showDateView( 6, firstDate ); else if ( cap != "last" ) { if ( mSelectedDates.count() == 1) emit showDateView( 9, firstDate.addDays( cap.toInt()-1 ) ); else emit showDateView( 3, firstDate.addDays( cap.toInt()-1 ) ); } else - showDateView( 10, firstDate.addDays(1 ) ); + showDateView( 10, firstDate.addDays(1) ); } QPushButton* KOAgendaView::getNewDaylabel() { QPushButton * dayLabel = new QPushButton(mDayLabels); dayLabel->setFlat( true ); connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) ); dayLabel->setFocusPolicy(NoFocus); dayLabel->setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); mDayLabelsList.append( dayLabel ); mLayoutDayLabels->addWidget(dayLabel); //mLayoutDayLabels->setStretchFactor(dayLabel, 100); return dayLabel ; } void KOAgendaView::createDayLabels() { if ( mBlockUpdating || globalFlagBlockLabel == 1) { // qDebug(" KOAgendaView::createDayLabels() blocked "); return; } int newHight; // ### Before deleting and recreating we could check if mSelectedDates changed... // It would remove some flickering and gain speed (since this is called by // each updateView() call) int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); if ( maxWid < 0 ) maxWid = 20; QFont dlf = KOPrefs::instance()->mTimeLabelsFont; QFontMetrics fm ( dlf ); int selCount = mSelectedDates.count(); - QString dayTest = "Mon 20"; + QString dayTest = "Won 20"; + //QString dayTest = "Mon 20"; int wid = fm.width( dayTest ); //maxWid -= ( selCount * 3 ); //working for QLabels maxWid -= ( selCount * 5 ); //working for QPushButton if ( maxWid < 0 ) maxWid = 20; int needWid = wid * selCount; //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); //if ( needWid > maxWid ) // qDebug("DAYLABELS TOOOOOOO BIG "); while ( needWid > maxWid ) { dayTest = dayTest.left( dayTest.length() - 1 ); - wid = fm.width( dayTest ); + wid = fm.width( dayTest )+1; needWid = wid * selCount; } int maxLen = dayTest.length(); int fontPoint = dlf.pointSize(); if ( maxLen < 2 ) { int fontPoint = dlf.pointSize(); while ( fontPoint > 4 ) { --fontPoint; dlf.setPointSize( fontPoint ); QFontMetrics f( dlf ); - wid = f.width( "20" )+2; + wid = f.width( "30" )+3; needWid = wid * selCount; if ( needWid < maxWid ) break; } maxLen = 2; } //qDebug("Max len %d ", dayTest.length() ); QFontMetrics tempF( dlf ); newHight = tempF.height(); mDayLabels->setFont( dlf ); // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; // mLayoutDayLabels->addSpacing(mTimeLabels->width()); //mLayoutDayLabels->addSpacing( 2 ); // QFont lFont = dlf; bool appendLabels = false; QPushButton *dayLabel; dayLabel = mDayLabelsList.first(); if ( !dayLabel ) { appendLabels = true; dayLabel = getNewDaylabel(); } dayLabel->setFixedWidth( mTimeLabels->width()+2 ); dayLabel->setFont( dlf ); @@ -976,50 +977,48 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) endDt.setDate(startDate. addDays(item->lastMultiItem()->cellX() - item->cellX())); } else { endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); endDt.setDate(startDate); } } } else { // todo qDebug("tooooodoooooo "); if (item->lastMultiItem()) { endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); endDt.setDate(startDate. addDays(item->lastMultiItem()->cellX() - item->cellX())); } else { //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); if ( item->cellYBottom() > 0 ) endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); else endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); endDt.setDate(startDate); } } } - - qDebug("to888"); if ( item->incidence()->type() == "Event" ) { item->incidence()->setDtStart(startDt); (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); } else if ( item->incidence()->type() == "Todo" ) { (static_cast<Todo*>(item->incidence()))->setDtDue(endDt); } //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); item->incidence()->setRevision(item->incidence()->revision()+1); item->setItemDate(startDt.date()); //item->updateItem(); if ( item->incidence()->type() == "Todo" ) { emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); } else emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); item->updateItem(); } void KOAgendaView::showDates( const QDate &start, const QDate &end ) { // kdDebug() << "KOAgendaView::selectDates" << endl; mSelectedDates.clear(); |