summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
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
@@ -409,5 +409,14 @@ void KOAgenda::popupMenu()
mPopupKind = 0;
}
-
+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
@@ -128,4 +128,5 @@ class KOAgenda : public QScrollView
public slots:
+ void categoryChanged(Incidence * inc);
void slotClearSelection();
void popupMenu();
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index a8e0678..a42d07b 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -98,17 +98,11 @@ QString KOAgendaItem::getWhatsThisText()
return "KOAgendaItem::getWhatsThisText()::internal error";
}
-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 ;
else
@@ -119,11 +113,11 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd )
QString cat = categories.first();
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 )
mBackgroundColor = KOPrefs::instance()->mTodoDoneColor;
@@ -142,4 +136,14 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd )
setBackgroundColor( mBackgroundColor );
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();
setCellXY(0,0,1);
diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h
index d1b1940..dc2316a 100644
--- a/korganizer/koagendaitem.h
+++ b/korganizer/koagendaitem.h
@@ -110,4 +110,5 @@ class KOAgendaItem : public QWidget
void recreateIncidence();
bool checkLayout();
+ void initColor ();
public slots:
bool updateIcons( QPainter *, bool );
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index c851ab5..a42227c 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -475,4 +475,9 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
+
+ connect(mAllAgendaPopup,SIGNAL(categoryChanged(Incidence *)),
+ this,SLOT(categoryChanged(Incidence *)));
+
+
mAgenda->setPopup( mAllAgendaPopup );
mAllDayAgenda->setPopup( mAllAgendaPopup );
@@ -589,5 +594,9 @@ 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
@@ -240,4 +240,5 @@ class KOAgendaView : public KOEventView {
protected slots:
+ void categoryChanged( Incidence * );
void slotDaylabelClicked( int );
/** Update event belonging to agenda item */
diff --git a/korganizer/koeventpopupmenu.cpp b/korganizer/koeventpopupmenu.cpp
index 17ef81e..90caaf4 100644
--- a/korganizer/koeventpopupmenu.cpp
+++ b/korganizer/koeventpopupmenu.cpp
@@ -31,6 +31,7 @@
#include "koeventpopupmenu.h"
+#include "koprefs.h"
-KOEventPopupMenu::KOEventPopupMenu()
+KOEventPopupMenu::KOEventPopupMenu(): QPopupMenu()
{
mCurrentIncidence = 0;
@@ -53,8 +54,14 @@ KOEventPopupMenu::KOEventPopupMenu()
this,SLOT(popupCancel())));
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;
for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) {
mSingleOnlyItems.append(*it);
}
+
}
void KOEventPopupMenu::enableDefault( bool enable )
@@ -68,4 +75,37 @@ 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)
{
@@ -81,6 +121,4 @@ 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
@@ -55,4 +55,6 @@ class KOEventPopupMenu : public QPopupMenu {
void popupMove();
void popupBeam();
+ void fillCatPopup();
+ void computeCatPopup( int );
signals:
@@ -64,4 +66,5 @@ class KOEventPopupMenu : public QPopupMenu {
void moveIncidenceSignal(Incidence *);
void beamIncidenceSignal(Incidence *);
+ void categoryChanged( Incidence * );
private:
@@ -72,4 +75,5 @@ class KOEventPopupMenu : public QPopupMenu {
QValueList<int> mSingleOnlyItems;
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
@@ -78,5 +78,4 @@ void KOEventView::showIncidencePopup(QPopupMenu *popup,Incidence *event)
mCurrentIncidence = 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
@@ -236,5 +236,5 @@ bool ListItemVisitor::visit(Journal * j)
mItem->setText(8,"---");
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() ));
@@ -1012,14 +1012,10 @@ void KOListView::showDates(const QDate &start, const QDate &end)
mStartDate = start;
QDate date = start;
- QPtrList<Journal> j_list;
while( date <= end ) {
addEvents(calendar()->events(date));
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 );
updateView();