SVN_SILENT made messages (after extraction)
[kdepim.git] / kalarm / templatelistview.cpp
blob529c456f5cd1829f6d0a11f83d124b54da7d8279
1 /*
2 * templatelistview.cpp - widget showing list of alarm templates
3 * Program: kalarm
4 * Copyright © 2007,2008,2010 by David Jarvie <djarvie@kde.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "kalarm.h"
22 #include "templatelistview.h"
24 #include "functions.h"
25 #define TEMPLATE_LIST_MODEL TemplateListModel
27 #include <KLocalizedString>
29 #include <QHeaderView>
30 #include <QApplication>
33 TemplateListView::TemplateListView(QWidget* parent)
34 : EventListView(parent)
36 setEditOnSingleClick(false);
37 setWhatsThis(i18nc("@info:whatsthis", "The list of alarm templates"));
40 void TemplateListView::setModel(QAbstractItemModel* model)
42 EventListView::setModel(model);
43 header()->setMovable(false);
44 header()->setStretchLastSection(true);
45 header()->setResizeMode(TEMPLATE_LIST_MODEL::TypeColumn, QHeaderView::Fixed);
46 const int margin = QApplication::style()->pixelMetric(QStyle::PM_FocusFrameHMargin);
47 header()->resizeSection(TEMPLATE_LIST_MODEL::TypeColumn, ItemListModel::iconWidth() + 2*margin + 2);
50 void TemplateListDelegate::edit(KAEvent* event, EventListView* view)
52 KAlarm::editTemplate(event, static_cast<TemplateListView*>(view));
55 // vim: et sw=4: