summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp11
-rw-r--r--korganizer/kofilterview.cpp10
-rw-r--r--korganizer/komonthview.cpp12
-rw-r--r--korganizer/koprefs.cpp1
-rw-r--r--korganizer/koprefsdialog.cpp1
5 files changed, 22 insertions, 13 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index e660c32..a8e0678 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -38,195 +38,200 @@
#include <qapplication.h>
#define AGENDA_ICON_SIZE 7
#endif
#include <libkcal/icaldrag.h>
#include <libkcal/vcaldrag.h>
#include <libkcal/kincidenceformatter.h>
extern int globalFlagBlockAgenda;
extern int globalFlagBlockAgendaItemPaint;
extern int globalFlagBlockAgendaItemUpdate;
#include "koprefs.h"
#include "koagendaitem.h"
//#include "koagendaitem.moc"
//--------------------------------------------------------------------------
QToolTipGroup *KOAgendaItem::mToolTipGroup = 0;
//--------------------------------------------------------------------------
class KOAgendaItemWhatsThis :public QWhatsThis
{
public:
KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { };
protected:
virtual QString text( const QPoint& )
{
return _view->getWhatsThisText() ;
}
private:
KOAgendaItem * _view;
};
KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday,
const char *name,WFlags) :
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()->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) ;
+
+ QColor BackgroundColor ( mBackgroundColor );
+ if ( mIncidence->calID() > 1 ) {
+ BackgroundColor = KOPrefs::instance()->defaultColor( mIncidence->calID() );
+ }
+ mColorGroup = QColorGroup( BackgroundColor.light(),
+ BackgroundColor.dark(),BackgroundColor.light(),
+ BackgroundColor.dark(),BackgroundColor, black, BackgroundColor) ;
setBackgroundColor( mBackgroundColor );
mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250);
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() && 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;
}
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index 52bc463..a653c18 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -251,170 +251,170 @@ void KOCalEditView::infoCal( int id )
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 ( viewport() );
addChild(mw);
mainLayout = new QGridLayout ( mw , 2, 8 );
mainLayout->setMargin( 3);
mainLayout->setSpacing( 2);
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 \n Resource "), mw );
mainLayout->addWidget( lab,0,2 );
lab = new QLabel ( i18n(" "), mw );
mainLayout->addWidget( lab,0,3 );
lab->setFixedWidth( 6 );
addBut = new QPushButton ( mw );
mainLayout->addWidget( addBut,0,4 );
addBut->setPixmap ( SmallIcon("bell"));
connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm()));
addBut->setMaximumWidth( addBut->sizeHint().height() );
addBut = new QPushButton ( mw );
mainLayout->addWidget( addBut,0,5 );
addBut->setPixmap ( SmallIcon("pencil"));
connect(addBut,SIGNAL(clicked()),SLOT(disableRO()));
addBut->setMaximumWidth( addBut->sizeHint().height() );
lab = new QLabel ( i18n(" Color "), mw );
mainLayout->addWidget( lab,0,6 );
#if 0
addBut = new QPushButton ( mw );
mainLayout->addWidget( addBut,0,6 );
addBut->setPixmap ( SmallIcon("minus"));
connect(addBut,SIGNAL(clicked()),SLOT(deleteAll()));
addBut->setMaximumWidth( addBut->sizeHint().height() );
#endif
KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
int row = 1;
while ( kkf ) {
int iii = 0;
KOCalCheckButton* cb = new KOCalCheckButton( mw );
mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb );
cb->setChecked( kkf->isStandard );
cb->setNum( kkf->mCalNumber );
connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) );
if ( kkf->mErrorOnLoad || kkf->isReadOnly )
cb->setEnabled( false );
cb = new KOCalCheckButton( mw );
mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb );
cb->setChecked( kkf->isEnabled );
cb->setNum( kkf->mCalNumber );
if ( kkf->mErrorOnLoad )
cb->setEnabled( false );
connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) );
KOCalButton* name = new KOCalButton( mw );
name->setNum( kkf->mCalNumber );
name->setText( kkf->mName );
mainLayout->addWidget( name,row,++iii );
connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) );
lab = new QLabel ( i18n(" "), mw );
mainLayout->addWidget( lab,row,++iii );
cb = new KOCalCheckButton( mw );
mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb );
cb->setChecked( kkf->isAlarmEnabled );
cb->setNum( kkf->mCalNumber );
connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) );
if ( kkf->mErrorOnLoad )
cb->setEnabled( false );
cb = new KOCalCheckButton( mw );
mainLayout->addWidget( cb,row,++iii );mROB.append( cb );
cb->setChecked( kkf->isReadOnly );
cb->setNum( kkf->mCalNumber );
connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) );
if ( kkf->mErrorOnLoad )
cb->setEnabled( false );
- KColorButton *colb = new KColorButton( mw );
- mainLayout->addWidget( colb,row,++iii );
- colb->setID( kkf->mCalNumber );
- colb->setColor( kkf->mDefaultColor );
- connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) );
if ( row > 1) {
+ KColorButton *colb = new KColorButton( mw );
+ mainLayout->addWidget( colb,row,++iii );
+ colb->setID( kkf->mCalNumber );
+ colb->setColor( kkf->mDefaultColor );
+ connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) );
KOCalButton* calb = new KOCalButton( mw );
mainLayout->addWidget( calb,row,++iii );
calb->setNum( kkf->mCalNumber );
calb->setPixmap ( SmallIcon("minus"));
connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) );
int hei = calb->sizeHint().height();
//calb->setMaximumSize( hei*9/10, hei*9/10 );
}
++row;
kkf = KOPrefs::instance()->mCalendars.next();
}
lab = new QLabel ( "", mw );
mainLayout->addWidget( lab,row,0 );
mw->show();
}
void KOCalEditView::addCal()
{
KONewCalPrefs prefs ( this );
if ( ! prefs.exec() )
return;
QString name = prefs.calName();
QString file = prefs.calFileName();
QFileInfo fi ( file );
if (!fi.exists() ) {
KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!"));
return;
}
KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar();
kkf->mName = name;
kkf->mFileName = file;
emit calendarAdded( kkf->mCalNumber );
emit needsUpdate();
QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
}
void KOCalEditView::enableAll()
{
toggleList( mEnabledB );
}
void KOCalEditView::enableAlarm()
{
toggleList( mAlarmB );
}
void KOCalEditView::disableRO()
{
toggleList( mROB );
}
void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list )
{
bool dis = false;
KOCalCheckButton* it = list.first();
while ( it ) {
if ( !it->isChecked() ) {
dis = true;
break;
}
it = list.next();
}
it = list.first();
while ( it ) {
it->setChecked(dis);
it = list.next();
}
}
void KOCalEditView::deleteAll()
{
qDebug("delteAll");
}
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 96f2502..2150654 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -637,281 +637,285 @@ void MonthViewCell::startUpdateCell()
if ( !mHolidayString.isEmpty() ) {
MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString );
item->setPalette( mHolidayPalette );
insertItem( item );
mToolTip.append ( mHolidayString );
}
#endif
}
int MonthViewCell::insertEvent(Event *event)
{
bool useToolTips = true;
#ifndef DESKTOP_VERSION
useToolTips = false;
#endif
QString mToolTipText;
setFocusPolicy(WheelFocus);
if ( !(event->doesRecur() == Recurrence::rNone) ) {
if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily )
return mdayCount;
else
if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
return mdayCount;
}
if ( event->isHoliday()) {
setHoliday( true );
if ( mDate.dayOfWeek() == 7 )
setLineWidth( 3 );
}
QString text;
int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
if (event->isMultiDay()) {
QString prefix = "<->";multiday = 2;
QString time;
if ( event->doesRecur() ) {
if ( event->recursOn( mDate) ) {
prefix ="->" ;multiday = 1;
}
else {
int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
if ( event->recursOn( mDate.addDays( -days)) ) {
prefix ="<-" ;multiday = 3;
}
}
} else {
if (mDate == event->dtStart().date()) {
prefix ="->" ;multiday = 1;
} else if (mDate == event->dtEnd().date()) {
prefix ="<-" ;multiday = 3;
}
}
if ( !event->doesFloat() ) {
if ( mDate == event->dtStart().date () )
time = KGlobal::locale()->formatTime(event->dtStart().time())+" ";
else if ( mDate == event->dtEnd().date () )
time = KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
}
text = time + event->summary();
if ( useToolTips )
mToolTipText += prefix + text;
} else {
if (event->doesFloat()) {
text = event->summary();
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);
+ //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
+ pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( event->calID() ));
} else {
pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
}
} else {
if (cat.isEmpty()) {
- pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
+ //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
+ pal = QPalette( KOPrefs::instance()->defaultColor( event->calID() ), KOPrefs::instance()->defaultColor( event->calID() ));
} 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 && 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);
+ //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
+ pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( todo->calID() ));
} else {
pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
}
} else {
if (cat.isEmpty()) {
- pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
+ //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
+ pal = QPalette(KOPrefs::instance()->defaultColor( todo->calID() ), KOPrefs::instance()->defaultColor( todo->calID() ));
} 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() && 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()) {
insertTodo( todo );
}
finishUpdateCell();
// if ( isVisible())
//qApp->processEvents();
}
void MonthViewCell::updateConfig( bool bigFont ) // = false
{
if ( bigFont ) {
QFont fo = KOPrefs::instance()->mMonthViewFont;
int ps = fo.pointSize() + 2;
if ( ps < 18 )
ps += 2;
fo.setPointSize( ps );
setFont( fo );
} else
setFont( KOPrefs::instance()->mMonthViewFont );
QFontMetrics fm( font() );
mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 );
mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 );
mHolidayPalette = mStandardPalette;
mPrimaryPalette = mStandardPalette;
mNonPrimaryPalette = mStandardPalette;
if ( KOPrefs::instance()->mMonthViewUsesDayColors ) {
mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor );
mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor );
mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark());
mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark());
mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor);
mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor);
mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark());
mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor);
mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor);
}
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index e679bd3..65f0342 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -404,191 +404,192 @@ QStringList KOPrefs::getDefaultList()
return retval;
}
void KOPrefs::usrReadConfig()
{
config()->setGroup("General");
//qDebug("KOPrefs::usrReadConfig() ");
mCustomCategories = config()->readListEntry("Custom Categories");
mOldLoadedLanguage = mOldLanguage ;
mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
if (mLocationDefaults.isEmpty()) {
mLocationDefaults = getLocationDefaultList();
}
if (mEventSummaryUser.isEmpty()) {
mEventSummaryUser = getDefaultList() ;
}
if (mTodoSummaryUser.isEmpty()) {
mTodoSummaryUser = getDefaultList() ;
}
if (mCustomCategories.isEmpty()) setCategoryDefaults();
config()->setGroup("Personal Settings");
mName = config()->readEntry("user_name","");
mEmail = config()->readEntry("user_email","");
fillMailDefaults();
config()->setGroup("Category Colors");
QStringList::Iterator it;
for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
}
KConfig fc (locateLocal("config","kopicalendarrc"));
fc.setGroup("CC");
int numCals = fc.readNumEntry("NumberCalendars",0 );
mNextAvailableCalendar = 1;
if ( numCals == 0 ) {
KopiCalendarFile *kkf = getNewCalendar();
kkf->isStandard = true;
kkf->mName = i18n("Standard");
kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
}
while ( mNextAvailableCalendar <= numCals ) {
//qDebug("Read cal #%d ", mNextAvailableCalendar );
QString prefix = "Cal_" +QString::number( mNextAvailableCalendar );
KopiCalendarFile *kkf = getNewCalendar();
kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false );
kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true);
kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true);
kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false);
kkf->mName = fc.readEntry( prefix+"_Name", "Calendar");
kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName);
kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor);
if ( kkf->mCalNumber == 1 ) {
kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
}
}
KPimPrefs::usrReadConfig();
}
KopiCalendarFile * KOPrefs::getCalendar( int num )
{
return mDefCalColors[num-1];
}
KopiCalendarFile * KOPrefs::getNewCalendar()
{
KopiCalendarFile * kkf = new KopiCalendarFile();
kkf->mCalNumber = mNextAvailableCalendar;
mDefCalColors.resize( mNextAvailableCalendar );
mDefCalColors[mNextAvailableCalendar-1] = kkf;
++mNextAvailableCalendar;
kkf->mDefaultColor = mEventColor;
kkf->mName = i18n("New Calendar");
mCalendars.append( kkf );
return kkf;
}
void KOPrefs::deleteCalendar( int num )
{
KopiCalendarFile * kkf = mCalendars.first();
while ( kkf ) {
if ( kkf->mCalNumber == num ) {
qDebug("KOPrefs::deleteCalendar %d ", num );
mCalendars.remove( kkf );
delete kkf;
return;
}
kkf = mCalendars.next();
}
}
QColor KOPrefs::defaultColor( int calNum ) const
{
+ if ( calNum == 1 ) return mEventColor;
return (mDefCalColors[calNum-1])->mDefaultColor;
}
void KOPrefs::usrWriteConfig()
{
config()->setGroup("General");
config()->writeEntry("Custom Categories",mCustomCategories);
config()->setGroup("Personal Settings");
config()->writeEntry("user_name",mName);
config()->writeEntry("user_email",mEmail);
config()->setGroup("Category Colors");
QDictIterator<QColor> it(mCategoryColors);
while (it.current()) {
config()->writeEntry(it.currentKey(),*(it.current()));
++it;
}
KConfig fc (locateLocal("config","kopicalendarrc"));
fc.setGroup("CC");
fc.writeEntry("NumberCalendars",mCalendars.count());
int numCal = 1;
int writeCal = 0;
while ( numCal < mNextAvailableCalendar ) {
KopiCalendarFile * kkf = mCalendars.first();
while ( kkf ) {
//qDebug("cal num %d %d ", kkf->mCalNumber, numCal);
if ( kkf->mCalNumber == numCal ) {
++writeCal;
//qDebug("Write calendar %d %d ", numCal , writeCal);
QString prefix = "Cal_" + QString::number( writeCal );
fc.writeEntry( prefix+"_isStandard", kkf->isStandard );
fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled );
fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled );
fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly );
fc.writeEntry( prefix+"_Name", kkf->mName);
fc.writeEntry( prefix+"_FileName", kkf->mFileName);
fc.writeEntry( prefix+"_Color",kkf->mDefaultColor);
}
kkf = mCalendars.next();
}
++numCal;
}
fc.sync();
KPimPrefs::usrWriteConfig();
}
void KOPrefs::setCategoryColor(QString cat,const QColor & color)
{
mCategoryColors.replace(cat,new QColor(color));
}
QColor *KOPrefs::categoryColor(QString cat)
{
QColor *color = 0;
if (!cat.isEmpty()) color = mCategoryColors[cat];
if (color) return color;
else return &mDefaultCategoryColor;
}
void KOPrefs::setFullName(const QString &name)
{
mName = name;
}
void KOPrefs::setEmail(const QString &email)
{
//qDebug(" KOPrefs::setEmai*********** %s",email.latin1() );
mEmail = email;
}
QString KOPrefs::fullName()
{
if (mEmailControlCenter) {
KEMailSettings settings;
return settings.getSetting(KEMailSettings::RealName);
} else {
return mName;
}
}
QString KOPrefs::email()
{
if (mEmailControlCenter) {
KEMailSettings settings;
return settings.getSetting(KEMailSettings::EmailAddress);
} else {
return mEmail;
}
}
KConfig* KOPrefs::getConfig()
{
return config();
}
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index 3ee9a22..35a56ca 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -1372,168 +1372,167 @@ void KOPrefsDialog::setupGroupAutomationTab()
autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook"));
//autoFreeBusyGroup->addRadio(i18n("selected emails"));
topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0);
}
void KOPrefsDialog::showPrinterTab()
{
showPage(pageIndex(mPrinterTab));
}
void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text,
const QStringList *tags)
{
if (tags) {
int i = tags->findIndex(text);
if (i > 0) combo->setCurrentItem(i);
} else {
for(int i=0;i<combo->count();++i) {
if (combo->text(i) == text) {
combo->setCurrentItem(i);
break;
}
}
}
}
void KOPrefsDialog::usrReadConfig()
{
mNameEdit->setText(KOPrefs::instance()->fullName());
mEmailEdit->setText(KOPrefs::instance()->email());
mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval);
mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime);
mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration);
mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime);
mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays);
mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays);
mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios);
// mAMails->clear();
// for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin();
// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) {
// QListViewItem *item = new QListViewItem(mAMails);
// item->setText(0,*it);
// mAMails->insertItem(item);
// }
//that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile);
mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile);
updateCategories();
mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps );
mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime );
mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount );
mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval );
}
void KOPrefsDialog::usrWriteConfig()
{
KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text();
KOPrefs::instance()->setFullName(mNameEdit->text());
KOPrefs::instance()->setEmail(mEmailEdit->text());
KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value();
KOPrefs::instance()->mStartTime = mStartTimeSpin->value();
KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value();
KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem();
QDictIterator<QColor> it(mCategoryDict);
while (it.current()) {
KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current());
++it;
}
KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value();
KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value();
KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value();
KOPrefs::instance()->mAdditionalMails.clear();
// QListViewItem *item;
// item = mAMails->firstChild();
// while (item)
// {
// KOPrefs::instance()->mAdditionalMails.append( item->text(0) );
// item = item->nextSibling();
// }
KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value();
KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ;
KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ;
KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ;
-
}
void KOPrefsDialog::updateCategories()
{
mCategoryCombo->clear();
mCategoryDict.clear();
mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
updateCategoryColor();
}
void KOPrefsDialog::toggleEmailSettings(bool on)
{
if (on) {
mEmailEdit->setEnabled(false);
mNameEdit->setEnabled(false);
mEmailLabel->setEnabled(false);
mNameLabel->setEnabled(false);
KEMailSettings settings;
mNameEdit->setText(settings.getSetting(KEMailSettings::RealName));
mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress));
} else {
mEmailEdit->setEnabled(true);
mNameEdit->setEnabled(true);
mEmailLabel->setEnabled(true);
mNameLabel->setEnabled(true);
}
}
void KOPrefsDialog::addItem()
{
// aEmailsEdit->setEnabled(true);
// QListViewItem *item = new QListViewItem(mAMails);
// mAMails->insertItem(item);
// mAMails->setSelected(item,true);
// aEmailsEdit->setText(i18n("(EmptyEmail)"));
}
void KOPrefsDialog::removeItem()
{
// QListViewItem *item;
// item = mAMails->selectedItem();
// if (!item) return;
// mAMails->takeItem(item);
// item = mAMails->selectedItem();
// if (!item) {
// aEmailsEdit->setText("");
// aEmailsEdit->setEnabled(false);
// }
// if (mAMails->childCount() == 0) {
// aEmailsEdit->setEnabled(false);
// }
}
void KOPrefsDialog::updateItem()
{
// QListViewItem *item;
// item = mAMails->selectedItem();
// if (!item) return;
// item->setText(0,aEmailsEdit->text());
}
void KOPrefsDialog::updateInput()
{
// QListViewItem *item;
// item = mAMails->selectedItem();
// if (!item) return;
// aEmailsEdit->setEnabled(true);
// aEmailsEdit->setText(item->text(0));
}