author | zautrix <zautrix> | 2005-07-01 06:04:54 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-01 06:04:54 (UTC) |
commit | a7924287e231b461585c4121f6ee2ce32f955089 (patch) (side-by-side diff) | |
tree | 992d503b50212e72d69d845bd8d27cb8f8518c30 /korganizer | |
parent | 7da83cbf37b406a523e36a948039941840d48fb1 (diff) | |
download | kdepimpi-a7924287e231b461585c4121f6ee2ce32f955089.zip kdepimpi-a7924287e231b461585c4121f6ee2ce32f955089.tar.gz kdepimpi-a7924287e231b461585c4121f6ee2ce32f955089.tar.bz2 |
fixxx
-rw-r--r-- | korganizer/koagenda.cpp | 11 | ||||
-rw-r--r-- | korganizer/koagenda.h | 1 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 34 | ||||
-rw-r--r-- | korganizer/koagendaitem.h | 1 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 11 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 1 | ||||
-rw-r--r-- | korganizer/koeventpopupmenu.cpp | 44 | ||||
-rw-r--r-- | korganizer/koeventpopupmenu.h | 4 | ||||
-rw-r--r-- | korganizer/koeventview.cpp | 1 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 8 |
10 files changed, 89 insertions, 27 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index ce73168..f860f7d 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -410,3 +410,12 @@ void KOAgenda::popupMenu() } - +void KOAgenda::categoryChanged(Incidence * inc) +{ + KOAgendaItem *item; + for ( item=mItems.first(); item != 0; item=mItems.next() ) { + if ( item->incidence() == inc ) { + item->initColor (); + item->updateItem(); + } + } +} bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h index fb9983e..de6acac 100644 --- a/korganizer/koagenda.h +++ b/korganizer/koagenda.h @@ -129,2 +129,3 @@ class KOAgenda : public QScrollView public slots: + void categoryChanged(Incidence * inc); void slotClearSelection(); diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index a8e0678..a42d07b 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -99,15 +99,9 @@ QString KOAgendaItem::getWhatsThisText() } -void KOAgendaItem::init ( Incidence *incidence, QDate qd ) + +void KOAgendaItem::initColor () { - mIncidence = incidence; - mDate = qd; - mFirstMultiItem = 0; - mNextMultiItem = 0; - mLastMultiItem = 0; - computeText(); - - if ( (incidence->typeID() == todoID ) && - ( !((static_cast<Todo*>(incidence))->isCompleted()) && - ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { - if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) + if ( (mIncidence->typeID() == todoID ) && + ( !((static_cast<Todo*>(mIncidence))->isCompleted()) && + ((static_cast<Todo*>(mIncidence))->dtDue().date() <= QDate::currentDate()) ) ) { + if ( (static_cast<Todo*>(mIncidence))->dtDue() < QDateTime::currentDateTime().date()) mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; @@ -120,9 +114,9 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd ) if (cat.isEmpty()) { - if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) + if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; else - mBackgroundColor =KOPrefs::instance()->defaultColor( incidence->calID() ); + mBackgroundColor =KOPrefs::instance()->defaultColor( mIncidence->calID() ); } else { mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); - if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) { + if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) { if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) @@ -143,2 +137,12 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd ) mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250); +} +void KOAgendaItem::init ( Incidence *incidence, QDate qd ) +{ + mIncidence = incidence; + mDate = qd; + mFirstMultiItem = 0; + mNextMultiItem = 0; + mLastMultiItem = 0; + computeText(); + initColor(); mConflictItems.clear(); diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h index d1b1940..dc2316a 100644 --- a/korganizer/koagendaitem.h +++ b/korganizer/koagendaitem.h @@ -111,2 +111,3 @@ class KOAgendaItem : public QWidget bool checkLayout(); + void initColor (); public slots: diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index c851ab5..a42227c 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -476,2 +476,7 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); + + connect(mAllAgendaPopup,SIGNAL(categoryChanged(Incidence *)), + this,SLOT(categoryChanged(Incidence *))); + + mAgenda->setPopup( mAllAgendaPopup ); @@ -590,3 +595,7 @@ void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) } - +void KOAgendaView::categoryChanged(Incidence * inc) +{ + mAgenda->categoryChanged( inc ); + mAllDayAgenda->categoryChanged( inc ); +} KOAgendaView::~KOAgendaView() diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index cc953fc..a1cf308 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h @@ -241,2 +241,3 @@ class KOAgendaView : public KOEventView { protected slots: + void categoryChanged( Incidence * ); void slotDaylabelClicked( int ); diff --git a/korganizer/koeventpopupmenu.cpp b/korganizer/koeventpopupmenu.cpp index 17ef81e..90caaf4 100644 --- a/korganizer/koeventpopupmenu.cpp +++ b/korganizer/koeventpopupmenu.cpp @@ -32,4 +32,5 @@ #include "koeventpopupmenu.h" +#include "koprefs.h" -KOEventPopupMenu::KOEventPopupMenu() +KOEventPopupMenu::KOEventPopupMenu(): QPopupMenu() { @@ -54,2 +55,7 @@ KOEventPopupMenu::KOEventPopupMenu() isDisabled = false; + mCatPopup = new QPopupMenu ( this ); + mCatPopup->setCheckable (true); + connect(mCatPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCatPopup())); + connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCatPopup( int ))); + mEditOnlyItems.append(insertItem (i18n("Categories"),mCatPopup )); QValueList<int>::Iterator it; @@ -58,2 +64,3 @@ KOEventPopupMenu::KOEventPopupMenu() } + } @@ -69,2 +76,35 @@ void KOEventPopupMenu::enableDefault( bool enable ) +void KOEventPopupMenu::fillCatPopup() +{ + mCatPopup->clear(); + QStringList checkedCategories = mCurrentIncidence->categories(); + int index = 0; + for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); + it != KOPrefs::instance()->mCustomCategories.end (); + ++it) { + mCatPopup->insertItem (*it, index ); + if (checkedCategories.find (*it) != checkedCategories.end ()) { + mCatPopup->setItemChecked (index, true); + } + ++index; + } +} +void KOEventPopupMenu::computeCatPopup( int index ) +{ + QStringList categories = mCurrentIncidence->categories(); + QString colcat = categories.first(); + if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) + categories.remove (KOPrefs::instance()->mCustomCategories[index]); + else + categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); + categories.sort (); + if ( !colcat.isEmpty() ) { + if ( categories.find ( colcat ) != categories.end () ) { + categories.remove( colcat ); + categories.prepend( colcat ); + } + } + mCurrentIncidence->setCategories( categories ); + emit categoryChanged( mCurrentIncidence ); +} void KOEventPopupMenu::showIncidencePopup(Incidence *incidence) @@ -82,4 +122,2 @@ void KOEventPopupMenu::showIncidencePopup(Incidence *incidence) popup(QCursor::pos()); - } else { - kdDebug() << "KOEventPopupMenu::showEventPopup(): No event selected" << endl; } diff --git a/korganizer/koeventpopupmenu.h b/korganizer/koeventpopupmenu.h index 8fb51fa..3d8b595 100644 --- a/korganizer/koeventpopupmenu.h +++ b/korganizer/koeventpopupmenu.h @@ -56,2 +56,4 @@ class KOEventPopupMenu : public QPopupMenu { void popupBeam(); + void fillCatPopup(); + void computeCatPopup( int ); @@ -65,2 +67,3 @@ class KOEventPopupMenu : public QPopupMenu { void beamIncidenceSignal(Incidence *); + void categoryChanged( Incidence * ); @@ -73,2 +76,3 @@ class KOEventPopupMenu : public QPopupMenu { bool isDisabled; + QPopupMenu *mCatPopup; }; diff --git a/korganizer/koeventview.cpp b/korganizer/koeventview.cpp index bce2626..1d26930 100644 --- a/korganizer/koeventview.cpp +++ b/korganizer/koeventview.cpp @@ -79,3 +79,2 @@ void KOEventView::showIncidencePopup(QPopupMenu *popup,Incidence *event) if (event) popup->popup(QCursor::pos()); - else kdDebug() << "KOEventView::showEventPopup(): No event selected" << endl; } diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 8f17e6e..43e1113 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -237,3 +237,3 @@ bool ListItemVisitor::visit(Journal * j) mItem->setText(9,"---"); - mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); + mItem->setText(10,j->categoriesStr()); mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); @@ -1013,3 +1013,2 @@ void KOListView::showDates(const QDate &start, const QDate &end) QDate date = start; - QPtrList<Journal> j_list; while( date <= end ) { @@ -1017,8 +1016,5 @@ void KOListView::showDates(const QDate &start, const QDate &end) addTodos(calendar()->todos(date)); - Journal* jo = calendar()->journal(date); - if ( jo ) - j_list.append( jo ); + addJournals( calendar()->journals4Date(date) ); date = date.addDays( 1 ); } - addJournals(j_list); emit incidenceSelected( 0 ); |