KOEventPopupMenu *KOEventView::eventPopup()
{
  KOEventPopupMenu *eventPopup = new KOEventPopupMenu;

  connect( eventPopup, SIGNAL(editIncidenceSignal(Incidence *)),
           SIGNAL(editIncidenceSignal(Incidence *)));
  connect( eventPopup, SIGNAL(showIncidenceSignal(Incidence *)),
           SIGNAL(showIncidenceSignal(Incidence *)));
  connect( eventPopup, SIGNAL(deleteIncidenceSignal(Incidence *)),
           SIGNAL(deleteIncidenceSignal(Incidence *)));
  connect( eventPopup, SIGNAL(cutIncidenceSignal(Incidence *)),
           SIGNAL(cutIncidenceSignal(Incidence *)));
  connect( eventPopup, SIGNAL(copyIncidenceSignal(Incidence *)),
           SIGNAL(copyIncidenceSignal(Incidence *)));
  connect( eventPopup, SIGNAL(pasteIncidenceSignal()),
           SIGNAL(pasteIncidenceSignal()));
  connect( eventPopup, SIGNAL(toggleAlarmSignal(Incidence *)),
           SIGNAL(toggleAlarmSignal(Incidence*)));
  connect( eventPopup, SIGNAL(toggleTodoCompletedSignal(Incidence *)),
           SIGNAL(toggleTodoCompletedSignal(Incidence *)));
  connect( eventPopup, SIGNAL(copyIncidenceToResourceSignal(Incidence *,const QString &)),
           SIGNAL(copyIncidenceToResourceSignal(Incidence *,const QString &)));
  connect( eventPopup, SIGNAL(moveIncidenceToResourceSignal(Incidence *,const QString &)),
           SIGNAL(moveIncidenceToResourceSignal(Incidence *,const QString &)));
  connect( eventPopup, SIGNAL(dissociateOccurrencesSignal(Incidence *,const QDate &)),
           SIGNAL(dissociateOccurrencesSignal(Incidence *,const QDate &)) );

  return eventPopup;
}
void KOViewManager::connectView(KOrg::BaseView *view)
{
    if(!view) return;

    // selecting an incidence
    connect(view, SIGNAL(incidenceSelected(Incidence *)),
            mMainView, SLOT(processMainViewSelection(Incidence *)));

    // showing/editing/deleting an incidence. The calendar view takes care of the action.
    connect(view, SIGNAL(showIncidenceSignal(Incidence *)),
            mMainView, SLOT(showIncidence(Incidence *)));
    connect(view, SIGNAL(editIncidenceSignal(Incidence *)),
            mMainView, SLOT(editIncidence(Incidence *)));
    connect(view, SIGNAL(deleteIncidenceSignal(Incidence *)),
            mMainView, SLOT(deleteIncidence(Incidence *)));
    connect(view, SIGNAL(copyIncidenceSignal(Incidence *)),
            mMainView, SLOT(copyIncidence(Incidence *)));
    connect(view, SIGNAL(cutIncidenceSignal(Incidence *)),
            mMainView, SLOT(cutIncidence(Incidence *)));
    connect(view, SIGNAL(pasteIncidenceSignal()),
            mMainView, SLOT(pasteIncidence()));
    connect(view, SIGNAL(toggleAlarmSignal(Incidence *)),
            mMainView, SLOT(toggleAlarm(Incidence *)));
    connect(view, SIGNAL(dissociateOccurrenceSignal(Incidence *, const QDate &)),
            mMainView, SLOT(dissociateOccurrence(Incidence *, const QDate &)));
    connect(view, SIGNAL(dissociateFutureOccurrenceSignal(Incidence *, const QDate &)),
            mMainView, SLOT(dissociateFutureOccurrence(Incidence *, const QDate &)));

    // signals to create new incidences
    connect(view, SIGNAL(newEventSignal()),
            mMainView, SLOT(newEvent()));
    connect(view, SIGNAL(newEventSignal(const QDateTime &)),
            mMainView, SLOT(newEvent(const QDateTime &)));
    connect(view, SIGNAL(newEventSignal(const QDateTime &, const QDateTime &)),
            mMainView, SLOT(newEvent(const QDateTime &, const QDateTime &)));
    connect(view, SIGNAL(newEventSignal(const QDate &)),
            mMainView, SLOT(newEvent(const QDate &)));
    connect(view, SIGNAL(newTodoSignal(const QDate &)),
            mMainView, SLOT(newTodo(const QDate &)));
    connect(view, SIGNAL(newSubTodoSignal(Todo *)),
            mMainView, SLOT(newSubTodo(Todo *)));
    connect(view, SIGNAL(newJournalSignal(const QDate &)),
            mMainView, SLOT(newJournal(const QDate &)));

    // reload settings
    connect(mMainView, SIGNAL(configChanged()), view, SLOT(updateConfig()));

    // Notifications about added, changed and deleted incidences
    connect(mMainView, SIGNAL(dayPassed(const QDate &)),
            view, SLOT(dayPassed(const QDate &)));
    connect(view, SIGNAL(startMultiModify(const QString &)),
            mMainView, SLOT(startMultiModify(const QString &)));
    connect(view, SIGNAL(endMultiModify()),
            mMainView, SLOT(endMultiModify()));

    connect(mMainView, SIGNAL(newIncidenceChanger(IncidenceChangerBase *)),
            view, SLOT(setIncidenceChanger(IncidenceChangerBase *)));
    view->setIncidenceChanger(mMainView->incidenceChanger());
}
void KOEventPopupMenu::popupPaste()
{
  emit pasteIncidenceSignal();
}