summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp11
-rw-r--r--korganizer/koagenda.h1
-rw-r--r--korganizer/koagendaitem.cpp34
-rw-r--r--korganizer/koagendaitem.h1
-rw-r--r--korganizer/koagendaview.cpp11
-rw-r--r--korganizer/koagendaview.h1
-rw-r--r--korganizer/koeventpopupmenu.cpp44
-rw-r--r--korganizer/koeventpopupmenu.h4
-rw-r--r--korganizer/koeventview.cpp1
-rw-r--r--korganizer/kolistview.cpp8
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()
410} 410}
411 411void KOAgenda::categoryChanged(Incidence * inc)
412{
413 KOAgendaItem *item;
414 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
415 if ( item->incidence() == inc ) {
416 item->initColor ();
417 item->updateItem();
418 }
419 }
420}
412bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) 421bool 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
129 public slots: 129 public slots:
130 void categoryChanged(Incidence * inc);
130 void slotClearSelection(); 131 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()
99} 99}
100void KOAgendaItem::init ( Incidence *incidence, QDate qd ) 100
101void KOAgendaItem::initColor ()
101{ 102{
102 mIncidence = incidence; 103 if ( (mIncidence->typeID() == todoID ) &&
103 mDate = qd; 104 ( !((static_cast<Todo*>(mIncidence))->isCompleted()) &&
104 mFirstMultiItem = 0; 105 ((static_cast<Todo*>(mIncidence))->dtDue().date() <= QDate::currentDate()) ) ) {
105 mNextMultiItem = 0; 106 if ( (static_cast<Todo*>(mIncidence))->dtDue() < QDateTime::currentDateTime().date())
106 mLastMultiItem = 0;
107 computeText();
108
109 if ( (incidence->typeID() == todoID ) &&
110 ( !((static_cast<Todo*>(incidence))->isCompleted()) &&
111 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
112 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
113 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; 107 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
@@ -120,9 +114,9 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd )
120 if (cat.isEmpty()) { 114 if (cat.isEmpty()) {
121 if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) 115 if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) )
122 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 116 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
123 else 117 else
124 mBackgroundColor =KOPrefs::instance()->defaultColor( incidence->calID() ); 118 mBackgroundColor =KOPrefs::instance()->defaultColor( mIncidence->calID() );
125 } else { 119 } else {
126 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); 120 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
127 if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) { 121 if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) {
128 if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) 122 if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
@@ -143,2 +137,12 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd )
143 mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250); 137 mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250);
138}
139void KOAgendaItem::init ( Incidence *incidence, QDate qd )
140{
141 mIncidence = incidence;
142 mDate = qd;
143 mFirstMultiItem = 0;
144 mNextMultiItem = 0;
145 mLastMultiItem = 0;
146 computeText();
147 initColor();
144 mConflictItems.clear(); 148 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
111 bool checkLayout(); 111 bool checkLayout();
112 void initColor ();
112 public slots: 113 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) :
476 mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 476 mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
477
478 connect(mAllAgendaPopup,SIGNAL(categoryChanged(Incidence *)),
479 this,SLOT(categoryChanged(Incidence *)));
480
481
477 mAgenda->setPopup( mAllAgendaPopup ); 482 mAgenda->setPopup( mAllAgendaPopup );
@@ -590,3 +595,7 @@ void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld )
590} 595}
591 596void KOAgendaView::categoryChanged(Incidence * inc)
597{
598 mAgenda->categoryChanged( inc );
599 mAllDayAgenda->categoryChanged( inc );
600}
592KOAgendaView::~KOAgendaView() 601KOAgendaView::~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 {
241 protected slots: 241 protected slots:
242 void categoryChanged( Incidence * );
242 void slotDaylabelClicked( int ); 243 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 @@
32#include "koeventpopupmenu.h" 32#include "koeventpopupmenu.h"
33#include "koprefs.h"
33 34
34KOEventPopupMenu::KOEventPopupMenu() 35KOEventPopupMenu::KOEventPopupMenu(): QPopupMenu()
35{ 36{
@@ -54,2 +55,7 @@ KOEventPopupMenu::KOEventPopupMenu()
54 isDisabled = false; 55 isDisabled = false;
56 mCatPopup = new QPopupMenu ( this );
57 mCatPopup->setCheckable (true);
58 connect(mCatPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCatPopup()));
59 connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCatPopup( int )));
60 mEditOnlyItems.append(insertItem (i18n("Categories"),mCatPopup ));
55 QValueList<int>::Iterator it; 61 QValueList<int>::Iterator it;
@@ -58,2 +64,3 @@ KOEventPopupMenu::KOEventPopupMenu()
58 } 64 }
65
59} 66}
@@ -69,2 +76,35 @@ void KOEventPopupMenu::enableDefault( bool enable )
69 76
77void KOEventPopupMenu::fillCatPopup()
78{
79 mCatPopup->clear();
80 QStringList checkedCategories = mCurrentIncidence->categories();
81 int index = 0;
82 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
83 it != KOPrefs::instance()->mCustomCategories.end ();
84 ++it) {
85 mCatPopup->insertItem (*it, index );
86 if (checkedCategories.find (*it) != checkedCategories.end ()) {
87 mCatPopup->setItemChecked (index, true);
88 }
89 ++index;
90 }
91}
92void KOEventPopupMenu::computeCatPopup( int index )
93{
94 QStringList categories = mCurrentIncidence->categories();
95 QString colcat = categories.first();
96 if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ())
97 categories.remove (KOPrefs::instance()->mCustomCategories[index]);
98 else
99 categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]);
100 categories.sort ();
101 if ( !colcat.isEmpty() ) {
102 if ( categories.find ( colcat ) != categories.end () ) {
103 categories.remove( colcat );
104 categories.prepend( colcat );
105 }
106 }
107 mCurrentIncidence->setCategories( categories );
108 emit categoryChanged( mCurrentIncidence );
109}
70void KOEventPopupMenu::showIncidencePopup(Incidence *incidence) 110void KOEventPopupMenu::showIncidencePopup(Incidence *incidence)
@@ -82,4 +122,2 @@ void KOEventPopupMenu::showIncidencePopup(Incidence *incidence)
82 popup(QCursor::pos()); 122 popup(QCursor::pos());
83 } else {
84 kdDebug() << "KOEventPopupMenu::showEventPopup(): No event selected" << endl;
85 } 123 }
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 {
56 void popupBeam(); 56 void popupBeam();
57 void fillCatPopup();
58 void computeCatPopup( int );
57 59
@@ -65,2 +67,3 @@ class KOEventPopupMenu : public QPopupMenu {
65 void beamIncidenceSignal(Incidence *); 67 void beamIncidenceSignal(Incidence *);
68 void categoryChanged( Incidence * );
66 69
@@ -73,2 +76,3 @@ class KOEventPopupMenu : public QPopupMenu {
73 bool isDisabled; 76 bool isDisabled;
77 QPopupMenu *mCatPopup;
74}; 78};
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)
79 if (event) popup->popup(QCursor::pos()); 79 if (event) popup->popup(QCursor::pos());
80 else kdDebug() << "KOEventView::showEventPopup(): No event selected" << endl;
81} 80}
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)
237 mItem->setText(9,"---"); 237 mItem->setText(9,"---");
238 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); 238 mItem->setText(10,j->categoriesStr());
239 mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); 239 mItem->setText(11, KOPrefs::instance()->calName( j->calID() ));
@@ -1013,3 +1013,2 @@ void KOListView::showDates(const QDate &start, const QDate &end)
1013 QDate date = start; 1013 QDate date = start;
1014 QPtrList<Journal> j_list;
1015 while( date <= end ) { 1014 while( date <= end ) {
@@ -1017,8 +1016,5 @@ void KOListView::showDates(const QDate &start, const QDate &end)
1017 addTodos(calendar()->todos(date)); 1016 addTodos(calendar()->todos(date));
1018 Journal* jo = calendar()->journal(date); 1017 addJournals( calendar()->journals4Date(date) );
1019 if ( jo )
1020 j_list.append( jo );
1021 date = date.addDays( 1 ); 1018 date = date.addDays( 1 );
1022 } 1019 }
1023 addJournals(j_list);
1024 emit incidenceSelected( 0 ); 1020 emit incidenceSelected( 0 );