summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp41
-rw-r--r--korganizer/koagendaview.h1
-rw-r--r--korganizer/kodaymatrix.cpp8
-rw-r--r--korganizer/koviewmanager.cpp41
4 files changed, 48 insertions, 43 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index aa36553..8c27c43 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -624,8 +624,23 @@ void KOAgendaView::slotDaylabelClicked()
}
else
showDateView( 10, firstDate.addDays(1 ) );
}
+
+QPushButton* 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 ));
+ mDayLabelsList.append( dayLabel );
+ mLayoutDayLabels->addWidget(dayLabel);
+ //mLayoutDayLabels->setStretchFactor(dayLabel, 100);
+ return dayLabel ;
+}
+
void KOAgendaView::createDayLabels()
{
if ( mBlockUpdating || globalFlagBlockLabel == 1) {
@@ -648,9 +663,10 @@ void KOAgendaView::createDayLabels()
QFontMetrics fm ( dlf );
int selCount = mSelectedDates.count();
QString dayTest = "Mon 20";
int wid = fm.width( dayTest );
- maxWid -= ( selCount * 3 );
+ //maxWid -= ( selCount * 3 ); //working for QLabels
+ maxWid -= ( selCount * 5 ); //working for QPushButton
if ( maxWid < 0 )
maxWid = 20;
int needWid = wid * selCount;
//qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid );
@@ -668,9 +684,9 @@ void KOAgendaView::createDayLabels()
while ( fontPoint > 4 ) {
--fontPoint;
dlf.setPointSize( fontPoint );
QFontMetrics f( dlf );
- wid = f.width( "20" );
+ wid = f.width( "20" )+2;
needWid = wid * selCount;
if ( needWid < maxWid )
break;
}
@@ -689,14 +705,9 @@ void KOAgendaView::createDayLabels()
QPushButton *dayLabel;
dayLabel = mDayLabelsList.first();
if ( !dayLabel ) {
appendLabels = true;
- dayLabel = new QPushButton(mDayLabels);
- dayLabel->setFlat( true );
- connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) );
- dayLabel->setFocusPolicy(NoFocus);
- mDayLabelsList.append( dayLabel );
- mLayoutDayLabels->addWidget(dayLabel);
+ dayLabel = getNewDaylabel();
}
dayLabel->setFixedWidth( mTimeLabels->width()+2 );
dayLabel->setFont( dlf );
dayLabel->setCaption("0");
@@ -715,14 +726,9 @@ void KOAgendaView::createDayLabels()
if ( !dayLabel )
appendLabels = true;
}
if ( appendLabels ) {
- dayLabel = new QPushButton(mDayLabels);
- dayLabel->setFlat( true );
- connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) );
- dayLabel->setFocusPolicy(NoFocus);
- mDayLabelsList.append( dayLabel );
- mLayoutDayLabels->addWidget(dayLabel);
+ dayLabel = getNewDaylabel();
}
dayLabel->setMinimumWidth( 1 );
dayLabel->setMaximumWidth( 2048 );
dayLabel->setFont( dlf );
@@ -806,14 +812,9 @@ void KOAgendaView::createDayLabels()
if ( !dayLabel )
appendLabels = true;
}
if ( appendLabels ) {
- dayLabel = new QPushButton(mDayLabels);
- dayLabel->setFlat( true );
- connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) );
- dayLabel->setFocusPolicy(NoFocus);
- mDayLabelsList.append( dayLabel );
- mLayoutDayLabels->addWidget(dayLabel);
+ dayLabel = getNewDaylabel();
}
//dayLabel->hide();//test only
int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ;
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index fd0a7af..cbe86b6 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -189,8 +189,9 @@ class KOAgendaView : public KOEventView {
void incidenceChanged(Incidence * , int );
// void cloneIncidenceSignal(Incidence *);
protected:
+ QPushButton* getNewDaylabel();
bool mBlockUpdating;
int mUpcomingWidth;
/** Fill agenda beginning with date startDate */
void fillAgenda(const QDate &startDate);
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index dd83d48..989f758 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -339,17 +339,17 @@ void KODayMatrix::mouseReleaseEvent (QMouseEvent* e)
if (mSelInit > tmp) {
mSelEnd = mSelInit;
if (tmp != mSelStart) {
mSelStart = tmp;
- repaint();
+ repaint(false);
}
} else {
mSelStart = mSelInit;
//repaint only if selection has changed
if (tmp != mSelEnd) {
mSelEnd = tmp;
- repaint();
+ repaint(false);
}
}
DateList daylist;
@@ -370,17 +370,17 @@ void KODayMatrix::mouseMoveEvent (QMouseEvent* e)
if (mSelInit > tmp) {
mSelEnd = mSelInit;
if (tmp != mSelStart) {
mSelStart = tmp;
- repaint();
+ repaint(false);
}
} else {
mSelStart = mSelInit;
//repaint only if selection has changed
if (tmp != mSelEnd) {
mSelEnd = tmp;
- repaint();
+ repaint(false);
}
}
}
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 188ad23..7e126d9 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -97,22 +97,24 @@ void KOViewManager::readSettings(KConfig *config)
showAgendaView();
}
}
-
void KOViewManager::showDateView( int view, QDate date)
{
-
+ static int lastMode = 0;
+ static int lastCount = 0;
+ static bool lastNDMode = false;
+ static QDate lastDate;
//qDebug("date %d %s", view, date.toString().latin1());
-#if 0
- mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 );
- 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
+
+ //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays );
+ bool savemFlagShowNextxDays = mFlagShowNextxDays;
+ mFlagShowNextxDays = false;
if ( view == 3 ) {
//mCurrentAgendaView = 1 ;
+ lastDate = mMainView->dateNavigator()->selectedDates().first();
+ lastCount = mMainView->dateNavigator()->selectedDates().count();
+ lastNDMode = savemFlagShowNextxDays;
mMainView->showDay( date );
} else if (view == 4 ) {
mCurrentAgendaView = 7 ;
mMainView->dateNavigator()->selectDates( date, 7 );
@@ -137,21 +139,22 @@ void KOViewManager::showDateView( int view, QDate date)
mMainView->dateNavigator()->selectDates( date ,
KOPrefs::instance()->mNextXDays );
mFlagShowNextxDays = true;
mCurrentAgendaView = 3 ;
- } if (view == 9) {
- showWeekView();
+ } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode )
+ if ( lastMode ) {
+ mCurrentAgendaView = lastCount ;
+ mMainView->dateNavigator()->selectDates( lastDate, lastCount);
+ mFlagShowNextxDays = lastNDMode;
+ if ( mFlagShowNextxDays ) {
+ mCurrentAgendaView = 3 ;
+ }
+ } else
+ showWeekView();
} else if (view == 10) {
mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() );
}
-
-#if 0
- dateNavigator()->blockSignals( true );
- dateNavigator()->selectDate( d );
- dateNavigator()->blockSignals( false );
- mViewManager->showDayView();
-#endif
-
+ lastMode = view;
}