kalarm
templatepickdlg.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "kalarm.h"
00022
00023 #include <qlayout.h>
00024 #include <qwhatsthis.h>
00025
00026 #include <klocale.h>
00027 #include <kdebug.h>
00028
00029 #include "functions.h"
00030 #include "shellprocess.h"
00031 #include "templatelistview.h"
00032 #include "templatepickdlg.moc"
00033
00034 static const char TMPL_PICK_DIALOG_NAME[] = "TemplatePickDialog";
00035
00036
00037 TemplatePickDlg::TemplatePickDlg(QWidget* parent, const char* name)
00038 : KDialogBase(KDialogBase::Plain, i18n("Choose Alarm Template"), Ok|Cancel, Ok, parent, name)
00039 {
00040 QWidget* topWidget = plainPage();
00041 QBoxLayout* topLayout = new QVBoxLayout(topWidget);
00042 topLayout->setSpacing(spacingHint());
00043
00044
00045 bool includeCmdAlarms = ShellProcess::authorised();
00046 mTemplateList = new TemplateListView(includeCmdAlarms, i18n("Select a template to base the new alarm on."), topWidget, "list");
00047 mTemplateList->setSelectionMode(QListView::Single);
00048 mTemplateList->refresh();
00049 connect(mTemplateList, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()));
00050 connect(mTemplateList, SIGNAL(executed(QListViewItem*)), SLOT(slotOk()));
00051 topLayout->addWidget(mTemplateList);
00052
00053 slotSelectionChanged();
00054
00055 QSize s;
00056 if (KAlarm::readConfigWindowSize(TMPL_PICK_DIALOG_NAME, s))
00057 resize(s);
00058 }
00059
00060
00061
00062
00063 const KAEvent* TemplatePickDlg::selectedTemplate() const
00064 {
00065 return mTemplateList->selectedEvent();
00066 }
00067
00068
00069
00070
00071
00072 void TemplatePickDlg::slotSelectionChanged()
00073 {
00074 enableButtonOK(mTemplateList->selectedItem());
00075 }
00076
00077
00078
00079
00080
00081 void TemplatePickDlg::resizeEvent(QResizeEvent* re)
00082 {
00083 if (isVisible())
00084 KAlarm::writeConfigWindowSize(TMPL_PICK_DIALOG_NAME, re->size());
00085 KDialog::resizeEvent(re);
00086 }
|