author | zautrix <zautrix> | 2005-02-01 19:32:20 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-01 19:32:20 (UTC) |
commit | 0eca34f0a8a02787dccad1b37e0c2e01af734e56 (patch) (side-by-side diff) | |
tree | 721cf4dfd0b29695a8b648e7eb6666ee4020c19b | |
parent | 81991bbbc7f815c82b37db654528ee3b224435dc (diff) | |
download | kdepimpi-0eca34f0a8a02787dccad1b37e0c2e01af734e56.zip kdepimpi-0eca34f0a8a02787dccad1b37e0c2e01af734e56.tar.gz kdepimpi-0eca34f0a8a02787dccad1b37e0c2e01af734e56.tar.bz2 |
very good fix
-rw-r--r-- | korganizer/koagendaview.cpp | 45 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 33 |
2 files changed, 50 insertions, 28 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index d3db89a..c8cef44 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -78,2 +78,4 @@ using namespace KOrg; + + TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : @@ -611,14 +613,13 @@ void KOAgendaView::resizeEvent( QResizeEvent* e ) } -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 ) ); } @@ -628,13 +629,9 @@ void KOAgendaView::slotDaylabelClicked() -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 ; @@ -664,3 +661,3 @@ void KOAgendaView::createDayLabels() int selCount = mSelectedDates.count(); - QString dayTest = "Won 20"; + QString dayTest = "Mon 20"; //QString dayTest = "Mon 20"; @@ -668,3 +665,3 @@ void KOAgendaView::createDayLabels() //maxWid -= ( selCount * 3 ); //working for QLabels - maxWid -= ( selCount * 5 ); //working for QPushButton + maxWid -= ( selCount * 3 ); //working for QPushButton if ( maxWid < 0 ) @@ -677,3 +674,3 @@ void KOAgendaView::createDayLabels() dayTest = dayTest.left( dayTest.length() - 1 ); - wid = fm.width( dayTest )+1; + wid = fm.width( dayTest ); needWid = wid * selCount; @@ -688,3 +685,3 @@ void KOAgendaView::createDayLabels() QFontMetrics f( dlf ); - wid = f.width( "30" )+3; + wid = f.width( "30" ); needWid = wid * selCount; @@ -705,3 +702,3 @@ void KOAgendaView::createDayLabels() bool appendLabels = false; - QPushButton *dayLabel; + KOAgendaButton *dayLabel; dayLabel = mDayLabelsList.first(); @@ -713,3 +710,3 @@ void KOAgendaView::createDayLabels() dayLabel->setFont( dlf ); - dayLabel->setCaption("0"); + dayLabel->setNum( -1 ); //dayLabel->setAlignment(QLabel::AlignHCenter); @@ -719,3 +716,3 @@ void KOAgendaView::createDayLabels() bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); - int counter = 0; + int counter = -1; for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { @@ -733,6 +730,6 @@ void KOAgendaView::createDayLabels() dayLabel->setMinimumWidth( 1 ); - dayLabel->setMaximumWidth( 2048 ); + dayLabel->setMaximumWidth( 1024 ); dayLabel->setFont( dlf ); dayLabel->show(); - dayLabel->setCaption(QString::number( counter )); + dayLabel->setNum( counter ); QString str; @@ -826,3 +823,3 @@ void KOAgendaView::createDayLabels() dayLabel->show(); - dayLabel->setCaption("last"); + dayLabel->setNum( -2 ); dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index cbe86b6..e9e85cc 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h @@ -27,2 +27,3 @@ #include <qdatetime.h> +#include <qpushbutton.h> #include <qlayout.h> @@ -37,3 +38,2 @@ - class QHBox; @@ -47,2 +47,27 @@ class KConfig; class KDGanttMinimizeSplitter; + +class KOAgendaButton : public QPushButton +{ + Q_OBJECT + public: + KOAgendaButton( QWidget *parent=0, const char *name=0 ) : + QPushButton( parent, name ) + { + mNum = -3; + setFlat( true ); + setFocusPolicy(NoFocus); + setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); + connect( this, SIGNAL( clicked() ), this, SLOT ( bClicked() ) ); + }; + + QSize sizeHint () const { return QSize( 5,5) ;} + void setNum( int n) { mNum = n; } +private slots: + void bClicked() {emit numClicked( mNum);} +signals: + void numClicked( int ); +private: + int mNum; +}; + class TimeLabels : public QScrollView { @@ -192,3 +217,3 @@ class KOAgendaView : public KOEventView { protected: - QPushButton* getNewDaylabel(); + KOAgendaButton* getNewDaylabel(); bool mBlockUpdating; @@ -210,3 +235,3 @@ class KOAgendaView : public KOEventView { protected slots: - void slotDaylabelClicked(); + void slotDaylabelClicked( int ); /** Update event belonging to agenda item */ @@ -256,3 +281,3 @@ class KOAgendaView : public KOEventView { QPixmap mNotExpandedPixmap; - QPtrList<QPushButton> mDayLabelsList; + QPtrList<KOAgendaButton> mDayLabelsList; QDateTime mTimeSpanBegin; |