summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-31 22:41:05 (UTC)
committer zautrix <zautrix>2005-01-31 22:41:05 (UTC)
commit336678d691a8c3346c92a4e561ac7938ed532003 (patch) (side-by-side diff)
treed4c12ab5536003910727b4478f70372324b7c00d
parent949ead6797c44f632a4addd2e6aae1fb88f37816 (diff)
downloadkdepimpi-336678d691a8c3346c92a4e561ac7938ed532003.zip
kdepimpi-336678d691a8c3346c92a4e561ac7938ed532003.tar.gz
kdepimpi-336678d691a8c3346c92a4e561ac7938ed532003.tar.bz2
fixxx
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp44
-rw-r--r--korganizer/koagendaview.h3
-rw-r--r--korganizer/koviewmanager.cpp7
3 files changed, 46 insertions, 8 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 8e9add3..d43712f 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -606,12 +606,28 @@ void KOAgendaView::resizeEvent( QResizeEvent* e )
//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 ) );
+}
void KOAgendaView::createDayLabels()
{
if ( mBlockUpdating || globalFlagBlockLabel == 1) {
// qDebug(" KOAgendaView::createDayLabels() blocked ");
return;
@@ -667,44 +683,54 @@ void KOAgendaView::createDayLabels()
mDayLabels->setFont( dlf );
// mLayoutDayLabels = new QHBoxLayout(mDayLabels);;
// mLayoutDayLabels->addSpacing(mTimeLabels->width());
//mLayoutDayLabels->addSpacing( 2 );
// QFont lFont = dlf;
bool appendLabels = false;
- QLabel *dayLabel;
+ QPushButton *dayLabel;
dayLabel = mDayLabelsList.first();
if ( !dayLabel ) {
appendLabels = true;
- dayLabel = new QLabel(mDayLabels);
+ dayLabel = new QPushButton(mDayLabels);
+ dayLabel->setFlat( true );
+ connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) );
+ dayLabel->setFocusPolicy(NoFocus);
mDayLabelsList.append( dayLabel );
mLayoutDayLabels->addWidget(dayLabel);
}
dayLabel->setFixedWidth( mTimeLabels->width()+2 );
dayLabel->setFont( dlf );
- dayLabel->setAlignment(QLabel::AlignHCenter);
+ dayLabel->setCaption("0");
+ //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;
for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) {
+ ++counter;
QDate date = *dit;
// QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels);
if ( ! appendLabels ) {
dayLabel = mDayLabelsList.next();
if ( !dayLabel )
appendLabels = true;
}
if ( appendLabels ) {
- dayLabel = new QLabel(mDayLabels);
+ dayLabel = new QPushButton(mDayLabels);
+ dayLabel->setFlat( true );
+ connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) );
+ dayLabel->setFocusPolicy(NoFocus);
mDayLabelsList.append( dayLabel );
mLayoutDayLabels->addWidget(dayLabel);
}
dayLabel->setMinimumWidth( 1 );
dayLabel->setMaximumWidth( 2048 );
dayLabel->setFont( dlf );
dayLabel->show();
+ dayLabel->setCaption(QString::number( counter ));
QString str;
int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date);
QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true );
switch ( maxLen ) {
case 2:
str = QString::number( date.day() );
@@ -743,13 +769,13 @@ void KOAgendaView::createDayLabels()
addString = i18n("Day after tomorrow");
if ( !addString.isEmpty() ) {
str = addString+", " + str;
}
}
dayLabel->setText(str);
- dayLabel->setAlignment(QLabel::AlignHCenter);
+ //dayLabel->setAlignment(QLabel::AlignHCenter);
if (date == QDate::currentDate()) {
QFont bFont = dlf;
bFont.setBold( true );
dayLabel->setFont(bFont);
}
//dayLayout->addWidget(dayLabel);
@@ -778,23 +804,27 @@ void KOAgendaView::createDayLabels()
if ( ! appendLabels ) {
dayLabel = mDayLabelsList.next();
if ( !dayLabel )
appendLabels = true;
}
if ( appendLabels ) {
- dayLabel = new QLabel(mDayLabels);
+ dayLabel = new QPushButton(mDayLabels);
+ dayLabel->setFlat( true );
+ connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) );
+ dayLabel->setFocusPolicy(NoFocus);
mDayLabelsList.append( dayLabel );
mLayoutDayLabels->addWidget(dayLabel);
}
//dayLabel->hide();//test only
int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ;
if ( offset < 0 ) offset = 0;
//qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 );
- dayLabel->setText("");//QString::number ( mSelectedDates.first().month() ) );
+ dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) );
dayLabel->show();
+ dayLabel->setCaption("last");
dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset );
//qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2);
//mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2);
if ( !appendLabels ) {
dayLabel = mDayLabelsList.next();
while ( dayLabel ) {
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index 7774fbe..fd0a7af 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -204,12 +204,13 @@ class KOAgendaView : public KOEventView {
/**
Set the masks on the agenda widgets indicating, which days are holidays.
*/
void setHolidayMasks();
protected slots:
+ void slotDaylabelClicked();
/** Update event belonging to agenda item */
void updateEventDates(KOAgendaItem *item, int mode = -1);
//void updateMovedTodo();
void updateEventIndicatorTop(int newY);
void updateEventIndicatorBottom(int newY);
@@ -249,13 +250,13 @@ class KOAgendaView : public KOEventView {
QMemArray<int> mMaxY;
QMemArray<bool> mHolidayMask;
QPixmap mExpandedPixmap;
QPixmap mNotExpandedPixmap;
- QPtrList<QLabel> mDayLabelsList;
+ QPtrList<QPushButton> mDayLabelsList;
QDateTime mTimeSpanBegin;
QDateTime mTimeSpanEnd;
bool mTimeSpanInAllDay;
void keyPressEvent ( QKeyEvent * e );
};
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index db23882..30f5fb1 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -108,16 +108,19 @@ void KOViewManager::showDateView( int view, QDate date)
mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next Week"),4 );
mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Two Weeks"),5 );
mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Month"),6 );
mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 );
#endif
if ( view == 3 ) {
+ //mCurrentAgendaView = 1 ;
mMainView->showDay( date );
} else if (view == 4 ) {
+ mCurrentAgendaView = 7 ;
mMainView->dateNavigator()->selectDates( date, 7 );
} else if (view == 5 ) {
+ mCurrentAgendaView = 14 ;
mMainView->dateNavigator()->selectDates( date, 14);
} else if (view == 6 ) {
mMainView->dateNavigator()->blockSignals( true );
showMonthView();
mMainView->dateNavigator()->selectMonthByDate( date );
mMainView->dateNavigator()->blockSignals( false );
@@ -132,12 +135,16 @@ void KOViewManager::showDateView( int view, QDate date)
showAgendaView(KOPrefs::instance()->mFullViewMonth);
globalFlagBlockAgenda = 2;
mMainView->dateNavigator()->selectDates( date ,
KOPrefs::instance()->mNextXDays );
mFlagShowNextxDays = true;
mCurrentAgendaView = 3 ;
+ } if (view == 9) {
+ showWeekView();
+ } else if (view == 10) {
+ mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() );
}
#if 0
dateNavigator()->blockSignals( true );
dateNavigator()->selectDate( d );
dateNavigator()->blockSignals( false );