summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaview.cpp
authorzautrix <zautrix>2005-02-01 19:32:20 (UTC)
committer zautrix <zautrix>2005-02-01 19:32:20 (UTC)
commit0eca34f0a8a02787dccad1b37e0c2e01af734e56 (patch) (side-by-side diff)
tree721cf4dfd0b29695a8b648e7eb6666ee4020c19b /korganizer/koagendaview.cpp
parent81991bbbc7f815c82b37db654528ee3b224435dc (diff)
downloadkdepimpi-0eca34f0a8a02787dccad1b37e0c2e01af734e56.zip
kdepimpi-0eca34f0a8a02787dccad1b37e0c2e01af734e56.tar.gz
kdepimpi-0eca34f0a8a02787dccad1b37e0c2e01af734e56.tar.bz2
very good fix
Diffstat (limited to 'korganizer/koagendaview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp45
1 files changed, 21 insertions, 24 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index d3db89a..c8cef44 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -75,8 +75,10 @@ extern int globalFlagBlockAgendaItemPaint;
extern int globalFlagBlockAgendaItemUpdate;
extern int globalFlagBlockLabel;
using namespace KOrg;
+
+
TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) :
QScrollView(parent,name,f)
{
mRows = rows;
@@ -608,36 +610,31 @@ void KOAgendaView::resizeEvent( QResizeEvent* e )
createDayLabels();
//qDebug("resizeEvent end ");
}
-void KOAgendaView::slotDaylabelClicked()
+void KOAgendaView::slotDaylabelClicked( int num )
{
- QString cap = ((QPushButton*) sender() )->caption();
-
+
QDate firstDate = mSelectedDates.first();
- if ( cap == "0" )
+ if ( num == -1 )
emit showDateView( 6, firstDate );
- else if ( cap != "last" ) {
+ else if (num >= 0 ) {
if ( mSelectedDates.count() == 1)
- emit showDateView( 9, firstDate.addDays( cap.toInt()-1 ) );
+ emit showDateView( 9, firstDate.addDays( num ) );
else
- emit showDateView( 3, firstDate.addDays( cap.toInt()-1 ) );
+ emit showDateView( 3, firstDate.addDays( num ) );
}
else
showDateView( 10, firstDate.addDays(1) );
}
-QPushButton* KOAgendaView::getNewDaylabel()
+KOAgendaButton* 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 ));
+ KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels);
+ connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) );
mDayLabelsList.append( dayLabel );
mLayoutDayLabels->addWidget(dayLabel);
- //mLayoutDayLabels->setStretchFactor(dayLabel, 100);
return dayLabel ;
}
void KOAgendaView::createDayLabels()
@@ -661,22 +658,22 @@ void KOAgendaView::createDayLabels()
QFont dlf = KOPrefs::instance()->mTimeLabelsFont;
QFontMetrics fm ( dlf );
int selCount = mSelectedDates.count();
- QString dayTest = "Won 20";
+ QString dayTest = "Mon 20";
//QString dayTest = "Mon 20";
int wid = fm.width( dayTest );
//maxWid -= ( selCount * 3 ); //working for QLabels
- maxWid -= ( selCount * 5 ); //working for QPushButton
+ maxWid -= ( selCount * 3 ); //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 )+1;
+ wid = fm.width( dayTest );
needWid = wid * selCount;
}
int maxLen = dayTest.length();
int fontPoint = dlf.pointSize();
@@ -685,9 +682,9 @@ void KOAgendaView::createDayLabels()
while ( fontPoint > 4 ) {
--fontPoint;
dlf.setPointSize( fontPoint );
QFontMetrics f( dlf );
- wid = f.width( "30" )+3;
+ wid = f.width( "30" );
needWid = wid * selCount;
if ( needWid < maxWid )
break;
}
@@ -702,23 +699,23 @@ void KOAgendaView::createDayLabels()
// mLayoutDayLabels->addSpacing(mTimeLabels->width());
//mLayoutDayLabels->addSpacing( 2 );
// QFont lFont = dlf;
bool appendLabels = false;
- QPushButton *dayLabel;
+ KOAgendaButton *dayLabel;
dayLabel = mDayLabelsList.first();
if ( !dayLabel ) {
appendLabels = true;
dayLabel = getNewDaylabel();
}
dayLabel->setFixedWidth( mTimeLabels->width()+2 );
dayLabel->setFont( dlf );
- dayLabel->setCaption("0");
+ dayLabel->setNum( -1 );
//dayLabel->setAlignment(QLabel::AlignHCenter);
dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) );
dayLabel->show();
DateList::ConstIterator dit;
bool oneday = (mSelectedDates.first() == mSelectedDates.last() );
- int counter = 0;
+ int counter = -1;
for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) {
++counter;
QDate date = *dit;
// QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels);
@@ -730,12 +727,12 @@ void KOAgendaView::createDayLabels()
if ( appendLabels ) {
dayLabel = getNewDaylabel();
}
dayLabel->setMinimumWidth( 1 );
- dayLabel->setMaximumWidth( 2048 );
+ dayLabel->setMaximumWidth( 1024 );
dayLabel->setFont( dlf );
dayLabel->show();
- dayLabel->setCaption(QString::number( counter ));
+ dayLabel->setNum( counter );
QString str;
int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date);
QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true );
switch ( maxLen ) {
@@ -823,9 +820,9 @@ void KOAgendaView::createDayLabels()
//qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 );
dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) );
dayLabel->setFont( dlf );
dayLabel->show();
- dayLabel->setCaption("last");
+ dayLabel->setNum( -2 );
dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset );
//qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2);
//mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2);
if ( !appendLabels ) {