summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp8
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/koagendaitem.cpp4
-rw-r--r--korganizer/kofilterview.cpp4
-rw-r--r--korganizer/kofilterview.h1
-rw-r--r--korganizer/komonthview.cpp4
-rw-r--r--korganizer/kotodoview.cpp4
-rw-r--r--korganizer/kotodoviewitem.cpp2
-rw-r--r--korganizer/kowhatsnextview.cpp4
9 files changed, 24 insertions, 8 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 07ec459..6e60c56 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -418,96 +418,99 @@ void CalendarView::init()
}
#endif
QWidget *rightBox = new QWidget( mPanner );
QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
mRightFrame = new QWidgetStack( rightBox );
rightLayout->addWidget( mRightFrame, 1 );
mLeftFrame = mLeftSplitter;
#else
//QWidget *mainBox = new QWidget( this );
//QWidget *leftFrame = new QWidget( mainBox );
//QBoxLayout * mainBoxLayout;
if ( KOPrefs::instance()->mVerticalScreen ) {
//mainBoxLayout = new QVBoxLayout(mainBox);
//leftFrameLayout = new QHBoxLayout(leftFrame );
mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
} else {
//mainBoxLayout = new QHBoxLayout(mainBox);
//leftFrameLayout = new QVBoxLayout(leftFrame );
mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
}
mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
//QBoxLayout * leftFrameLayout;
topLayout->addWidget( mMainFrame );
//mainBoxLayout->addWidget (mLeftFrame);
mDateNavigator = new DateNavigatorContainer( mLeftFrame,
"CalendarView::DateNavigator" );
#if 0
// FIXME
mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
"CalendarView::DateNavigator", QDate::currentDate());
#endif
// mDateNavigator->blockSignals( true );
//leftFrameLayout->addWidget( mDateNavigator );
mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView");
connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) );
connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) );
connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) );
connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) );
+ connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) );
+ connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) );
+ connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) );
mTodoList->setNavigator( mNavigator );
#if 0
if ( QApplication::desktop()->width() < 480 ) {
leftFrameLayout->addWidget(mFilterView);
leftFrameLayout->addWidget(mTodoList, 2 );
} else {
leftFrameLayout->addWidget(mTodoList,2 );
leftFrameLayout->addWidget(mFilterView );
}
#endif
mFilterView->hide();
mCalEditView->hide();
QWidget *rightBox = new QWidget( mMainFrame );
//mainBoxLayout->addWidget ( rightBox, 10 );
QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
mRightFrame = new QWidgetStack( rightBox );
rightLayout->addWidget( mRightFrame, 10 );
//mLeftFrame = (QWidget *)leftFrame;
if ( KOPrefs::instance()->mVerticalScreen ) {
//mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
//mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
//mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
//leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
} else {
//mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
//mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
//leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
}
if ( !KOPrefs::instance()->mShowDateNavigator)
mDateNavigator->hide();
//qDebug("Calendarview Size %d %d ", width(), height());
#endif
connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
SLOT( showDates( const KCal::DateList & ) ) );
connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
mViewManager, SLOT( showMonth( const QDate & ) ) );
connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
mNavigator, SLOT( selectWeek( const QDate & ) ) );
@@ -1824,96 +1827,101 @@ bool CalendarView::importQtopia( const QString &categories,
#endif
}
void CalendarView::setSyncEventsReadOnly()
{
Event * ev;
QPtrList<Event> eL = mCalendar->rawEvents();
ev = eL.first();
while ( ev ) {
if ( ev->uid().left(15) == QString("last-syncEvent-") )
ev->setReadOnly( true );
ev = eL.next();
}
}
bool CalendarView::loadCalendars()
{
QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
KopiCalendarFile * cal = calendars.first();
mCalendar->setDefaultCalendar( 1 );
openCalendar( MainWindow::defaultFileName(), false );
cal = calendars.next();
while ( cal ) {
addCalendar( cal );
cal = calendars.next();
}
restoreCalendarSettings();
mCalendar->reInitAlarmSettings();
setSyncEventsReadOnly();
updateUnmanagedViews();
updateView();
}
bool CalendarView::restoreCalendarSettings()
{
QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
KopiCalendarFile * cal = calendars.first();
while ( cal ) {
mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled );
mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled );
mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly );
if ( cal->isStandard )
mCalendar->setDefaultCalendar( cal->mCalNumber );
cal = calendars.next();
}
}
+void CalendarView::addCalendarId( int id )
+{
+ KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id );
+ addCalendar( cal );
+}
bool CalendarView::addCalendar( KopiCalendarFile * cal )
{
if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber ))
return true;
qDebug("KO: Error adding calendar file %1 ",cal->mFileName.latin1() );
KMessageBox::error(this,i18n("Error loading calendar file\n%1.").arg(cal->mFileName));
return false;
}
bool CalendarView::openCalendar(QString filename, bool merge)
{
if (filename.isEmpty()) {
return false;
}
if (!QFile::exists(filename)) {
KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
return false;
}
globalFlagBlockAgenda = 1;
clearAllViews();
if (!merge) {
mViewManager->setDocumentId( filename );
mCalendar->close();
}
mStorage->setFileName( filename );
if ( mStorage->load() ) {
if ( merge ) ;//setModified( true );
else {
//setModified( true );
mViewManager->setDocumentId( filename );
mDialogManager->setDocumentId( filename );
mTodoList->setDocumentId( filename );
}
globalFlagBlockAgenda = 2;
// if ( getLastSyncEvent() )
// getLastSyncEvent()->setReadOnly( true );
mCalendar->reInitAlarmSettings();
setSyncEventsReadOnly();
updateUnmanagedViews();
updateView();
if ( filename != MainWindow::defaultFileName() ) {
saveCalendar( MainWindow::defaultFileName() );
} else {
QFileInfo finf ( MainWindow::defaultFileName());
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 0144ba4..ec5b7ab 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -182,96 +182,97 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
is possible or not.
*/
void pasteEnabled(bool);
/** Emitted, when the number of incoming messages has changed. */
void numIncomingChanged(int);
/** Emitted, when the number of outgoing messages has changed. */
void numOutgoingChanged(int);
/** Send status message, which can e.g. be displayed in the status bar. */
void statusMessage(const QString &);
void calendarViewExpanded( bool );
void updateSearchDialog();
public slots:
void checkAlarms();
void slotprintSelInc();
void showNextAlarms();
void showOpenError();
void watchSavedFile();
void recheckTimerAlarm();
void checkNextTimerAlarm();
void addAlarm(const QDateTime &qdt, const QString &noti );
void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
void removeAlarm(const QDateTime &qdt, const QString &noti );
/** options dialog made a changed to the configuration. we catch this
* and notify all widgets which need to update their configuration. */
void updateConfig();
void insertBirthdays(const QString& uid, const QStringList& birthdayList,
const QStringList& anniversaryList, const QStringList& realNameList,
const QStringList& emailList, const QStringList& assembledNameList,
const QStringList& uidList);
/**
Load calendar from file \a filename. If \a merge is true, load
calendar into existing one, if it is false, clear calendar, before
loading. Return true, if calendar could be successfully loaded.
*/
bool openCalendar(QString filename, bool merge=false);
bool loadCalendars();
bool saveCalendars();
bool restoreCalendarSettings();
bool addCalendar( KopiCalendarFile * );
+ void addCalendarId( int id );
bool syncCalendar(QString filename,int mode = 0 );
/**
Save calendar data to file. Return true if calendar could be
successfully saved.
*/
bool saveCalendar(QString filename);
/**
Close calendar. Clear calendar data and reset views to display an empty
calendar.
*/
void closeCalendar();
/** Archive old events of calendar */
void archiveCalendar();
void showIncidence();
void editIncidence();
void editIncidenceDescription();
void deleteIncidence();
void cloneIncidence();
void moveIncidence();
void beamIncidence();
void toggleCancelIncidence();
/** create an editeventwin with supplied date/time, and if bool is true,
* make the event take all day. */
void newEvent(QDateTime, QDateTime, bool allDay );
void newEvent(QDateTime, QDateTime);
void newEvent(QDateTime fh);
void newEvent(QDate dt);
/** create new event without having a date hint. Takes current date as
default hint. */
void newEvent();
void newFloatingEvent();
/** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
void showIncidence(Incidence *);
void showIncidence(QString uid);
/** Create an editor for the supplied incidence. It calls the correct editXXX method*/
void editIncidence(Incidence *);
/** Delete the supplied incidence. It calls the correct deleteXXX method*/
void deleteIncidence(Incidence *);
void cloneIncidence(Incidence *);
void cancelIncidence(Incidence *);
/** Create an editor for the supplied event. */
void editEvent(Event *);
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 5a3c4d2..c7bc6eb 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -76,177 +76,177 @@ KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool
QWidget(parent, name), mIncidence(incidence), mDate(qd)
{
#ifndef DESKTOP_VERSION
//QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
#endif
mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this);
int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase
setWFlags ( wflags);
mAllDay = allday;
init ( incidence, qd );
//setMouseTracking(true);
//setAcceptDrops(true);
xPaintCoord = -1;
yPaintCoord = -1;
}
QString KOAgendaItem::getWhatsThisText()
{
if ( mIncidence )
return KIncidenceFormatter::instance()->getFormattedText( mIncidence,
KOPrefs::instance()->mWTshowDetails,
KOPrefs::instance()->mWTshowCreated,
KOPrefs::instance()->mWTshowChanged);
return "KOAgendaItem::getWhatsThisText()::internal error";
}
void KOAgendaItem::init ( Incidence *incidence, QDate qd )
{
mIncidence = incidence;
mDate = qd;
mFirstMultiItem = 0;
mNextMultiItem = 0;
mLastMultiItem = 0;
computeText();
if ( (incidence->typeID() == todoID ) &&
( !((static_cast<Todo*>(incidence))->isCompleted()) &&
((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
else
mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
}
else {
QStringList categories = mIncidence->categories();
QString cat = categories.first();
if (cat.isEmpty()) {
if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) )
mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
else
- mBackgroundColor =KOPrefs::instance()->mEventColor;
+ mBackgroundColor =KOPrefs::instance()->defaultColor( incidence->calID() );
} else {
mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) {
if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
}
}
}
mColorGroup = QColorGroup( mBackgroundColor.light(),
mBackgroundColor.dark(),mBackgroundColor.light(),
mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ;
setBackgroundColor( mBackgroundColor );
mConflictItems.clear();
setCellXY(0,0,1);
setCellXWidth(0);
setSubCell(0);
setSubCells(1);
setMultiItem(0,0,0);
startMove();
mSelected = true;
select(false);
QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont);
mFontPixelSize = fontinf.height();;
hide();
xPaintCoord = -1;
yPaintCoord = -1;
}
KOAgendaItem::~KOAgendaItem()
{
#if QT_VERSION >= 0x030000
#else
delete mKOAgendaItemWhatsThis;
#endif
}
void KOAgendaItem::recreateIncidence()
{
#if 0
Incidence* newInc = mIncidence->clone();
newInc->recreate();
if ( mIncidence->doesRecur() ) {
mIncidence->addExDate( mDate );
newInc->recurrence()->unsetRecurs();
int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd());
QTime tim = mIncidence->dtStart().time();
newInc->setDtStart( QDateTime(mDate, tim) );
((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
}
#endif
mIncidence = mIncidence->recreateCloneException( mDate );
}
bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
{
int size = AGENDA_ICON_SIZE;
int yOff = 0;
int xOff = 0;
int x = pos().x() +3;
int y;
if ( mAllDay )
y = pos().y()+3;
else
y = mCellYTop * ( height() / cellHeight() ) +3;
if (mIncidence->cancelled()) {
int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x;
int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y;
p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 );
p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos );
if ( horLayout )
++xOff;
else
++yOff;
}
- if (mIncidence->isAlarmEnabled()) {
+ if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) {
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red );
if ( horLayout )
++xOff;
else
++yOff;
}
if (mIncidence->recurrence()->doesRecur()) {
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue );
if ( horLayout )
++xOff;
else
++yOff;
}
if (mIncidence->description().length() > 0) {
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen );
if ( horLayout )
++xOff;
else
++yOff;
}
if (mIncidence->isReadOnly()) {
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white );
if ( horLayout )
++xOff;
else
++yOff;
}
if (mIncidence->attendeeCount()>0) {
if (mIncidence->organizer() == KOPrefs::instance()->email()) {
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black );
if ( horLayout )
++xOff;
else
++yOff;
} else {
Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
if (me!=0) {
} else {
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow );
if ( horLayout )
++xOff;
else
++yOff;
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index 29a4393..2b16347 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -113,147 +113,151 @@ void KOFilterView::updateFilters()
while(filter) {
mSelectionCombo->insertItem(filter->name());
filter = mFilters->next();
}
}
CalFilter *KOFilterView::selectedFilter()
{
CalFilter *f = mFilters->at(mSelectionCombo->currentItem());
return f;
}
void KOFilterView::setSelectedFilter(QString filterName)
{
int filter_num = mSelectionCombo->count();
int i;
for (i=0;i<filter_num;i++) {
if (mSelectionCombo->text(i)==filterName)
mSelectionCombo->setCurrentItem(i);
}
emit filterChanged();
}
void KOFilterView::setSelectedFilter( int fil )
{
if ( fil >= mSelectionCombo->count() )
return;
mSelectionCombo->setCurrentItem( fil );
emit filterChanged();
}
KOCalEditView::KOCalEditView(QWidget* parent,
const char* name )
: QWidget(parent,name)
{
mw = 0;
ml = new QVBoxLayout ( this );
}
KOCalEditView::~KOCalEditView()
{
// no need to delete child widgets, Qt does it all for us
}
void KOCalEditView::selectCal(int id ,bool b)
{
KOPrefs::instance()->getCalendar( id )->isEnabled = b;
emit calendarEnabled ( id, b );
+ emit needsUpdate();
}
void KOCalEditView::selectStdCal( int id, bool b )
{
if ( !b ) {
KOCalCheckButton* it = (KOCalCheckButton*) sender();
if ( it ) {
it->blockSignals( true );
it->setChecked( true );
it->blockSignals( false );
return;
}
return;
}
KOCalCheckButton* sen = (KOCalCheckButton*) sender();
KOCalCheckButton* it = mStdandardB.first();
while ( it ) {
if ( it->isChecked() ) {
if ( it != sen ) {
it->blockSignals( true );
it->setChecked( false );
it->blockSignals( false );
break;
}
}
it = mStdandardB.next();
}
KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
while ( kkf ) {
kkf->isStandard = false;
kkf = KOPrefs::instance()->mCalendars.next();
}
KOPrefs::instance()->getCalendar( id )->isStandard = true;
emit setCalendarDefault ( id );
}
void KOCalEditView::selectCalAlarm(int id ,bool b )
{
KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b;
emit alarmEnabled ( id , b );
+ emit needsUpdate();
}
void KOCalEditView::selectReadOnly(int id ,bool b )
{
KOPrefs::instance()->getCalendar( id )->isReadOnly = b;
emit calendarReadonly ( id , b );
+ emit needsUpdate();
}
void KOCalEditView::setColor( const QColor& c, int id )
{
KOPrefs::instance()->getCalendar( id )->mDefaultColor = c;
+ emit needsUpdate();
}
void KOCalEditView::deleteCal( int id )
{
KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id );
QString name = kkf->mName;
QString file = kkf->mFileName;
if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b><tr> Do you want to remove this calendar from KO/Pi? (The file is not removed, of course!)").arg(name).arg(file) ) != KMessageBox::Continue ) return;
emit removeCalendar ( id );
KOPrefs::instance()->mCalendars.remove ( kkf );
readConfig();
}
void KOCalEditView::infoCal( int id )
{
QString name = KOPrefs::instance()->getCalendar( id )->mName;
QString file = KOPrefs::instance()->getCalendar( id )->mFileName;
KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) );
}
void KOCalEditView::readConfig()
{
mStdandardB.clear();
mEnabledB.clear();
mAlarmB.clear();
mROB.clear();
if ( mw ) delete mw;
mw = new QWidget ( this );
ml->addWidget ( mw );
mainLayout = new QGridLayout ( mw , 2, 8 );
//mainLayout->setSpacing( 3 );
QPushButton * addBut = new QPushButton ( mw );
mainLayout->addWidget( addBut,0,0 );
addBut->setPixmap ( SmallIcon("plus"));
connect(addBut,SIGNAL(clicked()),SLOT(addCal()));
addBut->setMaximumWidth( addBut->sizeHint().height() );
addBut = new QPushButton ( mw );
mainLayout->addWidget( addBut,0,1 );
addBut->setPixmap ( SmallIcon("eye"));
connect(addBut,SIGNAL(clicked()),SLOT(enableAll()));
addBut->setMaximumWidth( addBut->sizeHint().height() );
QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", mw );
mainLayout->addWidget( lab,0,2 );
addBut = new QPushButton ( mw );
mainLayout->addWidget( addBut,0,3 );
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h
index aaf0eb6..4a0cd8a 100644
--- a/korganizer/kofilterview.h
+++ b/korganizer/kofilterview.h
@@ -93,63 +93,64 @@ class KOFilterView : public KOFilterView_base
public:
KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0);
~KOFilterView();
void updateFilters();
bool filtersEnabled();
void setFiltersEnabled(bool);
CalFilter *selectedFilter();
void setSelectedFilter(QString);
void setSelectedFilter( int );
signals:
void filterChanged();
void editFilters();
private:
QPtrList<CalFilter> *mFilters;
};
class KOCalEditView : public QWidget
{
Q_OBJECT
public:
KOCalEditView( QWidget* parent=0,const char* name=0);
~KOCalEditView();
void readConfig();
public slots:
void addCal();
void enableAll();
void enableAlarm();
void disableRO();
void deleteAll();
void selectStdCal(int,bool );
void selectCal(int,bool );
void selectCalAlarm(int,bool );
void selectReadOnly(int,bool );
void setColor(const QColor &,int) ;
void deleteCal(int) ;
void infoCal(int) ;
signals:
void alarmEnabled ( int cal, bool enable );
void calendarEnabled ( int cal, bool enable );
void calendarReadonly ( int cal, bool readonly );
void setCalendarDefault ( int cal );
void removeCalendar ( int cal );
void calendarAdded( int );
+ void needsUpdate();
private:
QVBoxLayout* ml;
QWidget *mw;
void toggleList ( QPtrList<KOCalCheckButton> );
QPtrList<KOCalCheckButton> mStdandardB;
QPtrList<KOCalCheckButton> mEnabledB;
QPtrList<KOCalCheckButton> mAlarmB;
QPtrList<KOCalCheckButton> mROB;
QGridLayout* mainLayout;
};
#endif // KOFILTERVIEW_H
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index c868270..96f2502 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -703,178 +703,178 @@ int MonthViewCell::insertEvent(Event *event)
if ( useToolTips )
mToolTipText += text;
}
else {
text = KGlobal::locale()->formatTime(event->dtStart().time());
text += " " + event->summary();
if ( useToolTips )
mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
}
}
if ( useToolTips && ! event->location().isEmpty() ) {
mToolTipText += " (" + event->location() +")";
}
MonthViewItem *item ;
if ( mAvailItemList.count() ) {
item = mAvailItemList.first();
mAvailItemList.remove( item );
item->recycle( event, mDate, text );
} else {
item = new MonthViewItem( event, mDate, text );
}
QPalette pal;
if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
QStringList categories = event->categories();
QString cat = categories.first();
if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
pal = getPalette();
if (cat.isEmpty()) {
pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
} else {
pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
}
} else {
if (cat.isEmpty()) {
pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
} else {
pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
}
}
} else {
pal = mStandardPalette ;
}
item->setPalette( pal );
item->setRecur( event->recurrence()->doesRecur() );
- item->setAlarm( event->isAlarmEnabled() && multiday < 2 );
+ item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() );
item->setMoreInfo( event->description().length() > 0 );
#ifdef DESKTOP_VERSION
Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails,
KOPrefs::instance()->email());
if ( me != 0 ) {
if ( me->status() == Attendee::NeedsAction && me->RSVP())
item->setReply(true && multiday < 2);
else
item->setReply(false);
} else
item->setReply(false);
#endif
item->setMultiDay( multiday );
if ( multiday ) {
insertItem( item ,mdayCount);
++mdayCount;
} else {
uint i;
int pos = mdayCount;
for ( i = mdayCount; i < count();++i ) {
QListBoxItem* it = this->item ( i );
if ( it && text < it->text() ) {
pos = i;
break;
}
++pos;
}
insertItem( item ,pos);
}
if ( useToolTips ) {
mToolTip.append( mToolTipText );
}
return mdayCount;
}
void MonthViewCell::insertTodo(Todo *todo)
{
setFocusPolicy(WheelFocus);
QString text;
if (todo->hasDueDate()) {
if (!todo->doesFloat()) {
text += KGlobal::locale()->formatTime(todo->dtDue().time());
text += " ";
}
}
text += todo->summary();
MonthViewItem *item ;
if ( mAvailItemList.count() ) {
item = mAvailItemList.first();
mAvailItemList.remove( item );
item->recycle( todo, mDate, text );
} else {
item = new MonthViewItem( todo, mDate, text );
}
//MonthViewItem *item = new MonthViewItem( todo, mDate, text );
//item->setPalette( mStandardPalette );
QPalette pal;
if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
QStringList categories = todo->categories();
QString cat = categories.first();
if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
pal = getPalette();
if (cat.isEmpty()) {
pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
} else {
pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
}
} else {
if (cat.isEmpty()) {
pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
} else {
pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
}
}
} else {
pal = mStandardPalette ;
}
item->setPalette( pal );
item->setRecur( todo->recurrence()->doesRecur() );
- item->setAlarm( todo->isAlarmEnabled() );
+ item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() );
item->setMoreInfo( todo->description().length() > 0 );
insertItem( item , count());
#ifdef DESKTOP_VERSION
mToolTip.append( text );
#endif
}
void MonthViewCell::repaintfinishUpdateCell()
{
MonthViewItem *mitem = (MonthViewItem*) firstItem ();
while ( mitem ) {
mitem->setBlockRepaint( false );
updateItem ( mitem );
mitem = (MonthViewItem *)mitem->next();
}
}
void MonthViewCell::finishUpdateCell()
{
#ifdef DESKTOP_VERSION
if (mToolTip.count() > 0 ) {
mToolTip.sort();
QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),"");
}
#endif
//sort();
//setMyPalette();
setMyPalette();
resizeEvent( 0 );
}
void MonthViewCell::updateCell()
{
if ( !mMonthView->isUpdatePossible() )
return;
startUpdateCell();
//mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
Event *event;
for( event = events.first(); event; event = events.next() ) { // for event
insertEvent(event);
}
// insert due todos
QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
Todo *todo;
for(todo = todos.first(); todo; todo = todos.next()) {
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 2602487..35c2a9f 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -659,97 +659,97 @@ void KOTodoView::updateView()
mTodoListView->clear();
if ( mName == "todolistsmall" ) {
if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
int ps = fo.pointSize() -2;
if ( ps > 12 )
ps -= 2;
fo.setPointSize( ps );
}
}
mTodoListView->setFont( fo );
// QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
//mTodoListView->header()->setMaximumHeight(fm.height());
QPtrList<Todo> todoList = calendar()->todos();
/*
kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
Event *t;
for(t = todoList.first(); t; t = todoList.next()) {
kdDebug() << " " << t->getSummary() << endl;
if (t->getRelatedTo()) {
kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
}
QPtrList<Event> l = t->getRelations();
Event *c;
for(c=l.first();c;c=l.next()) {
kdDebug() << " - relation: " << c->getSummary() << endl;
}
}
*/
// Put for each Event a KOTodoViewItem in the list view. Don't rely on a
// specific order of events. That means that we have to generate parent items
// recursively for proper hierarchical display of Todos.
mTodoMap.clear();
Todo *todo;
todo = todoList.first();// todo; todo = todoList.next()) {
while ( todo ) {
bool next = true;
// qDebug("todo %s ", todo->summary().latin1());
Incidence *incidence = todo->relatedTo();
while ( incidence ) {
if ( incidence->typeID() == todoID ) {
//qDebug("related %s ",incidence->summary().latin1() );
- if ( !(todoList.contains ( ((Todo* )incidence ) ) )) {
+ if ( !(todoList.contains ( ((Todo* )incidence ) ) ) && incidence->calEnabled() ) {
//qDebug("related not found ");
todoList.remove( );
todo = todoList.current();
next = false;
incidence = 0;
} else {
//qDebug("related found ");
incidence = incidence->relatedTo();
}
} else
incidence = 0;
}
if ( next )
todo = todoList.next();
}
for(todo = todoList.first(); todo; todo = todoList.next()) {
if (!mTodoMap.contains(todo) && checkTodo( todo ) )
{
insertTodoItem(todo);
}
}
// Restore opened/closed state
mTodoListView->blockSignals( true );
if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
mTodoListView->blockSignals( false );
resetCurrentItem();
processSelectionChange();
}
void KOTodoView::storeCurrentItem()
{
mCurItem = 0;
mCurItemRootParent = 0;
mCurItemParent = 0;
mCurItemAbove = 0;
mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
if (mActiveItem) {
mCurItem = mActiveItem->todo();
KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove ();
if ( activeItemAbove )
mCurItemAbove = activeItemAbove->todo();
mCurItemRootParent = mCurItem;
mCurItemParent = mCurItemRootParent->relatedTo();
while ( mCurItemRootParent->relatedTo() != 0 )
mCurItemRootParent = mCurItemRootParent->relatedTo();
}
@@ -799,96 +799,98 @@ void KOTodoView::resetCurrentItem()
} else {
mTodoListView->setCurrentItem( mTodoListView->firstChild () );
}
}
mTodoListView->setFocus();
}
//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove;
bool KOTodoView::checkTodo( Todo * todo )
{
if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() )
return false;
if ( !todo->isCompleted() ) {
if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() )
return true;
}
if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) {
if ( todo->hasStartDate() )
if ( mNavigator->selectedDates().last() < todo->dtStart().date() )
return false;
if ( todo->hasDueDate() )
if ( mNavigator->selectedDates().first() > todo->dtDue().date() )
return false;
}
return true;
}
void KOTodoView::restoreItemState( QListViewItem *item )
{
pendingSubtodo = 0;
while( item ) {
KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) );
if( item->childCount() > 0 ) restoreItemState( item->firstChild() );
item = item->nextSibling();
}
}
QMap<Todo *,KOTodoViewItem *>::ConstIterator
KOTodoView::insertTodoItem(Todo *todo)
{
// kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl;
// TODO: Check, if dynmaic cast is necessary
pendingSubtodo = 0;
Incidence *incidence = todo->relatedTo();
+ while ( incidence && !incidence->calEnabled() )
+ incidence = incidence->relatedTo();
if (incidence && incidence->typeID() == todoID ) {
Todo *relatedTodo = static_cast<Todo *>(incidence);
// kdDebug() << " has Related" << endl;
QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
itemIterator = mTodoMap.find(relatedTodo);
if (itemIterator == mTodoMap.end()) {
// kdDebug() << " related not yet in list" << endl;
itemIterator = insertTodoItem (relatedTodo);
}
// isn't this pretty stupid? We give one Todo to the KOTodoViewItem
// and one into the map. Sure finding is more easy but why? -zecke
KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this);
return mTodoMap.insert(todo,todoItem);
} else {
// kdDebug() << " no Related" << endl;
// see above -zecke
KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
return mTodoMap.insert(todo,todoItem);
}
}
void KOTodoView::updateConfig()
{
updateView();
mTodoListView->repaintContents();
}
QPtrList<Incidence> KOTodoView::selectedIncidences()
{
QPtrList<Incidence> selected;
KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
// if (!item) item = mActiveItem;
if (item) selected.append(item->todo());
return selected;
}
QPtrList<Todo> KOTodoView::selectedTodos()
{
QPtrList<Todo> selected;
KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
// if (!item) item = mActiveItem;
if (item) selected.append(item->todo());
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 8cb6b83..f987b63 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -150,97 +150,97 @@ void KOTodoViewItem::construct()
}
setText(5,keyd);
setText(6,keyt);
setSortKey(5,skeyd);
setSortKey(6,skeyt);
setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No"));
setText(8,mTodo->categoriesStr());
#if 0
// Find sort id in description. It's the text behind the last '#' character
// found in the description. White spaces are removed from beginning and end
// of sort id.
int pos = mTodo->description().findRev('#');
if (pos < 0) {
setText(6,"");
} else {
QString str = mTodo->description().mid(pos+1);
str.stripWhiteSpace();
setText(6,str);
}
#endif
m_known = false;
m_init = false;
setMyPixmap();
}
void KOTodoViewItem::setMyPixmap()
{
int size = 5;
QPixmap pixi = QPixmap( 1, 1 );
// if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) {
// pixi = SmallIcon("redcross16");
// } else {
QPainter p;
int pixSize = 0;
QPixmap pPix = QPixmap( size, size );
if ( mTodo->description().length() > 0 ) {
pixi.resize(size, pixSize+size);
pPix.fill( Qt::darkGreen );
p.begin( &pixi );
p. drawPixmap ( 0, pixSize, pPix);
p.end();
pixSize += size;
}
- if ( mTodo->isAlarmEnabled() ) {
+ if ( mTodo->isAlarmEnabled() && mTodo->alarmEnabled()) {
pixi.resize(size, pixSize+size);
pPix.fill( Qt::red );
p.begin( &pixi );
p. drawPixmap ( 0, pixSize, pPix);
p.end();
pixSize += size;
}
if ( mTodo->doesRecur() ) {
pixi.resize(size, pixSize+size);
pPix.fill( Qt::blue );
p.begin( &pixi );
p. drawPixmap ( 0, pixSize, pPix);
p.end();
pixSize += size;
}
// }
if ( pixi.width() > 1 ) {
setPixmap ( 0,pixi ) ;
} else {
setPixmap ( 0,QPixmap() ) ;
}
}
void KOTodoViewItem::stateChange(bool state)
{
// qDebug("KOTodoViewItem::stateChange %d ", state);
// do not change setting on startup
if ( m_init ) return;
if (isOn()!=state) {
setOn(state);
//qDebug("SETON ");
return;
}
if ( mTodo->isCompleted() == state ) {
//qDebug("STATECHANGE:nothing to do ");
return;
}
QString keyd = "==";
QString keyt = "==";
//qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1());
if ( mTodo->doesRecur() ){
QDateTime start = mTodo->dtStart();
mTodo->setCompleted(state);
if ( start != mTodo->dtStart() ) {
if ( state && !mTodo->isCompleted() ) {
setOn( false );
state = false;
}
}
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index e8574a0..221debc 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -550,171 +550,171 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
} else {
if ( bDay ) {
if ( ev->isBirthday())
tempText += "<font color=\"#00B000\">" + i18n("Birthday") +":</font>";
else
tempText += "<font color=\"#00B0000\">" + i18n("Anniversary")+":</font>";
} else {
tempText += i18n("Allday:");
}
}
}
} else {
mTodos.append( ev );
tempText += i18n("ToDo:");
if (reply) {
tempText += " ";
if ( noc != cdt ) {
tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
}
} else {
if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) {
// tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
QString dfs = KGlobal::locale()->dateFormatShort();
KGlobal::locale()->setDateFormatShort("%d.%b");
tempText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>";
KGlobal::locale()->setDateFormatShort(dfs);
} else {
if (!ev->doesFloat() )
if( ( (Todo*)ev)->dtDue() < cdt ) {
tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>";
} else
tempText +=((Todo*)ev)->dtDueTimeStr();
mTodos.append( ev );
}
}
}
tempText += "</b></td><td>";
bool needClose = false;
if ( ev->cancelled() ) {
tempText += "<font color=\"#F00000\">[c";
needClose =true;
}
- if ( ev->isAlarmEnabled() ) {
+ if ( ev->isAlarmEnabled() && ev->alarmEnabled()) {
if ( !needClose)
tempText +="[";
tempText += "a";
needClose =true;
}
if ( ev->description().length() > 0 ) {
if ( !needClose)
tempText +="[";
tempText += "i";
needClose =true;
}
if ( ev->recurrence()->doesRecur() ) {
if ( !needClose)
tempText +="[";
tempText += "r";
needClose =true;
}
if ( needClose ) {
tempText += "] ";
}
if ( ev->cancelled() )
tempText += "</font>";
tempText += "<a ";
if (ev->typeID() == eventID ) tempText += "href=\"event:";
if (ev->typeID() == todoID ) tempText += "href=\"todo:";
tempText += ev->uid() + "\">";
if ( ev->summary().length() > 0 )
tempText += ev->summary();
else
tempText += i18n("-no summary-");
if ( bDay ) {
noc = ev->getNextOccurence( cdt.addDays(-1), &ok );
if ( ok ) {
int years = 0;
if ( ev->typeID() == todoID ) {
years = noc.date().year() -((Todo*)ev)->dtDue().date().year();
} else
years = noc.date().year() - ev->dtStart().date().year();
tempText += i18n(" (%1 y.)"). arg( years );
}
}
tempText += "</a>";
if ( KOPrefs::instance()->mWNViewShowLocation )
if ( !ev->location().isEmpty() )
tempText += " ("+ev->location() +")";
if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents)
tempText += " ["+ev->relatedTo()->summary() +"]";
tempText += "</td></tr>\n";
mText += tempText;
return true;
}
bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
{
if ( mTodos.find( ev ) != mTodos.end() ) return false;
mTodos.append( ev );
if ( !isSub )
mText += "<p>";
else
mText += "<li>";
mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] ";
mText += ind;
bool needClose = false;
if ( ev->cancelled() ) {
mText += "<font color=\"#F00000\">[c";
needClose =true;
}
- if ( ev->isAlarmEnabled() ) {
+ if ( ev->isAlarmEnabled() && ev->alarmEnabled() ) {
if ( !needClose)
mText +="[";
mText += "a";
needClose =true;
}
if ( ev->description().length() > 0 ) {
if ( !needClose)
mText +="[";
mText += "i";
needClose =true;
}
if ( ev->doesRecur() ) {
if ( !needClose)
mText +="[";
mText += "r";
needClose =true;
}
// if ( ev->recurrence()->doesRecur() ) {
// if ( !needClose)
// mText +="(";
// mText += "r";
// needClose =true;
// }
if ( needClose )
mText += "] ";
if ( ev->cancelled() )
mText += "</font>";
mText += "<a href=\"todo:" + ev->uid() + "\">";
if ( ev->summary().length() > 0 )
mText += ev->summary();
else
mText += i18n("-no summary-");
mText += "</a>";
if ( ((Todo*)ev)->hasDueDate () ) {
QString year = "";
int ye = ((Todo*)ev)->dtDue().date().year();
if ( QDateTime::currentDateTime().date().year() != ye )
year = QString::number( ye );
QString dfs = KGlobal::locale()->dateFormatShort();
KGlobal::locale()->setDateFormatShort("%d.%b");
mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>";
KGlobal::locale()->setDateFormatShort(dfs);
}
if ( KOPrefs::instance()->mWNViewShowLocation )
if ( !ev->location().isEmpty() )
mText += " ("+ev->location() +")";