summaryrefslogtreecommitdiff
path: root/library/datebookmonth.cpp
Unidiff
Diffstat (limited to 'library/datebookmonth.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/datebookmonth.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/library/datebookmonth.cpp b/library/datebookmonth.cpp
index 76e022f..421559e 100644
--- a/library/datebookmonth.cpp
+++ b/library/datebookmonth.cpp
@@ -56,35 +56,35 @@ DateBookMonthHeader::DateBookMonthHeader( QWidget *parent, const char *name )
56 year = new QSpinBox( 1752, 8000, 1, this ); 56 year = new QSpinBox( 1752, 8000, 1, this );
57 57
58 next = new QToolButton( this ); 58 next = new QToolButton( this );
59 next->setFocusPolicy(NoFocus); 59 next->setFocusPolicy(NoFocus);
60 next->setPixmap( Resource::loadPixmap( "forward" ) ); 60 next->setPixmap( Resource::loadPixmap( "forward" ) );
61 next->setAutoRaise( TRUE ); 61 next->setAutoRaise( TRUE );
62 next->setFixedSize( next->sizeHint() ); 62 next->setFixedSize( next->sizeHint() );
63 QWhatsThis::add( next, tr("Show the next month") ); 63 QWhatsThis::add( next, tr("Show the next month") );
64 64
65 end = new QToolButton( this ); 65 end = new QToolButton( this );
66 end->setFocusPolicy(NoFocus); 66 end->setFocusPolicy(NoFocus);
67 end->setPixmap( Resource::loadPixmap( "finish" ) ); 67 end->setPixmap( Resource::loadPixmap( "finish" ) );
68 end->setAutoRaise( TRUE ); 68 end->setAutoRaise( TRUE );
69 end->setFixedSize( end->sizeHint() ); 69 end->setFixedSize( end->sizeHint() );
70 QWhatsThis::add( end, tr("Show December in the selected year") ); 70 QWhatsThis::add( end, tr("Show December in the selected year") );
71 71
72 connect( month, SIGNAL( activated( int ) ), 72 connect( month, SIGNAL( activated(int) ),
73 this, SLOT( updateDate() ) ); 73 this, SLOT( updateDate() ) );
74 connect( year, SIGNAL( valueChanged( int ) ), 74 connect( year, SIGNAL( valueChanged(int) ),
75 this, SLOT( updateDate() ) ); 75 this, SLOT( updateDate() ) );
76 connect( begin, SIGNAL( clicked() ), 76 connect( begin, SIGNAL( clicked() ),
77 this, SLOT( firstMonth() ) ); 77 this, SLOT( firstMonth() ) );
78 connect( end, SIGNAL( clicked() ), 78 connect( end, SIGNAL( clicked() ),
79 this, SLOT( lastMonth() ) ); 79 this, SLOT( lastMonth() ) );
80 connect( back, SIGNAL( clicked() ), 80 connect( back, SIGNAL( clicked() ),
81 this, SLOT( monthBack() ) ); 81 this, SLOT( monthBack() ) );
82 connect( next, SIGNAL( clicked() ), 82 connect( next, SIGNAL( clicked() ),
83 this, SLOT( monthForward() ) ); 83 this, SLOT( monthForward() ) );
84 back->setAutoRepeat( TRUE ); 84 back->setAutoRepeat( TRUE );
85 next->setAutoRepeat( TRUE ); 85 next->setAutoRepeat( TRUE );
86} 86}
87 87
88 88
89DateBookMonthHeader::~DateBookMonthHeader() 89DateBookMonthHeader::~DateBookMonthHeader()
90{ 90{
@@ -174,36 +174,36 @@ DateBookMonthTable::DateBookMonthTable( QWidget *parent, const char *name,
174 174
175 horizontalHeader()->setResizeEnabled( FALSE ); 175 horizontalHeader()->setResizeEnabled( FALSE );
176 // we have to do this here... or suffer the consequences later... 176 // we have to do this here... or suffer the consequences later...
177 for ( int i = 0; i < 7; i++ ){ 177 for ( int i = 0; i < 7; i++ ){
178 horizontalHeader()->resizeSection( i, 30 ); 178 horizontalHeader()->resizeSection( i, 30 );
179 setColumnStretchable( i, TRUE ); 179 setColumnStretchable( i, TRUE );
180 } 180 }
181 setupLabels(); 181 setupLabels();
182 182
183 verticalHeader()->hide(); 183 verticalHeader()->hide();
184 setLeftMargin( 0 ); 184 setLeftMargin( 0 );
185 for ( int i = 0; i < 6; ++i ) 185 for ( int i = 0; i < 6; ++i )
186 setRowStretchable( i, TRUE ); 186 setRowStretchable( i, TRUE );
187 187
188 setSelectionMode( NoSelection ); 188 setSelectionMode( NoSelection );
189 189
190 connect( this, SIGNAL( clicked( int, int, int, const QPoint & ) ), 190 connect( this, SIGNAL( clicked(int,int,int,const QPoint&) ),
191 this, SLOT( dayClicked( int, int ) ) ); 191 this, SLOT( dayClicked(int,int) ) );
192 connect( this, SIGNAL( currentChanged( int, int ) ), 192 connect( this, SIGNAL( currentChanged(int,int) ),
193 this, SLOT( dragDay( int, int ) ) ); 193 this, SLOT( dragDay(int,int) ) );
194 setVScrollBarMode( AlwaysOff ); 194 setVScrollBarMode( AlwaysOff );
195 setHScrollBarMode( AlwaysOff ); 195 setHScrollBarMode( AlwaysOff );
196} 196}
197 197
198DateBookMonthTable::~DateBookMonthTable() 198DateBookMonthTable::~DateBookMonthTable()
199{ 199{
200 monthsEvents.clear(); 200 monthsEvents.clear();
201 delete d; 201 delete d;
202} 202}
203 203
204void DateBookMonthTable::setDate(int y, int m, int d) 204void DateBookMonthTable::setDate(int y, int m, int d)
205{ 205{
206 if (month == m && year == y) { 206 if (month == m && year == y) {
207 if ( selYear == -1 ) 207 if ( selYear == -1 )
208 year = selYear; 208 year = selYear;
209 if ( selMonth == -1 ) 209 if ( selMonth == -1 )
@@ -381,36 +381,36 @@ void DateBookMonthTable::setupLabels()
381 381
382DateBookMonth::DateBookMonth( QWidget *parent, const char *name, bool ac, 382DateBookMonth::DateBookMonth( QWidget *parent, const char *name, bool ac,
383 DateBookDB *data ) 383 DateBookDB *data )
384 : QVBox( parent, name ), 384 : QVBox( parent, name ),
385 autoClose( ac ) 385 autoClose( ac )
386{ 386{
387 setFocusPolicy(StrongFocus); 387 setFocusPolicy(StrongFocus);
388 year = QDate::currentDate().year(); 388 year = QDate::currentDate().year();
389 month = QDate::currentDate().month(); 389 month = QDate::currentDate().month();
390 day = QDate::currentDate().day(); 390 day = QDate::currentDate().day();
391 header = new DateBookMonthHeader( this, "DateBookMonthHeader" ); 391 header = new DateBookMonthHeader( this, "DateBookMonthHeader" );
392 table = new DateBookMonthTable( this, "DateBookMonthTable", data ); 392 table = new DateBookMonthTable( this, "DateBookMonthTable", data );
393 header->setDate( year, month ); 393 header->setDate( year, month );
394 table->setDate( year, month, QDate::currentDate().day() ); 394 table->setDate( year, month, QDate::currentDate().day() );
395 header->setFocusPolicy(NoFocus); 395 header->setFocusPolicy(NoFocus);
396 table->setFocusPolicy(NoFocus); 396 table->setFocusPolicy(NoFocus);
397 connect( header, SIGNAL( dateChanged( int, int ) ), 397 connect( header, SIGNAL( dateChanged(int,int) ),
398 this, SLOT( setDate( int, int ) ) ); 398 this, SLOT( setDate(int,int) ) );
399 connect( table, SIGNAL( dateClicked( int, int, int ) ), 399 connect( table, SIGNAL( dateClicked(int,int,int) ),
400 this, SLOT( finalDate(int, int, int) ) ); 400 this, SLOT( finalDate(int,int,int) ) );
401 connect( qApp, SIGNAL(weekChanged(bool)), this, 401 connect( qApp, SIGNAL(weekChanged(bool)), this,
402 SLOT(slotWeekChange(bool)) ); 402 SLOT(slotWeekChange(bool)) );
403 table->setFocus(); 403 table->setFocus();
404} 404}
405 405
406DateBookMonth::~DateBookMonth() 406DateBookMonth::~DateBookMonth()
407{ 407{
408 408
409} 409}
410 410
411void DateBookMonth::setDate( int y, int m ) 411void DateBookMonth::setDate( int y, int m )
412{ 412{
413 /* only change the date if this is a different date, 413 /* only change the date if this is a different date,
414 * other wise we may mistakenly overide the day */ 414 * other wise we may mistakenly overide the day */
415 if ( (y != year) || (m != month) ) { 415 if ( (y != year) || (m != month) ) {
416 year = y; 416 year = y;
@@ -683,36 +683,36 @@ DateButton::DateButton( bool longDate, QWidget *parent, const char * name )
683 setDate( QDate::currentDate() ); 683 setDate( QDate::currentDate() );
684 684
685 connect(this,SIGNAL(pressed()),this,SLOT(pickDate())); 685 connect(this,SIGNAL(pressed()),this,SLOT(pickDate()));
686 686
687 687
688} 688}
689 689
690 690
691void DateButton::pickDate() 691void DateButton::pickDate()
692{ 692{
693 static QPopupMenu *m1 = 0; 693 static QPopupMenu *m1 = 0;
694 static DateBookMonth *picker = 0; 694 static DateBookMonth *picker = 0;
695 if ( !m1 ) { 695 if ( !m1 ) {
696 m1 = new QPopupMenu( this ); 696 m1 = new QPopupMenu( this );
697 picker = new DateBookMonth( m1, 0, TRUE ); 697 picker = new DateBookMonth( m1, 0, TRUE );
698 m1->insertItem( picker ); 698 m1->insertItem( picker );
699 connect( picker, SIGNAL( dateClicked( int, int, int ) ), 699 connect( picker, SIGNAL( dateClicked(int,int,int) ),
700 this, SLOT( setDate( int, int, int ) ) ); 700 this, SLOT( setDate(int,int,int) ) );
701 connect( picker, SIGNAL( dateClicked( int, int, int ) ), 701 connect( picker, SIGNAL( dateClicked(int,int,int) ),
702 this, SIGNAL( dateSelected( int, int, int ) ) ); 702 this, SIGNAL( dateSelected(int,int,int) ) );
703 connect( m1, SIGNAL( aboutToHide() ), 703 connect( m1, SIGNAL( aboutToHide() ),
704 this, SLOT( gotHide() ) ); 704 this, SLOT( gotHide() ) );
705 } 705 }
706 picker->slotWeekChange( weekStartsMonday ); 706 picker->slotWeekChange( weekStartsMonday );
707 picker->setDate( currDate.year(), currDate.month(), currDate.day() ); 707 picker->setDate( currDate.year(), currDate.month(), currDate.day() );
708 m1->popup(mapToGlobal(QPoint(0,height()))); 708 m1->popup(mapToGlobal(QPoint(0,height())));
709 picker->setFocus(); 709 picker->setFocus();
710} 710}
711 711
712 712
713void DateButton::gotHide() 713void DateButton::gotHide()
714{ 714{
715 // we have to redo the button... 715 // we have to redo the button...
716 setDown( false ); 716 setDown( false );
717} 717}
718 718