author | zautrix <zautrix> | 2005-01-31 09:56:31 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-31 09:56:31 (UTC) |
commit | 3e0b1c7cd48903b6886e081210cd83b7441b48ac (patch) (side-by-side diff) | |
tree | 69c1937849a14b137df9c76285e061b1f4620df7 /korganizer | |
parent | 1c5f4d993bf5eeb4a21bacf61671a1a08ed1f3cd (diff) | |
download | kdepimpi-3e0b1c7cd48903b6886e081210cd83b7441b48ac.zip kdepimpi-3e0b1c7cd48903b6886e081210cd83b7441b48ac.tar.gz kdepimpi-3e0b1c7cd48903b6886e081210cd83b7441b48ac.tar.bz2 |
color fixes
-rw-r--r-- | korganizer/koagendaitem.cpp | 10 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 1 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | korganizer/koprefsdialog.cpp | 6 |
4 files changed, 17 insertions, 1 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index ee9f39a..a05c60e 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -1,730 +1,738 @@ /* This file is part of KOrganizer. Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qlabel.h> #include <qlayout.h> #include <qhbox.h> #include <qvbox.h> #include <qtooltip.h> #include <qwhatsthis.h> #include <qdragobject.h> #include <qdrawutil.h> #include <qpainter.h> #include <kiconloader.h> #include <kdebug.h> #include <kglobal.h> #include <klocale.h> #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #define AGENDA_ICON_SIZE 5 #else #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; //-------------------------------------------------------------------------- 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 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase setWFlags ( wflags); mAllDay = allday; init ( incidence, qd ); setMouseTracking(true); //setAcceptDrops(true); xPaintCoord = -1; yPaintCoord = -1; } void KOAgendaItem::init ( Incidence *incidence, QDate qd ) { mIncidence = incidence; mDate = qd; mFirstMultiItem = 0; mNextMultiItem = 0; mLastMultiItem = 0; computeText(); if ( (incidence->type() == "Todo") && ( !((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()) { - mBackgroundColor =KOPrefs::instance()->mEventColor; + if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) + mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; + else + mBackgroundColor =KOPrefs::instance()->mEventColor; } else { mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); + if ( (incidence->type() == "Todo") &&((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 ); 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() { // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); } 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()) { 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; } p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); if ( horLayout ) ++xOff; else ++yOff; } } return ( yOff || xOff ); } void KOAgendaItem::select(bool selected) { //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); if (mSelected == selected) return; mSelected = selected; if ( ! isVisible() ) return; if ( firstMultiItem() ) firstMultiItem()->select( selected ); if ( !firstMultiItem() && nextMultiItem() ) { KOAgendaItem * placeItem = nextMultiItem(); while ( placeItem ) { placeItem->select( selected ); placeItem = placeItem->nextMultiItem(); } } globalFlagBlockAgendaItemUpdate = 0; paintMe( selected ); globalFlagBlockAgendaItemUpdate = 1; repaint( false ); } /* The eventFilter has to filter the mouse events of the agenda item childs. The events are fed into the event handling method of KOAgendaItem. This allows the KOAgenda to handle the KOAgendaItems by using an eventFilter. */ bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) { if (e->type() == QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonDblClick || e->type() == QEvent::MouseButtonRelease || e->type() == QEvent::MouseMove) { QMouseEvent *me = (QMouseEvent *)e; QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> mapToGlobal(me->pos())); QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); return event(&returnEvent); } else { return false; } } void KOAgendaItem::repaintMe( ) { paintMe ( mSelected ); } void KOAgendaItem::paintMe( bool selected, QPainter* paint ) { if ( globalFlagBlockAgendaItemUpdate && ! selected) return; QPainter pa; if ( mSelected ) { pa.begin( paintPixSel() ); } else { if ( mAllDay ) pa.begin( paintPixAllday() ); else pa.begin( paintPix() ); } int x, yy, w, h; float nfh; x = pos().x(); w = width(); h = height (); if ( mAllDay ) yy = y(); else yy = mCellYTop * ( height() / cellHeight() ); xPaintCoord= x; yPaintCoord = yy; wPaintCoord = width(); hPaintCoord = height(); //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); if ( paint == 0 ) paint = &pa; bool horLayout = ( w < h ); int maxhei = mFontPixelSize+4; if ( horLayout ) maxhei += AGENDA_ICON_SIZE -4; bool small = ( h < maxhei ); if ( ! small ) paint->setFont(KOPrefs::instance()->mAgendaViewFont); else { QFont f = KOPrefs::instance()->mAgendaViewFont; f.setBold( false ); int fh = f.pointSize(); nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; if ( nfh < 6 ) nfh = 6; f.setPointSize( nfh ); paint->setFont(f); } paint->fillRect ( x, yy, w, h, mBackgroundColor ); static const QPixmap completedPxmp = SmallIcon("greenhook16"); static const QPixmap overduePxmp = SmallIcon("redcross16"); if ( mIncidence->type() == "Todo" ) { Todo* tempTodo = static_cast<Todo*>(mIncidence); int xx = pos().x()+(width()-completedPxmp.width()-3 ); int yyy = yy+3; if ( tempTodo->isCompleted() ) paint->drawPixmap ( xx, yyy, completedPxmp ); else { paint->drawPixmap ( xx, yyy, overduePxmp ); } } bool addIcon = false; if ( ! small || w > 3 * h || h > 3* w ) addIcon = updateIcons( paint, horLayout ); qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); if ( ! small ) { x += 3; yy += 3;w -= 6; h-= 5; } else { x += 2; yy += 1;w -= 4; h-= 4; if ( nfh < 6.01 ) { yy -= 2; h += 4; } else if ( nfh < h -2 ) ++yy; } int align; #ifndef DESKTOP_VERSION align = ( AlignLeft|WordBreak|AlignTop); #else align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); #endif if ( addIcon ) { if ( ! horLayout ) { x += AGENDA_ICON_SIZE+3; w -= (AGENDA_ICON_SIZE+3); } else { yy+= AGENDA_ICON_SIZE+2; h -=(AGENDA_ICON_SIZE+3); } } int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue(); if ( colsum < 250 ) paint->setPen ( white); if ( x < 0 ) { w = w+x-3; x = 3; if ( w > parentWidget()->width() ){ w = parentWidget()->width() - 6; #ifndef DESKTOP_VERSION align = ( AlignCenter|WordBreak); #else align = ( AlignCenter|BreakAnywhere|WordBreak); #endif } } QRect dr; paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); if ( mIncidence->cancelled() ){ if ( ! small ) { QFontMetrics fm ( paint->font() ); paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); } } pa.end(); } void KOAgendaItem::resizePixmap( int w , int h ) { paintPix()->resize( w, h ); paintPixSel()->resize( w, h ); } QPixmap * KOAgendaItem::paintPix() { static QPixmap* mPaintPix = 0; if ( ! mPaintPix ) mPaintPix = new QPixmap(1,1); return mPaintPix ; } QPixmap * KOAgendaItem::paintPixAllday() { static QPixmap* mPaintPixA = 0; if ( ! mPaintPixA ) mPaintPixA = new QPixmap(1,1); return mPaintPixA ; } QPixmap * KOAgendaItem::paintPixSel() { static QPixmap* mPaintPixSel = 0; if ( ! mPaintPixSel ) mPaintPixSel = new QPixmap(1,1); return mPaintPixSel ; } void KOAgendaItem::paintEvent ( QPaintEvent *e ) { if ( globalFlagBlockAgendaItemPaint ) return; if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) return; int yy; if ( mAllDay ) yy = y(); else yy = mCellYTop * ( height() / cellHeight() ); int xx = x(); if ( xPaintCoord != xx || yPaintCoord != yy || wPaintCoord != width() || hPaintCoord != height()) { xPaintCoord= xx; yPaintCoord = yy; wPaintCoord = width(); hPaintCoord = height(); globalFlagBlockAgendaItemUpdate = 0; paintMe( mSelected ); //qDebug("calling paintMe "); globalFlagBlockAgendaItemUpdate = 1; } int rx, ry, rw, rh; rx = e->rect().x(); ry = e->rect().y(); rw = e->rect().width(); rh = e->rect().height(); //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); QPixmap* paintFrom ; if ( mSelected ) { paintFrom = paintPixSel(); } else { if ( mAllDay ) paintFrom = paintPixAllday(); else paintFrom = paintPix(); } bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP); } void KOAgendaItem::computeText() { mDisplayedText = mIncidence->summary(); if ( (mIncidence->type() == "Todo") ) { if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; else if ( !(mIncidence->doesFloat())) mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; } } else { if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; if ( mAllDay ) { if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; } } } if ( !mIncidence->location().isEmpty() ) { if ( mAllDay ) mDisplayedText += " ("; else mDisplayedText += "\n("; mDisplayedText += mIncidence->location() +")"; } QString tipText = mIncidence->summary(); QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); if ( !mIncidence->doesFloat() ) { if ( mIncidence->type() == "Event" ) { if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); } else { tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); } } else if ( mIncidence->type() == "Todo" ) { if (mIncidence->hasStartDate()) tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); } } else if ( mIncidence->type() == "Todo" ) { if (mIncidence->hasStartDate()) tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); } if (!mIncidence->location().isEmpty()) { tipText += "\n"+i18n("Location: ")+mIncidence->location(); } QToolTip::add(this,tipText,toolTipGroup(),""); } void KOAgendaItem::updateItem() { computeText(); //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); paintMe( mSelected ); repaint( false); } void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) { //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1()); paintMe( mSelected ); repaint( false ); } /* Return height of item in units of agenda cells */ int KOAgendaItem::cellHeight() { int ret = mCellYBottom - mCellYTop + 1; if ( ret <= 0 ) { ret = 1; mCellYBottom = 0; mCellYTop = 0; } return ret; } /* Return height of item in units of agenda cells */ int KOAgendaItem::cellWidth() { return mCellXWidth - mCellX + 1; } void KOAgendaItem::setItemDate(QDate qd) { mDate = qd; } void KOAgendaItem::setCellXY(int X, int YTop, int YBottom) { mCellX = X; mCellYTop = YTop; mCellYBottom = YBottom; } void KOAgendaItem::setCellXWidth(int xwidth) { mCellXWidth = xwidth; } void KOAgendaItem::setCellX(int XLeft, int XRight) { mCellX = XLeft; mCellXWidth = XRight; } void KOAgendaItem::setCellY(int YTop, int YBottom) { mCellYTop = YTop; mCellYBottom = YBottom; } void KOAgendaItem::setSubCell(int subCell) { mSubCell = subCell; } void KOAgendaItem::setSubCells(int subCells) { mSubCells = subCells; } void KOAgendaItem::setMultiItem(KOAgendaItem *first,KOAgendaItem *next, KOAgendaItem *last) { mFirstMultiItem = first; mNextMultiItem = next; mLastMultiItem = last; } void KOAgendaItem::startMove() { mStartCellX = mCellX; mStartCellXWidth = mCellXWidth; mStartCellYTop = mCellYTop; mStartCellYBottom = mCellYBottom; } void KOAgendaItem::resetMove() { mCellX = mStartCellX; mCellXWidth = mStartCellXWidth; mCellYTop = mStartCellYTop; mCellYBottom = mStartCellYBottom; } void KOAgendaItem::moveRelative(int dx, int dy) { int newX = cellX() + dx; int newXWidth = cellXWidth() + dx; int newYTop = cellYTop() + dy; int newYBottom = cellYBottom() + dy; setCellXY(newX,newYTop,newYBottom); setCellXWidth(newXWidth); } void KOAgendaItem::expandTop(int dy) { int newYTop = cellYTop() + dy; int newYBottom = cellYBottom(); if (newYTop > newYBottom) newYTop = newYBottom; setCellY(newYTop, newYBottom); } void KOAgendaItem::expandBottom(int dy) { int newYTop = cellYTop(); int newYBottom = cellYBottom() + dy; if (newYBottom < newYTop) newYBottom = newYTop; setCellY(newYTop, newYBottom); } void KOAgendaItem::expandLeft(int dx) { int newX = cellX() + dx; int newXWidth = cellXWidth(); if (newX > newXWidth) newX = newXWidth; setCellX(newX,newXWidth); } void KOAgendaItem::expandRight(int dx) { int newX = cellX(); int newXWidth = cellXWidth() + dx; if (newXWidth < newX) newXWidth = newX; setCellX(newX,newXWidth); } QToolTipGroup *KOAgendaItem::toolTipGroup() { if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); return mToolTipGroup; } void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e ) { #ifndef KORG_NODND if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) || !QTextDrag::canDecode( e ) ) { e->ignore(); return; } e->accept(); #endif } void KOAgendaItem::dropEvent( QDropEvent *e ) { #ifndef KORG_NODND QString text; if(QTextDrag::decode(e,text)) { kdDebug() << "Dropped : " << text << endl; QStringList emails = QStringList::split(",",text); for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { kdDebug() << " Email: " << (*it) << endl; int pos = (*it).find("<"); QString name = (*it).left(pos); QString email = (*it).mid(pos); if (!email.isEmpty()) { mIncidence->addAttendee(new Attendee(name,email)); } } } #endif } QPtrList<KOAgendaItem> KOAgendaItem::conflictItems() { return mConflictItems; } void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci) { mConflictItems = ci; KOAgendaItem *item; for ( item=mConflictItems.first(); item != 0; item=mConflictItems.next() ) { item->addConflictItem(this); } } void KOAgendaItem::addConflictItem(KOAgendaItem *ci) { if (mConflictItems.find(ci)<0) mConflictItems.append(ci); } diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 32cc291..0548f14 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp @@ -1,475 +1,476 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <time.h> #ifndef _WIN32_ #include <unistd.h> #endif #include <qdir.h> #include <qtextstream.h> #include <qtextcodec.h> #include <qstring.h> #include <qregexp.h> #include <qfont.h> #include <qcolor.h> #include <qstringlist.h> #include <stdlib.h> #include <kglobal.h> #include <kconfig.h> #include <klocale.h> #include <kdebug.h> #include <kemailsettings.h> #include <kstaticdeleter.h> #include <libkdepim/kpimglobalprefs.h> #include "koprefs.h" #include "mainwindow.h" KOPrefs *KOPrefs::mInstance = 0; static KStaticDeleter<KOPrefs> insd; KOPrefs::KOPrefs() : KPimPrefs("korganizerrc") { mCategoryColors.setAutoDelete(true); fillMailDefaults(); mDefaultCategoryColor = QColor(175,210,255);//196,196,196); QColor defaultHolidayColor = QColor(255,0,0); QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); QColor defaultTodoDueTodayColor = QColor(255,220,100); QColor defaultTodoOverdueColor = QColor(255,153,125); mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); mDefaultViewFont = QFont("helvetica",10); mDefaultMonthViewFont = QFont("helvetica",8); mMarcusBainsFont= QFont("helvetica",10); mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); mEditBoxFont = QFont("helvetica",12); mJornalViewFont = QFont("helvetica",12); KPrefs::setCurrentGroup("General"); addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); addItemBool("ShowIconSearch",&mShowIconSearch,true); addItemBool("ShowIconList",&mShowIconList,true); addItemBool("ShowIconDay1",&mShowIconDay1,true); addItemBool("ShowIconDay5",&mShowIconDay5,true); addItemBool("ShowIconDay7",&mShowIconDay7,true); addItemBool("ShowIconMonth",&mShowIconMonth,true); addItemBool("ShowIconTodoview",&mShowIconTodoview,true); addItemBool("ShowIconBackFast",&mShowIconBackFast,true); addItemBool("ShowIconBack",&mShowIconBack,true); addItemBool("ShowIconToday",&mShowIconToday,true); addItemBool("ShowIconForward",&mShowIconForward,true); addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); addItemBool("ShowIconNextDays",&mShowIconNextDays,true); addItemBool("ShowIconNext",&mShowIconNext,true); addItemBool("ShowIconJournal",&mShowIconJournal,true); addItemBool("ShowIconStretch",&mShowIconStretch,true); addItemInt("LastLoadedLanguage",&mOldLanguage,0); addItemBool("AskForQuit",&mAskForQuit,false); #ifndef DESKTOP_VERSION addItemBool("ShowFullMenu",&mShowFullMenu,false); #else addItemBool("ShowFullMenu",&mShowFullMenu,true); #endif addItemBool("ToolBarHor",&mToolBarHor, true ); addItemBool("ToolBarUp",&mToolBarUp, false ); addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); addItemInt("Whats Next Days",&mWhatsNextDays,3); addItemInt("Whats Next Prios",&mWhatsNextPrios,1); addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); addItemInt("AllDay Size",&mAllDaySize,28); QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); addItemStringList("LocationDefaults",&mLocationDefaults ); addItemStringList("EventSummary User",&mEventSummaryUser); addItemStringList("TodoSummary User",&mTodoSummaryUser); addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); addItemBool("Enable Project View",&mEnableProjectView,false); addItemBool("Auto Save",&mAutoSave,false); addItemInt("Auto Save Interval",&mAutoSaveInterval,3); addItemBool("Confirm Deletes",&mConfirm,true); addItemString("Archive File",&mArchiveFile); addItemString("Html Export File",&mHtmlExportFile, QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); addItemBool("Html With Save",&mHtmlWithSave,false); KPrefs::setCurrentGroup("Personal Settings"); addItemInt("Mail Client",&mMailClient,MailClientKMail); addItemBool("Use Control Center Email",&mEmailControlCenter,false); addItemBool("Bcc",&mBcc,false); KPrefs::setCurrentGroup("Time & Date"); addItemInt("Default Start Time",&mStartTime,10); addItemInt("Default Duration",&mDefaultDuration,2); addItemInt("Default Alarm Time",&mAlarmTime,3); KPrefs::setCurrentGroup("AlarmSettings"); addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); KPrefs::setCurrentGroup("Calendar"); addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); KPrefs::setCurrentGroup("Fonts"); // qDebug(" KPrefs::setCurrentGroup(Fonts); "); addItemFont("TimeBar Font",&mTimeBarFont); addItemFont("MonthView Font",&mMonthViewFont); addItemFont("AgendaView Font",&mAgendaViewFont); addItemFont("MarcusBains Font",&mMarcusBainsFont); addItemFont("TimeLabels Font",&mTimeLabelsFont); addItemFont("TodoView Font",&mTodoViewFont); addItemFont("ListView Font",&mListViewFont); addItemFont("DateNavigator Font",&mDateNavigatorFont); addItemFont("EditBox Font",&mEditBoxFont); addItemFont("JournalView Font",&mJornalViewFont); addItemFont("WhatsNextView Font",&mWhatsNextFont); addItemFont("EventView Font",&mEventViewFont); KPrefs::setCurrentGroup("RemoteSyncing"); addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); addItemBool("ShowSyncEvents",&mShowSyncEvents,false); addItemInt("LastSyncTime",&mLastSyncTime,0); #ifdef _WIN32_ QString hdp= locateLocal("data","korganizer")+"\\\\"; #else QString hdp= locateLocal("data","korganizer")+"/"; #endif KPrefs::setCurrentGroup("LoadSaveFileNames"); addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); KPrefs::setCurrentGroup("Locale"); addItemBool("ShortDateInViewer",&mShortDateInViewer,false); KPrefs::setCurrentGroup("Colors"); addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); + addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); addItemBool("UseAppColors",&mUseAppColors,false); KPrefs::setCurrentGroup("Views"); addItemBool("Show Date Navigator",&mShowDateNavigator,true); addItemInt("Hour Size",&mHourSize,8); addItemBool("Show Daily Recurrences",&mDailyRecur,true); addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); addItemBool("ShowShortMonthName",&mMonthShowShort,false); addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); #ifdef DESKTOP_VERION addItemBool("Enable ToolTips",&mEnableToolTips,true); #else addItemBool("Enable ToolTips",&mEnableToolTips,false); #endif addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); #ifdef DESKTOP_VERSION addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); #else addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); #endif addItemInt("Day Begins",&mDayBegins,7); addItemInt("Working Hours Start",&mWorkingHoursStart,8); addItemInt("Working Hours End",&mWorkingHoursEnd,17); addItemBool("Exclude Holidays",&mExcludeHolidays,true); addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); addItemBool("Full View Month",&mFullViewMonth,true); addItemBool("Full View Todo",&mFullViewTodo,true); addItemBool("Quick Todo",&mEnableQuickTodo,false); addItemInt("Next X Days",&mNextXDays,3); KPrefs::setCurrentGroup("Printer"); KPrefs::setCurrentGroup("Layout"); addItemBool("CompactDialogs",&mCompactDialogs,false); addItemBool("VerticalScreen",&mVerticalScreen,true); KPrefs::setCurrentGroup("KOrganizer Plugins"); addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); KPrefs::setCurrentGroup("Group Scheduling"); addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); addItemStringList("AdditionalMails",&mAdditionalMails,""); addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); KPrefs::setCurrentGroup( "Editors" ); addItemStringList( "EventTemplates", &mEventTemplates ); addItemStringList( "TodoTemplates", &mTodoTemplates ); addItemInt("DestinationPolicy",&mDestination,standardDestination); } KOPrefs::~KOPrefs() { if (mInstance == this) mInstance = insd.setObject(0); //qDebug("KOPrefs::~KOPrefs() "); } KOPrefs *KOPrefs::instance() { if (!mInstance) { mInstance = insd.setObject(new KOPrefs()); mInstance->readConfig(); } return mInstance; } void KOPrefs::usrSetDefaults() { } void KOPrefs::fillMailDefaults() { if (mName.isEmpty()) mName = i18n("Anonymous"); if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); } void KOPrefs::setTimeZoneIdDefault() { ; } void KOPrefs::setCategoryDefaults() { mCustomCategories.clear(); mCustomCategories = getDefaultList(); QStringList::Iterator it; for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { setCategoryColor(*it,mDefaultCategoryColor); } } QStringList KOPrefs::getDefaultList() { QStringList retval ; retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; retval.sort(); return retval; } void KOPrefs::usrReadConfig() { config()->setGroup("General"); mCustomCategories = config()->readListEntry("Custom Categories"); if ( KPimGlobalPrefs::instance()->mPreferredLanguage != mOldLanguage ) { mLocationDefaults.clear(); mEventSummaryUser.clear(); mTodoSummaryUser.clear(); } mOldLoadedLanguage = mOldLanguage ; mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; if (mLocationDefaults.isEmpty()) { mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") mLocationDefaults.sort(); } 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)); } KPimPrefs::usrReadConfig(); } 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; } 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/koprefs.h b/korganizer/koprefs.h index b3acda7..8b849fa 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h @@ -1,278 +1,279 @@ /* This file is part of KOrganizer. Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #ifndef KOPREFS_H #define KOPREFS_H #include <libkdepim/kpimprefs.h> #include <qdict.h> class KConfig; class QFont; class QColor; class QStringList; class KOPrefs : public KPimPrefs { public: enum { FormatVCalendar, FormatICalendar }; enum { MailClientKMail, MailClientSendmail }; enum { IMIPDummy, IMIPKMail }; enum { IMIPOutbox, IMIPdirectsend }; enum { neverAuto, addressbookAuto, selectedAuto }; enum { standardDestination, askDestination }; virtual ~KOPrefs(); /** Get instance of KOPrefs. It is made sure that there is only one instance. */ static KOPrefs *instance(); /** Set preferences to default values */ void usrSetDefaults(); /** Read preferences from config file */ void usrReadConfig(); /** Write preferences to config file */ void usrWriteConfig(); void setCategoryDefaults(); protected: void setTimeZoneIdDefault(); /** Fill empty mail fields with default values. */ void fillMailDefaults(); private: /** Constructor disabled for public. Use instance() to create a KOPrefs object. */ KOPrefs(); static KOPrefs *mInstance; QStringList getDefaultList(); public: // preferences data KConfig* getConfig(); void setFullName(const QString &); QString fullName(); void setEmail(const QString &); QString email(); QString mAdditional; bool mEmailControlCenter; bool mBcc; bool mAutoSave; int mAutoSaveInterval; bool mConfirm; bool mEnableGroupScheduling; bool mEnableProjectView; int mDefaultFormat; int mMailClient; int mStartTime; int mDefaultDuration; int mAlarmTime; int mWorkingHoursStart; int mWorkingHoursEnd; bool mExcludeHolidays; bool mExcludeSaturdays; bool mMarcusBainsShowSeconds; QFont mTimeBarFont; QFont mMonthViewFont; QFont mAgendaViewFont; QFont mMarcusBainsFont; QFont mTimeLabelsFont; QFont mTodoViewFont; QFont mListViewFont; QFont mDateNavigatorFont; QFont mEditBoxFont; QFont mJornalViewFont; QFont mWhatsNextFont; QFont mEventViewFont; QColor mHolidayColor; QColor mHighlightColor; QColor mEventColor; + QColor mTodoDoneColor; QColor mAgendaBgColor; QColor mWorkingHoursColor; QColor mTodoDueTodayColor; QColor mTodoOverdueColor; QColor mMonthViewEvenColor; QColor mMonthViewOddColor; QColor mMonthViewHolidayColor; bool mMonthViewUsesDayColors; bool mMonthViewSatSunTog; QColor mAppColor1; QColor mAppColor2; bool mUseAppColors; int mDayBegins; int mHourSize; int mAllDaySize; bool mShowFullMenu; bool mDailyRecur; bool mWeeklyRecur; bool mMonthDailyRecur; bool mMonthWeeklyRecur; bool mMonthShowIcons; bool mMonthShowShort; bool mEnableToolTips; bool mEnableMonthScroll; bool mFullViewMonth; bool mMonthViewUsesCategoryColor; bool mFullViewTodo; bool mShowCompletedTodo; bool mMarcusBainsEnabled; int mNextXDays; int mWhatsNextDays; int mWhatsNextPrios; bool mEnableQuickTodo; bool mCompactDialogs; bool mVerticalScreen; bool mShowIconNewTodo; bool mShowIconNewEvent; bool mShowIconSearch; bool mShowIconList; bool mShowIconDay1; bool mShowIconDay5; bool mShowIconDay7; bool mShowIconMonth; bool mShowIconTodoview; bool mShowIconBackFast; bool mShowIconBack; bool mShowIconToday; bool mShowIconForward; bool mShowIconForwardFast; bool mShowIconWhatsThis; bool mShowIconNextDays; bool mShowIconNext; bool mShowIconJournal; bool mShowIconStretch; bool mToolBarHor; bool mToolBarUp; bool mToolBarMiniIcons; bool mAskForQuit; bool mUsePassWd; bool mShowSyncEvents; bool mShowTodoInAgenda; bool mShowTimeInAgenda; bool mHideNonStartedTodos; int mLastSyncTime; void setCategoryColor(QString cat,const QColor & color); QColor *categoryColor(QString cat); QString mArchiveFile; QString mHtmlExportFile; bool mHtmlWithSave; QStringList mSelectedPlugins; QString mLastImportFile; QString mLastVcalFile; QString mLastSaveFile; QString mLastLoadFile; QString mDefaultAlarmFile; int mIMIPScheduler; int mIMIPSend; QStringList mAdditionalMails; int mIMIPAutoRefresh; int mIMIPAutoInsertReply; int mIMIPAutoInsertRequest; int mIMIPAutoFreeBusy; int mIMIPAutoFreeBusyReply; QStringList mTodoTemplates; QStringList mEventTemplates; int mDestination; bool mEditOnDoubleClick; bool mViewChangeHoldFullscreen; bool mViewChangeHoldNonFullscreen; bool mCenterOnCurrentTime; bool mSetTimeToDayStartAt; bool mHighlightCurrentDay; bool mUseHighlightLightColor; bool mListViewMonthTimespan; bool mWNViewShowsParents; bool mWNViewShowsPast; bool mWNViewShowLocation; bool mTodoViewShowsPercentage; bool mTodoViewUsesCatColors; bool mTodoViewUsesSmallFont; bool mTodoViewUsesForegroundColor; bool mMonthViewUsesForegroundColor; bool mHightlightDateTimeEdit; bool mShortDateInViewer; bool mShowDateNavigator; QStringList mLocationDefaults; QStringList mEventSummaryUser; QStringList mTodoSummaryUser; bool mUseInternalAlarmNotification; int mAlarmPlayBeeps; int mAlarmSuspendTime; int mAlarmSuspendCount; int mAlarmBeepInterval; int mOldLanguage; int mOldLoadedLanguage; QString mActiveSyncPort; QString mActiveSyncIP; private: QDict<QColor> mCategoryColors; QColor mDefaultCategoryColor; QFont mDefaultTimeBarFont; QFont mDefaultViewFont; QFont mDefaultMonthViewFont; QString mName; QString mEmail; }; #endif diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp index 1b24f56..580dff2 100644 --- a/korganizer/koprefsdialog.cpp +++ b/korganizer/koprefsdialog.cpp @@ -411,1249 +411,1255 @@ void KOPrefsDialog::setupMainTab() // addWidBool(i18n("Enable automatic saving of calendar"), // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); QHBox *intervalBox = new QHBox(topFrame); // intervalBox->setSpacing(spacingHint()); topLayout->addMultiCellWidget(intervalBox,6,6,0,1); QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); /* QHBox * agendasize = new QHBox ( topFrame ); new QLabel (i18n("AllDayAgenda Height:"), agendasize ); mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); topLayout->addMultiCellWidget(agendasize,7,7,0,1); */ KPrefsDialogWidBool *verticalScreen = addWidBool(i18n("Show vertical screen (Needs restart)"), &(KOPrefs::instance()->mVerticalScreen),topFrame); //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1); KPrefsDialogWidBool *ask = addWidBool(i18n("Ask for quit when closing KO/Pi"), &(KOPrefs::instance()->mAskForQuit),topFrame); topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1); /* KPrefsDialogWidBool *confirmCheck = addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), topFrame); topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); mEnableGroupScheduling = addWidBool(i18n("Enable group scheduling"), &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), SLOT(warningGroupScheduling())); mEnableProjectView = addWidBool(i18n("Enable project view"), &(KOPrefs::instance()->mEnableProjectView),topFrame); topLayout->addWidget(mEnableProjectView->checkBox(),9,0); connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), SLOT(warningProjectView())); // Can't be disabled anymore mEnableGroupScheduling->checkBox()->hide(); // Disable setting, because this feature now becomes stable mEnableProjectView->checkBox()->hide(); KPrefsDialogWidRadios *defaultFormatGroup = addWidRadios(i18n("Default Calendar Format"), &(KOPrefs::instance()->mDefaultFormat),topFrame); defaultFormatGroup->addRadio(i18n("vCalendar")); defaultFormatGroup->addRadio(i18n("iCalendar")); topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); // Default format unconditionally is iCalendar defaultFormatGroup->groupBox()->hide(); KPrefsDialogWidRadios *mailClientGroup = addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), topFrame); mailClientGroup->addRadio(i18n("KMail")); mailClientGroup->addRadio(i18n("Sendmail")); topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); KPrefsDialogWidBool *htmlsave = addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), topFrame); topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); KPrefsDialogWidRadios *destinationGroup = addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), topFrame); destinationGroup->addRadio(i18n("be added to the standard resource")); destinationGroup->addRadio(i18n("be asked which resource to use")); topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); topLayout->setRowStretch(14,1); */ } void KOPrefsDialog::setupTimeTab() { QFrame *topFrame = addPage(i18n("Time"),0,0); // DesktopIcon("clock",KIcon::SizeMedium)); QGridLayout *topLayout = new QGridLayout(topFrame,4,2); topLayout->setSpacing(spacingHint()); topLayout->setMargin(marginHint()); QHBox *dummy = new QHBox(topFrame); KPrefsDialogWidTime *dayBegins = addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), dummy); //topLayout->addWidget(dayBegins->label(),2,0); //topLayout->addWidget(dayBegins->spinBox(),2,1); topLayout->addMultiCellWidget(dummy,0,0,0,1); topLayout->addWidget(new QLabel(i18n("Default appointment time:"), topFrame),1,0); mStartTimeSpin = new QSpinBox(0,23,1,topFrame); mStartTimeSpin->setSuffix(":00"); topLayout->addWidget(mStartTimeSpin,1,1); topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), topFrame),2,0); mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); mDefaultDurationSpin->setSuffix(":00"); topLayout->addWidget(mDefaultDurationSpin,2,1); QStringList alarmList; alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), 3,0); mAlarmTimeCombo = new QComboBox(topFrame); mAlarmTimeCombo->insertStringList(alarmList); topLayout->addWidget(mAlarmTimeCombo,3,1); QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, i18n("Working Hours"), topFrame); topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); workingHoursGroup->layout()->setSpacing( 0 ); workingHoursGroup->layout()->setMargin( 4 ); QHBox *workStartBox = new QHBox(workingHoursGroup); // workStartBox->setMargin( 0 ); addWidTime(i18n("Daily starting hour:"), &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); QHBox *workEndBox = new QHBox(workingHoursGroup); //workEndBox->setMargin( 0 ); addWidTime(i18n("Daily ending hour:"), &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); QVBox *excludeBox = new QVBox(workingHoursGroup); //excludeBox->setMargin( 0 ); addWidBool(i18n("Exclude holidays"), &(KOPrefs::instance()->mExcludeHolidays),excludeBox); addWidBool(i18n("Exclude Saturdays"), &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); // KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), // &(KOPrefs::instance()->mMarcusBainsShowSeconds), // topFrame); // topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); // topLayout->setRowStretch(6,1); } void KOPrefsDialog::setupViewsTab() { QFrame *topFrame = addPage(i18n("Views"),0,0); // DesktopIcon("viewmag",KIcon::SizeMedium)); QGridLayout *topLayout = new QGridLayout(topFrame,6,1); topLayout->setSpacing(spacingHint()); topLayout->setMargin(marginHint()); // QBoxLayout *dayBeginsLayout = new QHBoxLayout; // topLayout->addLayout(dayBeginsLayout,0,0); // KPrefsDialogWidTime *dayBegins = // addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), // topFrame); // dayBeginsLayout->addWidget(dayBegins->label()); // dayBeginsLayout->addStretch(1); // dayBeginsLayout->addWidget(dayBegins->spinBox()); // QBoxLayout *nextDaysLayout = new QHBoxLayout; // topLayout->addLayout(nextDaysLayout,1,0); // nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); // mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); // nextDaysLayout->addStretch(1); // nextDaysLayout->addWidget(mNextXDaysSpin); int ii = 0; KPrefsDialogWidBool *dummy = addWidBool(i18n("Edit item on doubleclick (if not, show)"), &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); topLayout->addWidget(dummy->checkBox(),ii++,0); dummy = addWidBool(i18n("Show time in agenda items"), &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); topLayout->addWidget(dummy->checkBox(),ii++,0); dummy = addWidBool(i18n("Highlight current day in agenda"), &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); topLayout->addWidget(dummy->checkBox(),ii++,0); dummy = addWidBool(i18n("Use light color for highlight current day"), &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); topLayout->addWidget(dummy->checkBox(),ii++,0); KPrefsDialogWidBool *dailyRecur = addWidBool(i18n("Show events that recur daily in date nav."), &(KOPrefs::instance()->mDailyRecur),topFrame); topLayout->addWidget(dailyRecur->checkBox(),ii++,0); KPrefsDialogWidBool *weeklyRecur = addWidBool(i18n("Show ev. that recur weekly in date nav."), &(KOPrefs::instance()->mWeeklyRecur),topFrame); topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); if ( QApplication::desktop()->width() > 640 ) { KPrefsDialogWidBool *enableToolTips = addWidBool(i18n("Enable tooltips displaying summary of ev."), &(KOPrefs::instance()->mEnableToolTips),topFrame); topLayout->addWidget(enableToolTips->checkBox(),ii++,0); } KPrefsDialogWidBool *marcusBainsEnabled = addWidBool(i18n("Show Marcus Bains line"), &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); // topLayout->addWidget(hourSizeGroup,ii++,0); // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); //topLayout->setRowStretch(11,1); topFrame = addPage(i18n("ViewChange"),0,0); // DesktopIcon("viewmag",KIcon::SizeMedium)); topLayout = new QGridLayout(topFrame,6,1); topLayout->setSpacing(spacingHint()); topLayout->setMargin(marginHint()); ii = 0; dummy = addWidBool(i18n("Hold fullscreen on view change"), &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); topLayout->addWidget(dummy->checkBox(),ii++,0); dummy = addWidBool(i18n("Hold non-fullscreen on view change"), &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); topLayout->addWidget(dummy->checkBox(),ii++,0); KPrefsDialogWidBool *fullViewTodo = addWidBool(i18n("Event list view uses full window"), &(KOPrefs::instance()->mFullViewTodo),topFrame); topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); KPrefsDialogWidBool *fullViewMonth = addWidBool(i18n("Next days view uses full window"), &(KOPrefs::instance()->mFullViewMonth),topFrame); topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); dummy = addWidBool(i18n("Set agenda to DayBeginsAt on change"), &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); topLayout->addWidget(dummy->checkBox(),ii++,0); dummy = addWidBool(i18n("Set agenda to current time on change"), &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); topLayout->addWidget(dummy->checkBox(),ii++,0); dummy = addWidBool(i18n("Listview uses monthly timespan"), &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); topLayout->addWidget(dummy->checkBox(),ii++,0); dummy = addWidBool(i18n("Highlight selection in Time Edit"), &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); topLayout->addWidget( dummy->checkBox(), ii++,0); topFrame = addPage(i18n("Month View"),0,0); // DesktopIcon("viewmag",KIcon::SizeMedium)); topLayout = new QGridLayout(topFrame,5,1); topLayout->setSpacing(spacingHint()); topLayout->setMargin(marginHint()); ii = 0; QLabel *lab; QHBox *habo = new QHBox( topFrame ); if ( QApplication::desktop()->width() <= 480 ) { lab = new QLabel ( i18n("Show events that recur "), topFrame ); topLayout->addMultiCellWidget(lab,ii, ii,0,1); ii++; } else { new QLabel ( i18n("Show events that recur "), habo ); } dailyRecur = addWidBool(i18n("daily"), &(KOPrefs::instance()->mMonthDailyRecur),habo); // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); weeklyRecur = addWidBool(i18n("weekly"), &(KOPrefs::instance()->mMonthWeeklyRecur),habo); topLayout->addMultiCellWidget(habo,ii, ii,0,1); ii++; habo = new QHBox( topFrame ); if ( QApplication::desktop()->width() <= 480 ) { lab = new QLabel (i18n("Show in every cell ") , topFrame ); topLayout->addMultiCellWidget(lab,ii, ii,0,1); ii++; } else { new QLabel ( i18n("Show in every cell "), habo ); } weeklyRecur = addWidBool(i18n("short month"), &(KOPrefs::instance()->mMonthShowShort),habo); weeklyRecur = addWidBool(i18n("icons"), &(KOPrefs::instance()->mMonthShowIcons),habo); topLayout->addMultiCellWidget(habo,ii, ii,0,1); ii++; #ifdef DESKTOP_VERSION KPrefsDialogWidBool *enableMonthScroll = addWidBool(i18n("Enable scrollbars in month view cells"), &(KOPrefs::instance()->mEnableMonthScroll),topFrame); topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); #endif dummy = addWidBool(i18n("Show Sat/Sun together"), &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); topLayout->addWidget(dummy->checkBox(),ii++,0); KPrefsDialogWidBool *coloredCategoriesInMonthView = addWidBool(i18n("Month view uses category colors"), &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); dummy = addWidBool(i18n("Categorie colors are applied to text"), &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); topLayout->addWidget(dummy->checkBox(),ii++,0); coloredCategoriesInMonthView = addWidBool(i18n("Month view uses day colors"), &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); KPrefsDialogWidColor *holidayColor = addWidColor(i18n("Day color odd months"), &(KOPrefs::instance()->mMonthViewOddColor),topFrame); topLayout->addWidget(holidayColor->label(),ii,0); topLayout->addWidget(holidayColor->button(),ii++,1); holidayColor = addWidColor(i18n("Day color even months"), &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); topLayout->addWidget(holidayColor->label(),ii,0); topLayout->addWidget(holidayColor->button(),ii++,1); holidayColor = addWidColor(i18n("Color for Sundays + category \"Holiday\""), &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); topLayout->addWidget(holidayColor->label(),ii,0); topLayout->addWidget(holidayColor->button(),ii++,1); // *********************** What'sNext View topFrame = addPage(i18n("What's Next View"),0,0); // DesktopIcon("viewmag",KIcon::SizeMedium)); topLayout = new QGridLayout(topFrame,4,1); topLayout->setSpacing(spacingHint()); topLayout->setMargin(marginHint()); ii = 0; KPrefsDialogWidBool *passwdk = addWidBool(i18n("Show events, that are done in \nWhat's Next view"), &(KOPrefs::instance()->mWNViewShowsPast),topFrame); topLayout->addWidget(passwdk->checkBox(), ii++,0); passwdk = addWidBool(i18n("Show parent To-Do's in What's Next view"), &(KOPrefs::instance()->mWNViewShowsParents),topFrame); topLayout->addWidget(passwdk->checkBox(), ii++,0); passwdk = addWidBool(i18n("Show location in What's Next view"), &(KOPrefs::instance()->mWNViewShowLocation),topFrame); topLayout->addWidget(passwdk->checkBox(), ii++,0); passwdk = addWidBool(i18n("Show Sync Events in \nWhat's Next/Agenda view"), &(KOPrefs::instance()->mShowSyncEvents),topFrame); topLayout->addWidget(passwdk->checkBox(), ii++,0); passwdk = addWidBool(i18n("Use short date in \nWhat's Next/Event view"), &(KOPrefs::instance()->mShortDateInViewer),topFrame); topLayout->addWidget(passwdk->checkBox(), ii++,0); // *********************** Todo View topFrame = addPage(i18n("Todo View"),0,0); // DesktopIcon("viewmag",KIcon::SizeMedium)); topLayout = new QGridLayout(topFrame,4,1); topLayout->setSpacing(spacingHint()); topLayout->setMargin(marginHint()); ii = 0; dummy = addWidBool(i18n("Hide not running Todos in To-do view"), &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); topLayout->addWidget(dummy->checkBox(),ii++,0); KPrefsDialogWidBool *showCompletedTodo = addWidBool(i18n("To-do view shows completed Todos"), &(KOPrefs::instance()->mShowCompletedTodo),topFrame); topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); dummy = addWidBool(i18n("To-do view shows complete as 'xx %'"), &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); topLayout->addWidget(dummy->checkBox(),ii++,0); dummy = addWidBool(i18n("Small To-do view uses smaller font"), &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); topLayout->addWidget(dummy->checkBox(),ii++,0); dummy = addWidBool(i18n("Todo view uses category colors"), &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); topLayout->addWidget(dummy->checkBox(),ii++,0); QWidget* wid = new QWidget( topFrame ); // Todo due today color KPrefsDialogWidColor *todoDueTodayColor = addWidColor(i18n("Todo due today color:"), &(KOPrefs::instance()->mTodoDueTodayColor),wid); QHBoxLayout *widLayout = new QHBoxLayout(wid); widLayout->addWidget( todoDueTodayColor->label() ); widLayout->addWidget( todoDueTodayColor->button() ); topLayout->addWidget(wid,ii++,0); //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); // Todo overdue color wid = new QWidget( topFrame ); widLayout = new QHBoxLayout(wid); KPrefsDialogWidColor *todoOverdueColor = addWidColor(i18n("Todo overdue color:"), &(KOPrefs::instance()->mTodoOverdueColor),wid); widLayout->addWidget(todoOverdueColor->label()); widLayout->addWidget(todoOverdueColor->button()); topLayout->addWidget(wid,ii++,0); dummy = addWidBool(i18n("Colors are applied to text"), &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); topLayout->addWidget(dummy->checkBox(),ii++,0); dummy = addWidBool(i18n("Allday Agenda view shows todos"), &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); topLayout->addWidget(dummy->checkBox(),ii++,0); topFrame = addPage(i18n("Alarm"),0,0); // DesktopIcon("viewmag",KIcon::SizeMedium)); topLayout = new QGridLayout(topFrame,2,1); topLayout->setSpacing(spacingHint()); topLayout->setMargin(marginHint()); int iii = 0; dummy = addWidBool(i18n("Use internal alarm notification"), &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); topLayout->addWidget(dummy->checkBox(),iii++,0); lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); topLayout->addWidget(lab ,iii++,0); #ifndef DESKTOP_VERSION lab->setAlignment( AlignLeft|WordBreak|AlignTop); #else lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); #endif QHBox* dummyBox = new QHBox(topFrame); new QLabel(i18n("Play beeps count:"),dummyBox); mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); topLayout->addWidget(dummyBox,iii++,0); dummyBox = new QHBox(topFrame); new QLabel(i18n("Beeps interval in sec:"),dummyBox); mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); topLayout->addWidget(dummyBox,iii++,0); dummyBox = new QHBox(topFrame); new QLabel(i18n("Default suspend time in min:"),dummyBox); mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); topLayout->addWidget(dummyBox,iii++,0); dummyBox = new QHBox(topFrame); new QLabel(i18n("Auto suspend count:"),dummyBox); mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); topLayout->addWidget(dummyBox,iii++,0); QHBox* hbo = new QHBox ( topFrame ); mDefaultAlarmFile = new QLineEdit(hbo); QPushButton * loadTemplate = new QPushButton(hbo); QPixmap icon; if ( QApplication::desktop()->width() < 321 ) icon = SmallIcon("fileimport16"); else icon = SmallIcon("fileimport"); loadTemplate->setIconSet (icon ) ; connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); int size = loadTemplate->sizeHint().height(); loadTemplate->setFixedSize( size, size ); //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); // topLayout->addWidget(lab ,iii++,0); lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); topLayout->addWidget(lab ,iii++,0); topLayout->addWidget(hbo,iii++,0); // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); // topLayout->addWidget(lab ,iii++,0); // #ifndef DESKTOP_VERSION // lab->setAlignment( AlignLeft|WordBreak|AlignTop); // #else // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); // #endif } void KOPrefsDialog::selectSoundFile() { QString fileName = mDefaultAlarmFile->text(); fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); if ( fileName.length() > 0 ) mDefaultAlarmFile->setText( fileName ); } void KOPrefsDialog::setupFontsTab() { QFrame *topFrame = addPage(i18n("Fonts"),0,0); // DesktopIcon("fonts",KIcon::SizeMedium)); QGridLayout *topLayout = new QGridLayout(topFrame,7,3); topLayout->setSpacing(1); topLayout->setMargin(3); KPrefsDialogWidFont * tVFont; int i = 0; KPrefsDialogWidFont *timeLabelsFont = addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), &(KOPrefs::instance()->mDateNavigatorFont),topFrame); topLayout->addWidget(timeLabelsFont->label(),i,0); topLayout->addWidget(timeLabelsFont->preview(),i,1); topLayout->addWidget(timeLabelsFont->button(),i,2); ++i; timeLabelsFont = addWidFont(i18n("Mon 15"),i18n("Date Labels:"), &(KOPrefs::instance()->mTimeLabelsFont),topFrame); topLayout->addWidget(timeLabelsFont->label(),i,0); topLayout->addWidget(timeLabelsFont->preview(),i,1); topLayout->addWidget(timeLabelsFont->button(),i,2); ++i; KPrefsDialogWidFont *timeBarFont = addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), &(KOPrefs::instance()->mTimeBarFont),topFrame); topLayout->addWidget(timeBarFont->label(),i,0); topLayout->addWidget(timeBarFont->preview(),i,1); topLayout->addWidget(timeBarFont->button(),i,2); ++i; KPrefsDialogWidFont *marcusBainsFont = addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), &(KOPrefs::instance()->mMarcusBainsFont),topFrame); topLayout->addWidget(marcusBainsFont->label(),i,0); topLayout->addWidget(marcusBainsFont->preview(),i,1); topLayout->addWidget(marcusBainsFont->button(),i,2); ++i; tVFont = addWidFont(i18n("Summary"),i18n("Event Viewer:"), &(KOPrefs::instance()->mEventViewFont),topFrame); topLayout->addWidget(tVFont->label(),i,0); topLayout->addWidget(tVFont->preview(),i,1); topLayout->addWidget(tVFont->button(),i,2); ++i; tVFont = addWidFont(i18n("Details"),i18n("EditorBox:"), &(KOPrefs::instance()->mEditBoxFont),topFrame); topLayout->addWidget(tVFont->label(),i,0); topLayout->addWidget(tVFont->preview(),i,1); topLayout->addWidget(tVFont->button(),i,2); ++i; topLayout->setColStretch(1,1); topLayout->setRowStretch(4,1); i = 0; topFrame = addPage(i18n("View Fonts"),0, DesktopIcon("fonts",KIcon::SizeMedium)); topLayout = new QGridLayout(topFrame,7,3); topLayout->setSpacing(1); topLayout->setMargin(3); tVFont = addWidFont(i18n("Configure KO"),i18n("What's Next View:"), &(KOPrefs::instance()->mWhatsNextFont),topFrame); topLayout->addWidget(tVFont->label(),i,0); topLayout->addWidget(tVFont->preview(),i,1); topLayout->addWidget(tVFont->button(),i,2); ++i; KPrefsDialogWidFont *agendaViewFont = addWidFont(i18n("Event text"),i18n("Agenda view:"), &(KOPrefs::instance()->mAgendaViewFont),topFrame); topLayout->addWidget(agendaViewFont->label(),i,0); topLayout->addWidget(agendaViewFont->preview(),i,1); topLayout->addWidget(agendaViewFont->button(),i,2); ++i; KPrefsDialogWidFont *monthViewFont = addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); topLayout->addWidget(monthViewFont->label(),i,0); topLayout->addWidget(monthViewFont->preview(),i,1); topLayout->addWidget(monthViewFont->button(),i,2); ++i; KPrefsDialogWidFont *lVFont = addWidFont(i18n("Event"),i18n("List View:"), &(KOPrefs::instance()->mListViewFont),topFrame); topLayout->addWidget(lVFont->label(),i,0); topLayout->addWidget(lVFont->preview(),i,1); topLayout->addWidget(lVFont->button(),i,2); ++i; tVFont = addWidFont(i18n("ToDo"),i18n("ToDoView:"), &(KOPrefs::instance()->mTodoViewFont),topFrame); topLayout->addWidget(tVFont->label(),i,0); topLayout->addWidget(tVFont->preview(),i,1); topLayout->addWidget(tVFont->button(),i,2); ++i; tVFont = addWidFont(i18n("Today"),i18n("JournalView:"), &(KOPrefs::instance()->mJornalViewFont),topFrame); topLayout->addWidget(tVFont->label(),i,0); topLayout->addWidget(tVFont->preview(),i,1); topLayout->addWidget(tVFont->button(),i,2); ++i; topLayout->setColStretch(1,1); topLayout->setRowStretch(4,1); } void KOPrefsDialog::setupColorsTab() { QFrame *topFrame = addPage(i18n("Colors"),0,0); // DesktopIcon("colorize",KIcon::SizeMedium)); QGridLayout *topLayout = new QGridLayout(topFrame,5,2); // topLayout->setSpacing(spacingHint()); // topLayout->setMargin(marginHint()); topLayout->setSpacing(2); topLayout->setMargin(3); int ii = 1; QGroupBox *categoryGroup ; categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), topFrame); topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); mCategoryCombo = new QComboBox(categoryGroup); mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); mCategoryButton = new KColorButton(categoryGroup); connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); updateCategoryColor(); // Holiday Color KPrefsDialogWidColor *holidayColor = addWidColor(i18n("Holiday color:"), &(KOPrefs::instance()->mHolidayColor),topFrame); topLayout->addWidget(holidayColor->label(),ii,0); topLayout->addWidget(holidayColor->button(),ii++,1); // Highlight Color KPrefsDialogWidColor *highlightColor = addWidColor(i18n("Highlight color:"), &(KOPrefs::instance()->mHighlightColor),topFrame); topLayout->addWidget(highlightColor->label(),ii,0); topLayout->addWidget(highlightColor->button(),ii++,1); // Event color KPrefsDialogWidColor *eventColor = addWidColor(i18n("Default event color:"), &(KOPrefs::instance()->mEventColor),topFrame); topLayout->addWidget(eventColor->label(),ii,0); topLayout->addWidget(eventColor->button(),ii++,1); + eventColor = + addWidColor(i18n("Default todo done color:"), + &(KOPrefs::instance()->mTodoDoneColor),topFrame); + topLayout->addWidget(eventColor->label(),ii,0); + topLayout->addWidget(eventColor->button(),ii++,1); + // agenda view background color KPrefsDialogWidColor *agendaBgColor = addWidColor(i18n("Agenda view background color:"), &(KOPrefs::instance()->mAgendaBgColor),topFrame); topLayout->addWidget(agendaBgColor->label(),ii,0); topLayout->addWidget(agendaBgColor->button(),ii++,1); // working hours color KPrefsDialogWidColor *workingHoursColor = addWidColor(i18n("Working hours color:"), &(KOPrefs::instance()->mWorkingHoursColor),topFrame); topLayout->addWidget(workingHoursColor->label(),ii,0); topLayout->addWidget(workingHoursColor->button(),ii++,1); KPrefsDialogWidBool *sb = addWidBool(i18n("Use colors for application:"), &(KOPrefs::instance()->mUseAppColors),topFrame); topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); ii++; KPrefsDialogWidColor * workingHoursColor1 = addWidColor(i18n("Buttons, menus, etc.:"), &(KOPrefs::instance()->mAppColor1),topFrame); topLayout->addWidget(workingHoursColor1->label(),ii,0); topLayout->addWidget(workingHoursColor1->button(),ii++,1); KPrefsDialogWidColor * workingHoursColor2 = addWidColor(i18n("Frames, labels, etc.:"), &(KOPrefs::instance()->mAppColor2),topFrame); topLayout->addWidget(workingHoursColor2->label(),ii,0); topLayout->addWidget(workingHoursColor2->button(),ii++,1); } void KOPrefsDialog::setCategoryColor() { mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); } void KOPrefsDialog::updateCategoryColor() { QString cat = mCategoryCombo->currentText(); QColor *color = mCategoryDict.find(cat); if (!color) { color = KOPrefs::instance()->categoryColor(cat); } if (color) { mCategoryButton->setColor(*color); } } void KOPrefsDialog::setupPrinterTab() { mPrinterTab = addPage(i18n("Printing"),0, DesktopIcon("fileprint",KIcon::SizeMedium)); QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); topLayout->setSpacing(spacingHint()); topLayout->setMargin(marginHint()); topLayout->setRowStretch(4,1); } void KOPrefsDialog::setupGroupSchedulingTab() { #if 0 QFrame *topFrame = addPage(i18n("Group Scheduling"),0, DesktopIcon("personal",KIcon::SizeMedium)); QGridLayout *topLayout = new QGridLayout(topFrame,6,2); topLayout->setSpacing(spacingHint()); topLayout->setMargin(marginHint()); #if 0 KPrefsDialogWidRadios *schedulerGroup = addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), topFrame); schedulerGroup->addRadio("Dummy"); // Only for debugging schedulerGroup->addRadio(i18n("Mail client")); topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); #endif KPrefsDialogWidRadios *sendGroup = addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), topFrame); sendGroup->addRadio(i18n("Send to outbox")); sendGroup->addRadio(i18n("Send directly")); topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); mAMails = new QListView(topFrame); mAMails->addColumn(i18n("Email"),300); topLayout->addMultiCellWidget(mAMails,3,3,0,1); topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); aEmailsEdit = new QLineEdit(topFrame); aEmailsEdit->setEnabled(false); topLayout->addWidget(aEmailsEdit,4,1); QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); topLayout->addWidget(add,5,0); QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); topLayout->addWidget(del,5,1); //topLayout->setRowStretch(2,1); connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); #endif } void KOPrefsDialog::setupGroupAutomationTab() { return; QFrame *topFrame = addPage(i18n("Group Automation"),0, DesktopIcon("personal",KIcon::SizeMedium)); QGridLayout *topLayout = new QGridLayout(topFrame,5,1); topLayout->setSpacing(spacingHint()); topLayout->setMargin(marginHint()); KPrefsDialogWidRadios *autoRefreshGroup = addWidRadios(i18n("Auto Send Refresh"), &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); autoRefreshGroup->addRadio(i18n("Never")); autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); //autoRefreshGroup->addRadio(i18n("selected emails")); topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); KPrefsDialogWidRadios *autoInsertGroup = addWidRadios(i18n("Auto Insert IMIP Replies"), &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); autoInsertGroup->addRadio(i18n("Never")); autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); //autoInsertGroup->addRadio(i18n("selected emails")); topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); KPrefsDialogWidRadios *autoRequestGroup = addWidRadios(i18n("Auto Insert IMIP Requests"), &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); autoRequestGroup->addRadio(i18n("Never")); autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); //autoInsertGroup->addRadio(i18n("selected emails")); topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); KPrefsDialogWidRadios *autoFreeBusyGroup = addWidRadios(i18n("Auto Send FreeBusy Information"), &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); autoFreeBusyGroup->addRadio(i18n("Never")); autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); //autoFreeBusyGroup->addRadio(i18n("selected emails")); topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); KPrefsDialogWidRadios *autoFreeBusyReplyGroup = addWidRadios(i18n("Auto Save FreeBusy Replies"), &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); autoFreeBusyReplyGroup->addRadio(i18n("Never")); 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() { kdelibcfg->readConfig(); mNameEdit->setText(KOPrefs::instance()->fullName()); mEmailEdit->setText(KOPrefs::instance()->email()); mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); // QDate current ( 2001, 1,1); //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); // if (KOPrefs::instance()->mAllDaySize > 47 ) // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); 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); // } // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); //QString dummy = KOPrefs::instance()->mUserDateFormatLong; //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); //dummy = KOPrefs::instance()->mUserDateFormatShort; //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); updateCategories(); mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); } void KOPrefsDialog::usrWriteConfig() { kdelibcfg->writeConfig(); // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); KOPrefs::instance()->setFullName(mNameEdit->text()); KOPrefs::instance()->setEmail(mEmailEdit->text()); KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); //QDate date; //date = mStartDateSavingEdit->date(); //int sub = 0; //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) // sub = 1; // KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; // date = mEndDateSavingEdit->date(); // if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) // sub = 1; // else // sub = 0; // KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; // // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); 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::warningGroupScheduling() { warningExperimental(mEnableGroupScheduling->checkBox()->isChecked()); } void KOPrefsDialog::warningProjectView() { warningExperimental(mEnableProjectView->checkBox()->isChecked()); } void KOPrefsDialog::warningExperimental(bool on) { if (on) { KMessageBox::information(this,i18n("This is an experimental feature. " "It may not work, it may do nothing useful and it may cause data loss. " "Use with care.\n" "You have to restart KOrganizer for this setting to take effect.")); } else { KMessageBox::information(this, i18n("You have to restart KOrganizer for this setting to take effect.")); } } 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)); } void KOPrefsDialog::updateTimezoneOffset( int index ) { /* qDebug("updateTimezoneOffset %d ", index); if ( index < 24 ) { mTimezoneOffsetSpin->setEnabled ( false ); mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); } else { if ( index == 24 ) { mTimezoneOffsetSpin->setEnabled ( true ); mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); } else { mTimezoneOffsetSpin->setEnabled ( false ); mTimezoneOffsetSpin->setValue( 0 ); } } */ } void KOPrefsDialog::setupTimeZoneTab() { #if 0 QFrame *topFrame = addPage(i18n("Time Zone"),0,0); // DesktopIcon("clock",KIcon::SizeMedium)); QGridLayout *topLayout = new QGridLayout(topFrame,5,2); topLayout->setSpacing(spacingHint()); topLayout->setMargin(marginHint()); QHBox *timeZoneBox = new QHBox( topFrame ); topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); new QLabel( i18n("Timezone:"), timeZoneBox ); mTimeZoneCombo = new QComboBox( timeZoneBox ); if ( QApplication::desktop()->width() < 300 ) { mTimeZoneCombo->setMaximumWidth(150); } QStringList list; list = KGlobal::locale()->timeZoneList(); mTimeZoneCombo->insertStringList(list); // find the currently set time zone and select it QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; int nCurrentlySet = 11; for (int i = 0; i < mTimeZoneCombo->count(); i++) { if (mTimeZoneCombo->text(i) == sCurrentlySet) { nCurrentlySet = i; break; } } mTimeZoneCombo->setCurrentItem(nCurrentlySet); int iii = 1; KPrefsDialogWidBool *sb = addWidBool(i18n("Timezone has daylight saving"), &(KOPrefs::instance()->mUseDaylightsaving),topFrame); topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); ++iii; QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); topLayout->addMultiCellWidget(lab, iii,iii,0,1); ++iii; lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); topLayout->addMultiCellWidget(lab, iii,iii,0,1); ++iii; lab = new QLabel( i18n("Daylight start:"), topFrame ); topLayout->addWidget(lab, iii,0); mStartDateSavingEdit = new KDateEdit(topFrame); topLayout->addWidget(mStartDateSavingEdit, iii,1); ++iii; lab = new QLabel( i18n("Daylight end:"), topFrame ); topLayout->addWidget(lab, iii,0); mEndDateSavingEdit = new KDateEdit(topFrame); topLayout->addWidget(mEndDateSavingEdit, iii,1); ++iii; QDate current ( 2001, 1,1); mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); #endif } |