24 #include <tqwhatsthis.h>
26 #include <tdelocale.h>
30 #include "shellprocess.h"
31 #include "templatelistview.h"
32 #include "templatepickdlg.moc"
34 static const char TMPL_PICK_DIALOG_NAME[] =
"TemplatePickDialog";
37 TemplatePickDlg::TemplatePickDlg(TQWidget* parent,
const char* name)
38 : KDialogBase(KDialogBase::Plain, i18n(
"Choose Alarm Template"), Ok|Cancel, Ok, parent, name)
40 TQWidget* topWidget = plainPage();
41 TQBoxLayout* topLayout =
new TQVBoxLayout(topWidget);
42 topLayout->setSpacing(spacingHint());
45 bool includeCmdAlarms = ShellProcess::authorised();
46 mTemplateList =
new TemplateListView(includeCmdAlarms, i18n(
"Select a template to base the new alarm on."), topWidget,
"list");
47 mTemplateList->setSelectionMode(TQListView::Single);
48 mTemplateList->refresh();
49 connect(mTemplateList, TQ_SIGNAL(selectionChanged()), TQ_SLOT(slotSelectionChanged()));
51 connect(mTemplateList, TQ_SIGNAL(doubleClicked(TQListViewItem*,
const TQPoint&,
int)), TQ_SLOT(slotOk()));
52 topLayout->addWidget(mTemplateList);
54 slotSelectionChanged();
57 if (KAlarm::readConfigWindowSize(TMPL_PICK_DIALOG_NAME, s))
64 const KAEvent* TemplatePickDlg::selectedTemplate()
const
66 return mTemplateList->selectedEvent();
73 void TemplatePickDlg::slotSelectionChanged()
75 enableButtonOK(mTemplateList->selectedItem());
82 void TemplatePickDlg::resizeEvent(TQResizeEvent* re)
85 KAlarm::writeConfigWindowSize(TMPL_PICK_DIALOG_NAME, re->size());
86 KDialog::resizeEvent(re);
KAEvent corresponds to a KCal::Event instance.