27 #include <tdeactioncollection.h>
28 #include <tdelocale.h>
30 #include <kiconloader.h>
33 #include <libkcal/event.h>
35 #include "koglobals.h"
37 #include <korganizer/baseview.h>
38 #include "koeventpopupmenu.h"
39 #include "koeventpopupmenu.moc"
40 #include "kocorehelper.h"
41 #include "actionmanager.h"
42 #ifndef KORG_NOPRINTER
43 #include "calprinter.h"
46 KOEventPopupMenu::KOEventPopupMenu()
49 mCurrentIncidence = 0;
50 mCurrentDate = TQDate();
51 mHasAdditionalItems =
false;
53 insertItem( i18n(
"&Show"),
this, TQ_SLOT( popupShow() ) );
54 mEditOnlyItems.append(
55 insertItem(i18n(
"&Edit..."),
this, TQ_SLOT( popupEdit() ) ) );
56 #ifndef KORG_NOPRINTER
57 insertItem( KOGlobals::self()->smallIcon(
"printer"), i18n(
"&Print..."),
58 this, TQ_SLOT( print() ) );
61 mEditOnlyItems.append( insertSeparator() );
62 mEditOnlyItems.append(
63 insertItem( KOGlobals::self()->smallIcon(
"edit-cut"), i18n(
"&Cut"),
64 this, TQ_SLOT( popupCut() ) ) );
65 mEditOnlyItems.append(
66 insertItem( KOGlobals::self()->smallIcon(
"edit-copy"), i18n(
"&Copy"),
67 this, TQ_SLOT( popupCopy() ) ) );
69 insertItem( KOGlobals::self()->smallIcon(
"edit-paste"), i18n(
"&Paste"),
70 this, TQ_SLOT( popupPaste() ) );
71 mEditOnlyItems.append(
72 insertItem( KOGlobals::self()->smallIcon(
"edit-delete"), i18n(
"&Delete"),
73 this, TQ_SLOT( popupDelete() ) ) );
75 mEditOnlyItems.append( insertSeparator() );
76 mEditOnlyItems.append(
77 insertItem( KOGlobals::self()->smallIcon(
"bell"), i18n(
"&Toggle Reminder"),
78 this, TQ_SLOT( popupAlarm() ) ) );
80 mRecurrenceItems.append( insertSeparator() );
81 mRecurrenceItems.append(
82 insertItem( i18n(
"&Dissociate This Occurrence"),
83 this, TQ_SLOT( dissociateOccurrence() ) ) );
84 mRecurrenceItems.append(
85 insertItem( i18n(
"&Dissociate Future Occurrences"),
86 this, TQ_SLOT( dissociateFutureOccurrence() ) ) );
89 insertItem( KOGlobals::self()->smallIcon(
"mail-forward"), i18n(
"Send as iCalendar..."),
90 this, TQ_SLOT(forward()) );
93 void KOEventPopupMenu::showIncidencePopup(
Calendar *cal,
Incidence *incidence,
const TQDate &qd )
96 mCurrentIncidence = incidence;
99 if (mCurrentIncidence) {
101 TQValueList<int>::Iterator it;
102 for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) {
103 setItemEnabled(*it,!mCurrentIncidence->isReadOnly());
105 for ( it = mRecurrenceItems.begin(); it != mRecurrenceItems.end(); ++it ) {
106 setItemVisible( *it, mCurrentIncidence->doesRecur() );
108 popup(TQCursor::pos());
110 kdDebug(5850) <<
"KOEventPopupMenu::showEventPopup(): No event selected" << endl;
114 void KOEventPopupMenu::addAdditionalItem(
const TQIconSet &icon,
const TQString &text,
115 const TQObject *receiver,
const char *member,
118 if (!mHasAdditionalItems) {
119 mHasAdditionalItems =
true;
122 int id = insertItem(icon,text,receiver,member);
123 if (editOnly) mEditOnlyItems.append(
id);
126 void KOEventPopupMenu::popupShow()
128 if ( mCurrentIncidence ) {
129 emit showIncidenceSignal( mCurrentIncidence, mCurrentDate );
133 void KOEventPopupMenu::popupEdit()
135 if ( mCurrentIncidence ) {
136 emit editIncidenceSignal( mCurrentIncidence, mCurrentDate );
140 void KOEventPopupMenu::print()
142 #ifndef KORG_NOPRINTER
144 CalPrinter printer(
this, mCalendar, &helper );
145 connect(
this, TQ_SIGNAL(configChanged()), &printer, TQ_SLOT(updateConfig()) );
147 Incidence::List selectedIncidences;
148 selectedIncidences.append( mCurrentIncidence );
150 printer.print( KOrg::CalPrinterBase::Incidence,
151 mCurrentDate, mCurrentDate, selectedIncidences );
155 void KOEventPopupMenu::popupDelete()
157 if (mCurrentIncidence) emit deleteIncidenceSignal(mCurrentIncidence);
160 void KOEventPopupMenu::popupCut()
162 if (mCurrentIncidence) emit cutIncidenceSignal(mCurrentIncidence);
165 void KOEventPopupMenu::popupCopy()
167 if (mCurrentIncidence) emit copyIncidenceSignal(mCurrentIncidence);
170 void KOEventPopupMenu::popupPaste()
172 emit pasteIncidenceSignal();
176 void KOEventPopupMenu::popupAlarm()
178 if (mCurrentIncidence) emit toggleAlarmSignal( mCurrentIncidence );
181 void KOEventPopupMenu::dissociateOccurrence()
183 if ( mCurrentIncidence )
184 emit dissociateOccurrenceSignal( mCurrentIncidence, mCurrentDate );
187 void KOEventPopupMenu::dissociateFutureOccurrence()
189 if ( mCurrentIncidence )
190 emit dissociateFutureOccurrenceSignal( mCurrentIncidence, mCurrentDate );
193 void KOEventPopupMenu::forward()
196 if ( !w || !mCurrentIncidence )
199 TDEAction *action = ac->action(
"schedule_forward" );
static KOrg::MainWindow * findInstance(const KURL &url)
Is there a instance with this URL?
CalPrinter is a class for printing Calendars.
interface for korganizer main window
virtual TDEActionCollection * getActionCollection() const =0
Return actionCollection of this main window.