-rw-r--r-- | korganizer/calendarview.cpp | 1 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 26 | ||||
-rw-r--r-- | korganizer/koeventviewer.h | 1 | ||||
-rw-r--r-- | korganizer/koeventviewerdialog.cpp | 1 | ||||
-rw-r--r-- | korganizer/koeventviewerdialog.h | 1 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 53 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 6 |
7 files changed, 73 insertions, 16 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 72221fd..1785b8a 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -3349,6 +3349,7 @@ KOEventViewerDialog* CalendarView::getEventViewerDialog() | |||
3349 | this, SLOT( slotViewerClosed() ) ); | 3349 | this, SLOT( slotViewerClosed() ) ); |
3350 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), | 3350 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), |
3351 | this, SLOT( todoChanged(Todo *) ) ); | 3351 | this, SLOT( todoChanged(Todo *) ) ); |
3352 | connect( mEventViewerDialog, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); | ||
3352 | mEventViewerDialog->resize( 640, 480 ); | 3353 | mEventViewerDialog->resize( 640, 480 ); |
3353 | 3354 | ||
3354 | } | 3355 | } |
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index f6c252b..2d0bfff 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -110,6 +110,16 @@ void KOEventViewer::printMe() | |||
110 | void KOEventViewer::setSource(const QString& n) | 110 | void KOEventViewer::setSource(const QString& n) |
111 | { | 111 | { |
112 | 112 | ||
113 | if ( n.left(8) == "todo_uid" ) { | ||
114 | int midstr = 9; | ||
115 | #ifdef DESKTOP_VERSION | ||
116 | midstr = 11; | ||
117 | #endif | ||
118 | qDebug("-%s- ", n.mid(midstr).latin1()); | ||
119 | emit showIncidence( n.mid(midstr) ); | ||
120 | return; | ||
121 | } | ||
122 | |||
113 | if ( n.left(3) == "uid" ) | 123 | if ( n.left(3) == "uid" ) |
114 | #ifdef DESKTOP_VERSION | 124 | #ifdef DESKTOP_VERSION |
115 | { | 125 | { |
@@ -530,14 +540,26 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) | |||
530 | } | 540 | } |
531 | if ( event->relatedTo() ) { | 541 | if ( event->relatedTo() ) { |
532 | addTag("b",i18n("Parent todo:<br>")); | 542 | addTag("b",i18n("Parent todo:<br>")); |
533 | mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); | 543 | |
544 | QString t_name = "[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] ";// +event->relatedTo()->summary()); | ||
545 | |||
546 | mText += t_name; | ||
547 | mText += "<a href=\"todo_uid:" + event->relatedTo()->uid() + "\">"; | ||
548 | mText += deTag(event->relatedTo()->summary()); | ||
549 | mText += "</a><br>"; | ||
550 | |||
551 | // mText.append(deTag("[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] " +event->relatedTo()->summary()) +"<br>"); | ||
534 | } | 552 | } |
535 | QPtrList<Incidence> Relations = event->relations(); | 553 | QPtrList<Incidence> Relations = event->relations(); |
536 | Incidence *to; | 554 | Incidence *to; |
537 | if ( Relations.first() ) | 555 | if ( Relations.first() ) |
538 | addTag("b",i18n("Sub todos:<br>")); | 556 | addTag("b",i18n("Sub todos:<br>")); |
539 | for (to=Relations.first();to;to=Relations.next()) { | 557 | for (to=Relations.first();to;to=Relations.next()) { |
540 | mText.append( deTag(to->summary())+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); | 558 | QString t_name = "[" +QString::number(((Todo*)to)->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%] ";// +to->relatedTo()->summary()); |
559 | mText += t_name; | ||
560 | mText += "<a href=\"todo_uid:" + to->uid() + "\">"; | ||
561 | mText += deTag(to->summary()); | ||
562 | mText += "</a><br>"; | ||
541 | 563 | ||
542 | } | 564 | } |
543 | 565 | ||
diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h index 1eeb8d1..64eb4ff 100644 --- a/korganizer/koeventviewer.h +++ b/korganizer/koeventviewer.h | |||
@@ -126,6 +126,7 @@ class KOEventViewer : public QTextBrowser { | |||
126 | Incidence* mCurrentIncidence; | 126 | Incidence* mCurrentIncidence; |
127 | signals: | 127 | signals: |
128 | void launchaddressbook(QString uid); | 128 | void launchaddressbook(QString uid); |
129 | void showIncidence(QString uid); | ||
129 | }; | 130 | }; |
130 | 131 | ||
131 | #endif | 132 | #endif |
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp index 02f13c7..0763825 100644 --- a/korganizer/koeventviewerdialog.cpp +++ b/korganizer/koeventviewerdialog.cpp | |||
@@ -51,6 +51,7 @@ KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) | |||
51 | SLOT(editIncidence())); | 51 | SLOT(editIncidence())); |
52 | QObject::connect(this,SIGNAL(user1Clicked()), | 52 | QObject::connect(this,SIGNAL(user1Clicked()), |
53 | SLOT(showIncidence())); | 53 | SLOT(showIncidence())); |
54 | connect( mEventViewer, SIGNAL( showIncidence( QString ) ),SIGNAL( showIncidence( QString ) )); | ||
54 | mIncidence = 0; | 55 | mIncidence = 0; |
55 | // TODO: Set a sensible size (based on the content?). | 56 | // TODO: Set a sensible size (based on the content?). |
56 | //showMaximized(); | 57 | //showMaximized(); |
diff --git a/korganizer/koeventviewerdialog.h b/korganizer/koeventviewerdialog.h index 29fee49..71696f4 100644 --- a/korganizer/koeventviewerdialog.h +++ b/korganizer/koeventviewerdialog.h | |||
@@ -54,6 +54,7 @@ class KOEventViewerDialog : public KDialogBase { | |||
54 | void print(); | 54 | void print(); |
55 | void setMyFocus(); | 55 | void setMyFocus(); |
56 | signals: | 56 | signals: |
57 | void showIncidence( QString ); | ||
57 | void editIncidence( Incidence* ); | 58 | void editIncidence( Incidence* ); |
58 | void jumpToTime( const QDate &); | 59 | void jumpToTime( const QDate &); |
59 | void showAgendaView( bool ); | 60 | void showAgendaView( bool ); |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index e2966f8..4f42c83 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -567,9 +567,21 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
567 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 567 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
568 | 568 | ||
569 | 569 | ||
570 | mCategoryPopupMenu = new QPopupMenu (this); | ||
571 | mCategoryPopupMenu->setCheckable (true); | ||
572 | connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | ||
573 | connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ())); | ||
574 | |||
575 | mCalPopupMenu = new QPopupMenu (this); | ||
576 | mCalPopupMenu->setCheckable (true); | ||
577 | connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int))); | ||
578 | connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ())); | ||
579 | |||
580 | |||
581 | |||
570 | 582 | ||
571 | mItemPopupMenu = new QPopupMenu(this); | 583 | mItemPopupMenu = new QPopupMenu(this); |
572 | mItemPopupMenu->insertItem(i18n("Show..."), this, | 584 | mItemPopupMenu->insertItem(i18n("Show"), this, |
573 | SLOT (showTodo())); | 585 | SLOT (showTodo())); |
574 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 586 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
575 | SLOT (editTodo())); | 587 | SLOT (editTodo())); |
@@ -585,6 +597,8 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
585 | #endif | 597 | #endif |
586 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 598 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
587 | SLOT (cancelTodo())); | 599 | SLOT (cancelTodo())); |
600 | mItemPopupMenu->insertItem( i18n("Categories"), mCategoryPopupMenu); | ||
601 | mItemPopupMenu->insertItem( i18n("Calendar"), mCalPopupMenu); | ||
588 | mItemPopupMenu->insertSeparator(); | 602 | mItemPopupMenu->insertSeparator(); |
589 | mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, | 603 | mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, |
590 | SLOT (toggleRunningItem())); | 604 | SLOT (toggleRunningItem())); |
@@ -1053,7 +1067,9 @@ void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) | |||
1053 | moveTodo(); | 1067 | moveTodo(); |
1054 | break; | 1068 | break; |
1055 | case 8: | 1069 | case 8: |
1056 | getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; | 1070 | mCategoryPopupMenu->popup(QCursor::pos ()); break; |
1071 | case 9: | ||
1072 | mCalPopupMenu->popup(QCursor::pos ()); break; | ||
1057 | default: | 1073 | default: |
1058 | mItemPopupMenu->popup(QCursor::pos()); | 1074 | mItemPopupMenu->popup(QCursor::pos()); |
1059 | } | 1075 | } |
@@ -1164,17 +1180,11 @@ void KOTodoView::setNewPercentage(int index) | |||
1164 | } | 1180 | } |
1165 | } | 1181 | } |
1166 | 1182 | ||
1167 | 1183 | void KOTodoView::fillCategories () | |
1168 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) | ||
1169 | { | 1184 | { |
1170 | if ( !mCategoryPopupMenu ) { | ||
1171 | mCategoryPopupMenu = new QPopupMenu (this); | ||
1172 | mCategoryPopupMenu->setCheckable (true); | ||
1173 | connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | ||
1174 | } | ||
1175 | mCategoryPopupMenu->clear(); | 1185 | mCategoryPopupMenu->clear(); |
1176 | QStringList checkedCategories = todoItem->todo()->categories (); | 1186 | if ( ! mActiveItem ) return; |
1177 | 1187 | QStringList checkedCategories = mActiveItem->todo()->categories (); | |
1178 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 1188 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
1179 | it != KOPrefs::instance()->mCustomCategories.end (); | 1189 | it != KOPrefs::instance()->mCustomCategories.end (); |
1180 | ++it) { | 1190 | ++it) { |
@@ -1182,7 +1192,26 @@ QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) | |||
1182 | mCategory[index] = *it; | 1192 | mCategory[index] = *it; |
1183 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true); | 1193 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true); |
1184 | } | 1194 | } |
1185 | return mCategoryPopupMenu; | 1195 | } |
1196 | void KOTodoView::fillCal () | ||
1197 | { | ||
1198 | mCalPopupMenu->clear(); | ||
1199 | if (!mActiveItem) return; | ||
1200 | bool readO = mActiveItem->todo()->isReadOnly(); | ||
1201 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | ||
1202 | while ( kkf ) { | ||
1203 | int index = mCalPopupMenu->insertItem( kkf->mName, kkf->mCalNumber); | ||
1204 | if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO ) | ||
1205 | mCalPopupMenu->setItemEnabled( index, false ); | ||
1206 | mCalPopupMenu->setItemChecked (index, kkf->mCalNumber == mActiveItem->todo()->calID()); | ||
1207 | kkf = KOPrefs::instance()->mCalendars.next(); | ||
1208 | } | ||
1209 | } | ||
1210 | void KOTodoView::changedCal (int index ) | ||
1211 | { | ||
1212 | if (!mActiveItem) return; | ||
1213 | mActiveItem->todo()->setCalID( index ); | ||
1214 | mActiveItem->construct(); | ||
1186 | } | 1215 | } |
1187 | void KOTodoView::changedCategories(int index) | 1216 | void KOTodoView::changedCategories(int index) |
1188 | { | 1217 | { |
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 9ae7f53..79cc756 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -172,8 +172,6 @@ class KOTodoView : public KOrg::BaseView | |||
172 | 172 | ||
173 | void saveLayout(KConfig *config, const QString &group) const; | 173 | void saveLayout(KConfig *config, const QString &group) const; |
174 | void restoreLayout(KConfig *config, const QString &group); | 174 | void restoreLayout(KConfig *config, const QString &group); |
175 | /** Create a popup menu to set categories */ | ||
176 | QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); | ||
177 | void setNavigator( DateNavigator* nav ) {mNavigator = nav;} | 175 | void setNavigator( DateNavigator* nav ) {mNavigator = nav;} |
178 | QString getWhatsThisText(QPoint p); | 176 | QString getWhatsThisText(QPoint p); |
179 | void clearList() {mTodoListView->clear(); } | 177 | void clearList() {mTodoListView->clear(); } |
@@ -225,6 +223,9 @@ class KOTodoView : public KOrg::BaseView | |||
225 | void modified(bool); | 223 | void modified(bool); |
226 | void itemDoubleClicked(QListViewItem *item); | 224 | void itemDoubleClicked(QListViewItem *item); |
227 | void resetFocusToList(); | 225 | void resetFocusToList(); |
226 | void fillCategories (); | ||
227 | void fillCal (); | ||
228 | void changedCal (int); | ||
228 | 229 | ||
229 | signals: | 230 | signals: |
230 | void newTodoSignal(); | 231 | void newTodoSignal(); |
@@ -279,6 +280,7 @@ class KOTodoView : public KOrg::BaseView | |||
279 | QPopupMenu *mPriorityPopupMenu; | 280 | QPopupMenu *mPriorityPopupMenu; |
280 | QPopupMenu *mPercentageCompletedPopupMenu; | 281 | QPopupMenu *mPercentageCompletedPopupMenu; |
281 | QPopupMenu *mCategoryPopupMenu; | 282 | QPopupMenu *mCategoryPopupMenu; |
283 | QPopupMenu *mCalPopupMenu; | ||
282 | 284 | ||
283 | QMap<int, int> mPercentage; | 285 | QMap<int, int> mPercentage; |
284 | QMap<int, int> mPriority; | 286 | QMap<int, int> mPriority; |