author | zautrix <zautrix> | 2005-03-26 13:36:19 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-26 13:36:19 (UTC) |
commit | 98444f8937b151a3deb71b7ae0da495872c52855 (patch) (side-by-side diff) | |
tree | 26856e27b5d9aca9d428142cbbd15fef030957a7 /korganizer/koagendaview.cpp | |
parent | 93d1be2c6eead07300e7f90f3b417fcef0f109d3 (diff) | |
download | kdepimpi-98444f8937b151a3deb71b7ae0da495872c52855.zip kdepimpi-98444f8937b151a3deb71b7ae0da495872c52855.tar.gz kdepimpi-98444f8937b151a3deb71b7ae0da495872c52855.tar.bz2 |
icons added
-rw-r--r-- | korganizer/koagendaview.cpp | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 8001c8f..acf43bd 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -274,224 +274,223 @@ EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) mPaintWidget = 0; mXOffset = 0; if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); else mPixmap = SmallIcon("1downarrow"); mEnabled.resize(mColumns); mEnabled.fill( false ); setMinimumHeight(mPixmap.height()); } EventIndicator::~EventIndicator() { } void EventIndicator::drawContents(QPainter *p) { // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; KDGanttSplitterHandle* han = 0; if ( mPaintWidget ) han = mPaintWidget->firstHandle(); if ( ! han ) { int i; for(i=0;i<mColumns;++i) { if (mEnabled[i]) { int cellWidth = contentsRect().right()/mColumns; int xOffset = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 : i*cellWidth + (cellWidth -mPixmap.width()) /2; p->drawPixmap(QPoint(1+xOffset,0),mPixmap); } } } else { han->repaint(); //mPaintWidget->setBackgroundColor( red ); QPainter pa( han ); int i; bool setColor = false; for(i=0;i<mColumns;++i) { if (mEnabled[i]) { setColor = true; int cellWidth = contentsRect().right()/mColumns; int xOffset = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : i*cellWidth + cellWidth/2 -mPixmap.width()/2; pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); //qDebug("222draw pix %d ",xOffset ); } } pa.end(); } } void EventIndicator::setXOffset( int x ) { mXOffset = x; } void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) { mPaintWidget = w; setMaximumHeight(0); setMinimumHeight(0); } void EventIndicator::changeColumns(int columns) { mColumns = columns; mEnabled.resize(mColumns); update(); } void EventIndicator::enableColumn(int column, bool enable) { mEnabled[column] = enable; } //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : KOEventView (cal,parent,name) { mBlockUpdating = true; mStartHour = 8; mSelectedDates.append(QDate::currentDate()); mLayoutDayLabels = 0; mDayLabelsFrame = 0; mDayLabels = 0; bool isRTL = KOGlobals::self()->reverseLayout(); - + QPixmap expandPix; if ( KOPrefs::instance()->mVerticalScreen ) { - mExpandedPixmap = SmallIcon( "1downarrow" ); - mNotExpandedPixmap = SmallIcon( "1uparrow" ); + expandPix = SmallIcon( "1updownarrow" ); } else { - mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); - mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); + expandPix = SmallIcon("1leftrightarrow" ); } QBoxLayout *topLayout = new QVBoxLayout(this); // Create day name labels for agenda columns // Create agenda splitter mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); topLayout->addWidget( mSplitterAgenda ); mAllDayFrame = new QHBox(mSplitterAgenda); mAllDayFrame->setFocusPolicy(NoFocus); QWidget *agendaFrame = new QWidget(mSplitterAgenda); agendaFrame->setFocusPolicy(NoFocus); // Create all-day agenda widget mDummyAllDayLeft = new QVBox( mAllDayFrame ); mExpandButton = new QPushButton(mDummyAllDayLeft); - mExpandButton->setPixmap( mNotExpandedPixmap ); - int widebut = mExpandButton->sizeHint().width(); + mExpandButton->setPixmap( expandPix ); + int widebut = mExpandButton->sizeHint().width()+4; + int heibut = mExpandButton->sizeHint().height()+4; + if ( heibut > widebut ) + widebut = heibut ; if ( QApplication::desktop()->width() < 480 ) - widebut = widebut*2; - else - widebut = (widebut*3) / 2; + widebut = widebut*3/2; //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, // QSizePolicy::Fixed ) ); mExpandButton->setFixedSize( widebut, widebut); connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); mExpandButton->setFocusPolicy(NoFocus); mAllDayAgenda = new KOAgenda(1,mAllDayFrame); mAllDayAgenda->setFocusPolicy(NoFocus); QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); // Create event context menu for all day agenda mAllDayAgendaPopup = eventPopup(); connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); // Create agenda frame QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); // QHBox *agendaFrame = new QHBox(splitterAgenda); // create event indicator bars mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); #ifndef DESKTOP_VERSION // FIX mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); #endif mDayLabelsFrame = new QHBox(agendaFrame); //topLayout->addWidget(mDayLabelsFrame); mDayLabels = new QFrame (mDayLabelsFrame); mLayoutDayLabels = new QHBoxLayout(mDayLabels); agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); agendaLayout->addWidget(mEventIndicatorTop,1,1); mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, agendaFrame); agendaLayout->addWidget(mEventIndicatorBottom,3,1); QWidget *dummyAgendaRight = new QWidget(agendaFrame); agendaLayout->addWidget(dummyAgendaRight,1,2); // Create time labels mTimeLabels = new TimeLabels(24,agendaFrame); agendaLayout->addWidget(mTimeLabels,2,0); connect(mTimeLabels,SIGNAL( scaleChanged()), this,SLOT(updateConfig())); // Create agenda mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); agendaLayout->setColStretch(1,1); mAgenda->setFocusPolicy(NoFocus); // Create event context menu for agenda mAgendaPopup = eventPopup(); mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), i18n("Toggle Alarm"),mAgenda, SLOT(popupAlarm()),true); connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); // make connections between dependent widgets mTimeLabels->setAgenda(mAgenda); // Update widgets to reflect user preferences // updateConfig(); // createDayLabels(); // these blank widgets make the All Day Event box line up with the agenda dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); // Scrolling connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), mTimeLabels, SLOT(positionChanged())); connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), SLOT(setContentsPos(int))); connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); // Create/Show/Edit/Delete Event connect(mAgenda,SIGNAL(newEventSignal(int,int)), SLOT(newEvent(int,int))); connect(mAgenda,SIGNAL(newTodoSignal(int,int)), SLOT(newTodo(int,int))); connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), SLOT(newEvent(int,int,int,int))); connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), SLOT(newEventAllDay(int,int))); connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), SLOT(newTodoAllDay(int,int))); connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), SLOT(newEventAllDay(int,int))); connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), SLOT(newTimeSpanSelected(int,int,int,int))); @@ -1363,201 +1362,192 @@ void KOAgendaView::updateEventIndicatorBottom(int newY) } void KOAgendaView::startDrag(Event *event) { #ifndef KORG_NODND DndFactory factory( calendar() ); ICalDrag *vd = factory.createDrag(event,this); if (vd->drag()) { kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl; } #endif } void KOAgendaView::readSettings() { readSettings(KOGlobals::config()); } void KOAgendaView::readSettings(KConfig *config) { // kdDebug() << "KOAgendaView::readSettings()" << endl; config->setGroup("Views"); //#ifndef KORG_NOSPLITTER QValueList<int> sizes = config->readIntListEntry("Separator AgendaView"); if (sizes.count() == 2) { if ( sizes[0] < 20 ) { sizes[1] = sizes[1] +20 - sizes[0]; sizes[0] = 20; } mSplitterAgenda->setSizes(sizes); // qDebug("read %d %d ",sizes[0],sizes[1] ); } //#endif // updateConfig(); } void KOAgendaView::writeSettings(KConfig *config) { // kdDebug() << "KOAgendaView::writeSettings()" << endl; config->setGroup("Views"); //#ifndef KORG_NOSPLITTER QValueList<int> list = mSplitterAgenda->sizes(); config->writeEntry("Separator AgendaView",list); //qDebug("write %d %d ", list[0],list[1] ); //#endif } void KOAgendaView::setHolidayMasks() { mHolidayMask.resize(mSelectedDates.count()); uint i; for(i=0;i<mSelectedDates.count();++i) { QDate date = mSelectedDates[i]; bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); bool showHoliday = false; if ( KOPrefs::instance()->mExcludeHolidays ) { QPtrList<Event> events = calendar()->events( date, true ); Event *event; for( event = events.first(); event; event = events.next() ) { if ( event->isHoliday()) { showHoliday = true; break; } } } #ifndef KORG_NOPLUGINS bool showHoliday = KOPrefs::instance()->mExcludeHolidays && !KOCore::self()->holiday(date).isEmpty(); #endif bool showDay = showSaturday || showSunday || showHoliday; if (showDay) { mHolidayMask.at(i) = true; } else { mHolidayMask.at(i) = false; } } mAgenda->setHolidayMask(&mHolidayMask); mAllDayAgenda->setHolidayMask(&mHolidayMask); } void KOAgendaView::setContentsPos(int y) { mAgenda->setContentsPos(0,y); } -void KOAgendaView::setExpandedButton( bool expanded ) -{ - if ( expanded ) { - mExpandButton->setPixmap( mExpandedPixmap ); - } else { - mExpandButton->setPixmap( mNotExpandedPixmap ); - } -} - void KOAgendaView::clearSelection() { mAgenda->deselectItem(); mAllDayAgenda->deselectItem(); } void KOAgendaView::newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd) { mTimeSpanInAllDay = true; newTimeSpanSelected(gxStart,gyStart,gxEnd,gyEnd); } void KOAgendaView::newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd) { if (!mSelectedDates.count()) return; QDate dayStart = mSelectedDates[gxStart]; QDate dayEnd = mSelectedDates[gxEnd]; QTime timeStart = mAgenda->gyToTime(gyStart); QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); QDateTime dtStart(dayStart,timeStart); QDateTime dtEnd(dayEnd,timeEnd); mTimeSpanBegin = dtStart; mTimeSpanEnd = dtEnd; } void KOAgendaView::deleteSelectedDateTime() { mTimeSpanBegin.setDate(QDate()); mTimeSpanEnd.setDate(QDate()); mTimeSpanInAllDay = false; } void KOAgendaView::keyPressEvent ( QKeyEvent * e ) { e->ignore(); } void KOAgendaView::scrollOneHourUp() { mAgenda->scrollBy ( 0, -mAgenda->contentsHeight () / 24 ); } void KOAgendaView::scrollOneHourDown() { mAgenda->scrollBy ( 0, mAgenda->contentsHeight () / 24 ); } void KOAgendaView::setStartHour( int h ) { mAgenda->setStartHour( h ); } void KOAgendaView::setInitStartHour() { if ( KOPrefs::instance()->mCenterOnCurrentTime ) setStartHour( QTime::currentTime ().hour() ); else setStartHour( KOPrefs::instance()->mDayBegins ); } void KOAgendaView::updateTodo( Todo * t, int ) { if ( !isVisible() ) return; bool remove = false; bool removeAD = false; QDate da; if ( t->hasCompletedDate() ) da = t->completed().date(); else da = t->dtDue().date(); if ( ! t->hasDueDate() && !t->hasCompletedDate() ) { remove = true; removeAD = true; } else { bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ; if ( overdue && QDate::currentDate() >= mSelectedDates.first() && QDate::currentDate() <= mSelectedDates.last()) { removeAD = false; remove = true; } |