summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-22 21:37:48 (UTC)
committer zautrix <zautrix>2005-03-22 21:37:48 (UTC)
commit53ac6d1f931c50d89a44d9d46daceb7ed9d4ddc6 (patch) (side-by-side diff)
treea6a9f1e42252edec30b334d2ae6df245d69912b2
parentcce0a3b5e884db3d2d7d84a347e14f8694b556e2 (diff)
downloadkdepimpi-53ac6d1f931c50d89a44d9d46daceb7ed9d4ddc6.zip
kdepimpi-53ac6d1f931c50d89a44d9d46daceb7ed9d4ddc6.tar.gz
kdepimpi-53ac6d1f931c50d89a44d9d46daceb7ed9d4ddc6.tar.bz2
fix
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kdatenavigator.cpp16
-rw-r--r--korganizer/koviewmanager.cpp3
2 files changed, 19 insertions, 0 deletions
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index 83a57ca..1474e4b 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -38,96 +38,97 @@
#ifndef KORG_NOPLUGINS
#include "kocore.h"
#endif
#include <kcalendarsystem.h>
#include "navigatorbar.h"
#include "kdatenavigator.h"
KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
: QFrame(parent, name),
updateTimer(0L)
{
setFrameStyle(QFrame::NoFrame);
QDate startDate = QDate::currentDate();
QGridLayout *topLayout = new QGridLayout(this,8,8);
if (! startDate.isValid()) {
qDebug("KDateNavigator::invalid startdate ");
startDate = QDate::currentDate();
}
mMonthSignalOffset = 0;
mSelectedDates.append(startDate);
m_MthYr = startDate;
m_bShowWeekNums = true;
setFont( KOPrefs::instance()->mDateNavigatorFont );
mNavigatorBar = new NavigatorBar( startDate, this );
topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 );
//mNavigatorBar->resize( 1,1);
connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) );
connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) );
connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) );
connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) );
connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) );
// get the day of the week on the first day
QDate dayone(m_MthYr.year(), m_MthYr.month(), 1);
m_fstDayOfWk = dayone.dayOfWeek();
int i;
// Set up the heading fields.
for( i = 0; i < 7; i++ ) {
headings[i] = new QLabel("",this);
//headings[i]->setFont(QFont("Arial", 10, QFont::Bold));
headings[i]->setAlignment(AlignCenter);
+ headings[i]->installEventFilter(this);
topLayout->addWidget(headings[i],1,i+1);
}
// Create the weeknumber labels
for( i = 0; i < 6; i++ ) {
weeknos[i] = new QLabel(this);
weeknos[i]->setAlignment(AlignCenter);
//weeknos[i]->setFont(QFont("Arial", 10));
if(!m_bShowWeekNums) {
weeknos[i]->hide();
}
weeknos[i]->installEventFilter(this);
topLayout->addWidget(weeknos[i],i+2,0);
}
daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix");
daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken);
daymatrix->setLineWidth(1);
connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ),
SIGNAL( datesSelected( const KCal::DateList & ) ) );
connect( daymatrix, SIGNAL( eventDropped( Event * ) ),
SIGNAL( eventDropped( Event * ) ) );
topLayout->addMultiCellWidget(daymatrix,2,7,1,7);
// read settings from configuration file.
updateConfig();
enableRollover(FollowMonth);
mySizeHint = sizeHintTwoButtons();
myFullSizeHint = sizeHintTwoButtons( 4 );
mFontChanged = false;
}
void KDateNavigator::changeFont ( QFont fo )
{
setFont( fo );
mNavigatorBar->resetFont( fo );
}
QFont KDateNavigator::yourFontHint( QSize si , bool *b)
{
QFont fo = KOPrefs::instance()->mDateNavigatorFont;
*b = false;
int fontPoint = fo.pointSize();
while ( fontPoint > 5 ) {
--fontPoint;
@@ -394,55 +395,70 @@ void KDateNavigator::selectDates(const DateList& dateList)
// month. This needs to be done before calling dayToIndex, since it
// relies on this information being up to date.
QDate dayone(m_MthYr.year(), m_MthYr.month(), 1);
m_fstDayOfWk = dayone.dayOfWeek();
updateDates();
daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end()));
updateView();
}
}
int KDateNavigator::dayNum(int row, int col)
{
return 7 * (row - 1) + (col + 1) - m_fstDayOfWk;
}
int KDateNavigator::dayToIndex(int dayNum)
{
int row, col;
row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7;
if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1))
row++;
col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7;
return row * 7 + col;
}
void KDateNavigator::wheelEvent (QWheelEvent *e)
{
if(e->delta()>0) emit goPrevious();
else emit goNext();
e->accept();
}
bool KDateNavigator::eventFilter (QObject *o,QEvent *e)
{
if (e->type() == QEvent::MouseButtonPress) {
int i;
for(i=0;i<6;++i) {
if (o == weeknos[i]) {
QDate weekstart = daymatrix->getDate(i*7);
emit weekClicked(weekstart);
break;
}
}
+ for(i=0;i<7;++i) {
+ if (o == headings[i]) {
+ KCal::DateList selDays;
+ QDate date = daymatrix->getDate(14);
+ int dio = date.daysInMonth();
+ int j;
+ int ye = date.year();
+ int mo = date.month();
+ for ( j = 1; j <= dio; ++j ) {
+ selDays.append( QDate( ye, mo, j ) );
+ }
+ emit datesSelected( selDays );
+ break;
+ }
+ }
return true;
} else {
return false;
}
}
//#include "kdatenavigator.moc"
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index a9f5a41..cc0ce9b 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -376,137 +376,140 @@ void KOViewManager::showAgendaView( bool fullScreen )
mMainView, SLOT(newTodoDateTime(QDateTime,bool)));
connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)),
mMainView, SLOT(newEvent(QDateTime)));
connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)),
mMainView, SLOT(newEvent(QDateTime,QDateTime)));
connect(mAgendaView,SIGNAL(newEventSignal(QDate)),
mMainView, SLOT(newEvent(QDate)));
connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)),
mMainView, SLOT(editIncidence(Incidence *)));
connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)),
mMainView, SLOT(showIncidence(Incidence *)));
connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)),
mMainView, SLOT(deleteIncidence(Incidence *)));
connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ),
mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
connect(mAgendaView, SIGNAL( toggleExpand() ),
mMainView, SLOT( toggleExpand() ) );
connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ),
mAgendaView, SLOT( setExpandedButton( bool ) ) );
connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ),
mMainView, SLOT(cloneIncidence(Incidence *) ) ) ;
connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ),
mMainView, SLOT(cancelIncidence(Incidence *) ) ) ;
connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig()));
connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView,
SLOT( updateTodo( Todo *, int ) ) );
connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )),
mMainView, SIGNAL( todoModified( Todo *, int )));
connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
mMainView, SLOT ( moveIncidence( Incidence * ) ) );
connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
mMainView, SLOT ( beamIncidence( Incidence * ) ) );
connect( mAgendaView, SIGNAL( selectWeekNum( int ) ),
mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) );
mAgendaView->readSettings();
mAgendaView->updateConfig();
}
showView( mAgendaView, full);
}
void KOViewManager::showDayView()
{
+ mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
mFlagShowNextxDays = false;
globalFlagBlockLabel = 1;
globalFlagBlockAgenda = 1;
if ( mCurrentAgendaView != 1 )
mCurrentAgendaView = -1;
showAgendaView();
qApp->processEvents();
globalFlagBlockAgenda = 2;
globalFlagBlockLabel = 0;
mMainView->dateNavigator()->selectDates( 1 );
mCurrentAgendaView = 1 ;
}
void KOViewManager::showWorkWeekView()
{
+ mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
mFlagShowNextxDays = false;
globalFlagBlockAgenda = 1;
globalFlagBlockLabel = 1;
if ( mCurrentAgendaView != 5 )
mCurrentAgendaView = -1;
showAgendaView();
qApp->processEvents();
globalFlagBlockAgenda = 2;
globalFlagBlockLabel = 0;
mMainView->dateNavigator()->selectWorkWeek();
mCurrentAgendaView = 5 ;
}
void KOViewManager::showWeekView()
{
/*
globalFlagBlockAgenda = 2;
qDebug("4globalFlagBlockAgenda = 2; ");
//globalFlagBlockPainting = true;
mMainView->dateNavigator()->selectWeek();
showAgendaView();
*/
+ mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
mFlagShowNextxDays = false;
globalFlagBlockAgenda = 1;
globalFlagBlockLabel = 1;
if ( mCurrentAgendaView != 7 )
mCurrentAgendaView = -1;
showAgendaView();
qApp->processEvents();
globalFlagBlockAgenda = 2;
globalFlagBlockLabel = 0;
mMainView->dateNavigator()->selectWeek();
mCurrentAgendaView = 7 ;
}
void KOViewManager::showNextXView()
{
globalFlagBlockAgenda = 1;
if ( mCurrentAgendaView != 3 )
mCurrentAgendaView = -1;
showAgendaView(KOPrefs::instance()->mFullViewMonth);
globalFlagBlockAgenda = 2;
mMainView->dateNavigator()->selectDates( QDate::currentDate(),
KOPrefs::instance()->mNextXDays );
mFlagShowNextxDays = true;
mCurrentAgendaView = 3 ;
}
bool KOViewManager::showsNextDays()
{
return mFlagShowNextxDays;
}
void KOViewManager::createMonthView()
{
if (!mMonthView) {
mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
addView(mMonthView);
// mMonthView->show();
// SIGNALS/SLOTS FOR MONTH VIEW
connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
mMainView, SLOT(newEvent(QDateTime)));
connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
mMainView, SLOT(showIncidence(Incidence *)));
connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
mMainView, SLOT(editIncidence(Incidence *)));
connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
mMainView, SLOT(deleteIncidence(Incidence *)));