author | umopapisdn <umopapisdn> | 2003-03-24 09:48:03 (UTC) |
---|---|---|
committer | umopapisdn <umopapisdn> | 2003-03-24 09:48:03 (UTC) |
commit | 1471e2c49d27b352682448e2653e59073b556abc (patch) (side-by-side diff) | |
tree | 28ba9126851cdb06fcf7e564c7ed7aa554eaee59 | |
parent | fea2436fef9e7096b31840e7170a23280f3d6e39 (diff) | |
download | opie-1471e2c49d27b352682448e2653e59073b556abc.zip opie-1471e2c49d27b352682448e2653e59073b556abc.tar.gz opie-1471e2c49d27b352682448e2653e59073b556abc.tar.bz2 |
New feature: (bug/feature request #0000227) In dayview, to icons have been added to navigate 1 week back and forward.
-rw-r--r-- | core/pim/datebook/datebookdayheader.cpp | 207 | ||||
-rw-r--r-- | core/pim/datebook/datebookdayheader.h | 56 | ||||
-rw-r--r-- | core/pim/datebook/datebookdayheaderimpl.cpp | 18 | ||||
-rw-r--r-- | core/pim/datebook/datebookdayheaderimpl.h | 2 |
4 files changed, 283 insertions, 0 deletions
diff --git a/core/pim/datebook/datebookdayheader.cpp b/core/pim/datebook/datebookdayheader.cpp new file mode 100644 index 0000000..82a143f --- a/dev/null +++ b/core/pim/datebook/datebookdayheader.cpp @@ -0,0 +1,207 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'datebookdayheader.ui' +** +** Created: Mon Mar 24 10:42:07 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "datebookdayheader.h" + +#include <qbuttongroup.h> +#include <qpushbutton.h> +#include <qtoolbutton.h> +#include <qlayout.h> +#include <qvariant.h> +#include <qtooltip.h> +#include <qwhatsthis.h> +#include <qimage.h> +#include <qpixmap.h> + + +/* + * Constructs a DateBookDayHeaderBase which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DateBookDayHeaderBase::DateBookDayHeaderBase( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DateBookDayHeaderBase" ); + resize( 249, 26 ); + DateBookDayHeaderBaseLayout = new QHBoxLayout( this ); + DateBookDayHeaderBaseLayout->setSpacing( 0 ); + DateBookDayHeaderBaseLayout->setMargin( 0 ); + + backweek = new QToolButton( this, "backweek" ); + backweek->setText( tr( "" ) ); + backweek->setToggleButton( FALSE ); + backweek->setAutoRepeat( TRUE ); + backweek->setAutoRaise( TRUE ); + backweek->setToggleButton( FALSE ); + QToolTip::add( backweek, tr( "" ) ); + DateBookDayHeaderBaseLayout->addWidget( backweek ); + + back = new QToolButton( this, "back" ); + back->setText( tr( "" ) ); + back->setToggleButton( FALSE ); + back->setAutoRepeat( TRUE ); + back->setAutoRaise( TRUE ); + back->setToggleButton( FALSE ); + QToolTip::add( back, tr( "" ) ); + DateBookDayHeaderBaseLayout->addWidget( back ); + + date = new QToolButton( this, "date" ); + date->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)1, date->sizePolicy().hasHeightForWidth() ) ); + QFont date_font( date->font() ); + date_font.setBold( TRUE ); + date->setFont( date_font ); + date->setText( tr( "" ) ); + date->setAutoRepeat( FALSE ); + date->setAutoRaise( FALSE ); + DateBookDayHeaderBaseLayout->addWidget( date ); + + grpDays = new QButtonGroup( this, "grpDays" ); + grpDays->setFrameShape( QButtonGroup::NoFrame ); + grpDays->setFrameShadow( QButtonGroup::Plain ); + grpDays->setTitle( tr( "" ) ); + grpDays->setExclusive( TRUE ); + grpDays->setColumnLayout(0, Qt::Vertical ); + grpDays->layout()->setSpacing( 0 ); + grpDays->layout()->setMargin( 0 ); + grpDaysLayout = new QHBoxLayout( grpDays->layout() ); + grpDaysLayout->setAlignment( Qt::AlignTop ); + grpDaysLayout->setSpacing( 1 ); + grpDaysLayout->setMargin( 0 ); + + cmdDay1 = new QToolButton( grpDays, "cmdDay1" ); + cmdDay1->setText( tr( "M" ) ); + cmdDay1->setToggleButton( TRUE ); + cmdDay1->setAutoRaise( TRUE ); + cmdDay1->setToggleButton( TRUE ); + QToolTip::add( cmdDay1, tr( "" ) ); + grpDaysLayout->addWidget( cmdDay1 ); + + cmdDay2 = new QToolButton( grpDays, "cmdDay2" ); + cmdDay2->setText( tr( "T" ) ); + cmdDay2->setToggleButton( TRUE ); + cmdDay2->setAutoRaise( TRUE ); + cmdDay2->setToggleButton( TRUE ); + QToolTip::add( cmdDay2, tr( "" ) ); + grpDaysLayout->addWidget( cmdDay2 ); + + cmdDay3 = new QToolButton( grpDays, "cmdDay3" ); + cmdDay3->setText( tr( "W" ) ); + cmdDay3->setToggleButton( TRUE ); + cmdDay3->setAutoRaise( TRUE ); + cmdDay3->setToggleButton( TRUE ); + QToolTip::add( cmdDay3, tr( "" ) ); + grpDaysLayout->addWidget( cmdDay3 ); + + cmdDay4 = new QToolButton( grpDays, "cmdDay4" ); + cmdDay4->setText( tr( "T" ) ); + cmdDay4->setToggleButton( TRUE ); + cmdDay4->setAutoRepeat( FALSE ); + cmdDay4->setAutoRaise( TRUE ); + cmdDay4->setToggleButton( TRUE ); + QToolTip::add( cmdDay4, tr( "" ) ); + grpDaysLayout->addWidget( cmdDay4 ); + + cmdDay5 = new QToolButton( grpDays, "cmdDay5" ); + cmdDay5->setText( tr( "F" ) ); + cmdDay5->setToggleButton( TRUE ); + cmdDay5->setAutoRaise( TRUE ); + cmdDay5->setToggleButton( TRUE ); + QToolTip::add( cmdDay5, tr( "" ) ); + grpDaysLayout->addWidget( cmdDay5 ); + + cmdDay6 = new QToolButton( grpDays, "cmdDay6" ); + cmdDay6->setText( tr( "S" ) ); + cmdDay6->setToggleButton( TRUE ); + cmdDay6->setAutoRaise( TRUE ); + cmdDay6->setToggleButton( TRUE ); + QToolTip::add( cmdDay6, tr( "" ) ); + grpDaysLayout->addWidget( cmdDay6 ); + + cmdDay7 = new QToolButton( grpDays, "cmdDay7" ); + cmdDay7->setText( tr( "S" ) ); + cmdDay7->setToggleButton( TRUE ); + cmdDay7->setAutoRaise( TRUE ); + cmdDay7->setToggleButton( TRUE ); + QToolTip::add( cmdDay7, tr( "" ) ); + grpDaysLayout->addWidget( cmdDay7 ); + DateBookDayHeaderBaseLayout->addWidget( grpDays ); + + forward = new QToolButton( this, "forward" ); + forward->setText( tr( "" ) ); + forward->setAutoRepeat( TRUE ); + forward->setAutoRaise( TRUE ); + DateBookDayHeaderBaseLayout->addWidget( forward ); + + forwardweek = new QToolButton( this, "forwardweek" ); + forwardweek->setText( tr( "" ) ); + forwardweek->setAutoRepeat( TRUE ); + forwardweek->setAutoRaise( TRUE ); + DateBookDayHeaderBaseLayout->addWidget( forwardweek ); + + // signals and slots connections + connect( forwardweek, SIGNAL( clicked() ), this, SLOT( goForwardWeek() ) ); + connect( forward, SIGNAL( clicked() ), this, SLOT( goForward() ) ); + connect( back, SIGNAL( clicked() ), this, SLOT( goBack() ) ); + connect( backweek, SIGNAL( clicked() ), this, SLOT( goBackWeek() ) ); + connect( grpDays, SIGNAL( clicked(int) ), this, SLOT( setDay( int ) ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DateBookDayHeaderBase::~DateBookDayHeaderBase() +{ + // no need to delete child widgets, Qt does it all for us +} + +/* + * Main event handler. Reimplemented to handle application + * font changes + */ +bool DateBookDayHeaderBase::event( QEvent* ev ) +{ + bool ret = QWidget::event( ev ); + if ( ev->type() == QEvent::ApplicationFontChange ) { + QFont date_font( date->font() ); + date_font.setBold( TRUE ); + date->setFont( date_font ); + } + return ret; +} + +void DateBookDayHeaderBase::goBack() +{ + qWarning( "DateBookDayHeaderBase::goBack(): Not implemented yet!" ); +} + +void DateBookDayHeaderBase::goBackWeek() +{ + qWarning( "DateBookDayHeaderBase::goBackWeek(): Not implemented yet!" ); +} + +void DateBookDayHeaderBase::goForward() +{ + qWarning( "DateBookDayHeaderBase::goForward(): Not implemented yet!" ); +} + +void DateBookDayHeaderBase::goForwardWeek() +{ + qWarning( "DateBookDayHeaderBase::goForwardWeek(): Not implemented yet!" ); +} + +void DateBookDayHeaderBase::setDate( int, int, int ) +{ + qWarning( "DateBookDayHeaderBase::setDate( int, int, int ): Not implemented yet!" ); +} + +void DateBookDayHeaderBase::setDay( int ) +{ + qWarning( "DateBookDayHeaderBase::setDay( int ): Not implemented yet!" ); +} + diff --git a/core/pim/datebook/datebookdayheader.h b/core/pim/datebook/datebookdayheader.h new file mode 100644 index 0000000..12f6fcf --- a/dev/null +++ b/core/pim/datebook/datebookdayheader.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'datebookdayheader.ui' +** +** Created: Mon Mar 10 20:49:12 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DATEBOOKDAYHEADERBASE_H +#define DATEBOOKDAYHEADERBASE_H + +#include <qvariant.h> +#include <qwidget.h> +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QToolButton; + +class DateBookDayHeaderBase : public QWidget +{ + Q_OBJECT + +public: + DateBookDayHeaderBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DateBookDayHeaderBase(); + + QToolButton* backweek; + QToolButton* back; + QToolButton* date; + QButtonGroup* grpDays; + QToolButton* cmdDay1; + QToolButton* cmdDay2; + QToolButton* cmdDay3; + QToolButton* cmdDay4; + QToolButton* cmdDay5; + QToolButton* cmdDay6; + QToolButton* cmdDay7; + QToolButton* forward; + QToolButton* forwardweek; + +public slots: + virtual void goBackWeek(); + virtual void goBack(); + virtual void goForward(); + virtual void goForwardWeek(); + virtual void setDate( int, int, int ); + virtual void setDay( int ); + +protected: + QHBoxLayout* DateBookDayHeaderBaseLayout; + QHBoxLayout* grpDaysLayout; + bool event( QEvent* ); +}; + +#endif // DATEBOOKDAYHEADERBASE_H diff --git a/core/pim/datebook/datebookdayheaderimpl.cpp b/core/pim/datebook/datebookdayheaderimpl.cpp index 7d77153..3e965f5 100644 --- a/core/pim/datebook/datebookdayheaderimpl.cpp +++ b/core/pim/datebook/datebookdayheaderimpl.cpp @@ -39,24 +39,26 @@ */ DateBookDayHeader::DateBookDayHeader( bool useMonday, QWidget* parent, const char* name ) : DateBookDayHeaderBase( parent, name ), bUseMonday( useMonday ) { connect(date,SIGNAL(pressed()),this,SLOT(pickDate())); setupNames(); forward->setPixmap( Resource::loadPixmap( "forward" ) ); back->setPixmap( Resource::loadPixmap( "back" ) ); + forwardweek->setPixmap( Resource::loadPixmap( "fastforward" ) ); + backweek->setPixmap( Resource::loadPixmap( "fastback" ) ); setBackgroundMode( PaletteButton ); grpDays->setBackgroundMode( PaletteButton ); } /* * Destroys the object and frees any allocated resources */ DateBookDayHeader::~DateBookDayHeader() { // no need to delete child widgets, Qt does it all for us } @@ -121,24 +123,40 @@ void DateBookDayHeader::goBack() { currDate = currDate.addDays( -1 ); setDate( currDate.year(), currDate.month(), currDate.day() ); } /* * public slot */ void DateBookDayHeader::goForward() { currDate = currDate.addDays( 1 ); setDate( currDate.year(), currDate.month(), currDate.day() ); } +/* + * public slot + */ +void DateBookDayHeader::goBackWeek() +{ + currDate = currDate.addDays( -7 ); + setDate( currDate.year(), currDate.month(), currDate.day() ); +} +/* + * public slot + */ +void DateBookDayHeader::goForwardWeek() +{ + currDate = currDate.addDays( 7 ); + setDate( currDate.year(), currDate.month(), currDate.day() ); +} /* * public slot */ void DateBookDayHeader::setDate( int y, int m, int d ) { currDate.setYMD( y, m, d ); date->setText( TimeString::shortDate( currDate ) ); int iDayOfWeek = currDate.dayOfWeek(); // cleverly adjust the day depending on how we start the week diff --git a/core/pim/datebook/datebookdayheaderimpl.h b/core/pim/datebook/datebookdayheaderimpl.h index 43f3a93..a07bd67 100644 --- a/core/pim/datebook/datebookdayheaderimpl.h +++ b/core/pim/datebook/datebookdayheaderimpl.h @@ -27,24 +27,26 @@ class DateBookDayHeader : public DateBookDayHeaderBase { Q_OBJECT public: DateBookDayHeader( bool bUseMonday, QWidget* parent = 0, const char* name = 0 ); ~DateBookDayHeader(); void setStartOfWeek( bool onMonday ); public slots: void goBack(); void goForward(); + void goBackWeek(); + void goForwardWeek(); void setDate( int, int, int ); void setDay( int ); void gotHide(); signals: void dateChanged( int y, int m, int d ); private slots: void pickDate(); private: |