23 #include <tdeactionclasses.h>
24 #include <tdepopupmenu.h>
27 #include "alarmcalendar.h"
30 #include "templatemenuaction.moc"
33 TemplateMenuAction::TemplateMenuAction(
const TQString& label,
const TQString& icon, TQObject* receiver,
34 const char* slot, TDEActionCollection* actions,
const char* name)
35 : TDEActionMenu(label, icon, actions, name)
38 connect(popupMenu(), TQ_SIGNAL(aboutToShow()), TQ_SLOT(slotInitMenu()));
39 connect(popupMenu(), TQ_SIGNAL(activated(
int)), TQ_SLOT(slotSelected(
int)));
40 connect(
this, TQ_SIGNAL(selected(
const KAEvent&)), receiver, slot);
47 void TemplateMenuAction::slotInitMenu()
49 TDEPopupMenu* menu = popupMenu();
51 mOriginalTexts.clear();
52 TQValueList<KAEvent> templates = KAlarm::templateList();
53 for (TQValueList<KAEvent>::ConstIterator it = templates.constBegin(); it != templates.constEnd(); ++it)
55 TQString name = (*it).templateName();
57 TQStringList::Iterator tit;
58 for (tit = mOriginalTexts.begin();
59 tit != mOriginalTexts.end() && TQString::localeAwareCompare(name, *tit) > 0;
61 mOriginalTexts.insert(tit, name);
63 for (TQStringList::ConstIterator tit = mOriginalTexts.constBegin(); tit != mOriginalTexts.constEnd(); ++tit)
64 menu->insertItem(*tit);
71 void TemplateMenuAction::slotSelected(
int id)
73 TDEPopupMenu* menu = popupMenu();
74 TQString item = mOriginalTexts[menu->indexOf(
id)];
80 KAEvent templ = KAEvent::findTemplateName(*cal, item);
represents calendar alarms and events
Provides read and write access to calendar files.
KAEvent corresponds to a KCal::Event instance.