Pimcommon

contenttypewidget.cpp
1/*
2 SPDX-FileCopyrightText: 2014-2024 Laurent Montel <montel@kde.org>
3 SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#include "contenttypewidget.h"
9using namespace Qt::Literals::StringLiterals;
10
11#include "collectiontypeutil.h"
12#include <KLocalizedString>
13
14using namespace PimCommon;
15
16ContentTypeWidget::ContentTypeWidget(QWidget *parent)
17 : QComboBox(parent)
18{
19 setObjectName("contentcombobox"_L1);
20 PimCommon::CollectionTypeUtil collectionUtil;
21 addItem(collectionUtil.folderContentDescription(CollectionTypeUtil::ContentsTypeMail));
22 addItem(collectionUtil.folderContentDescription(CollectionTypeUtil::ContentsTypeCalendar));
23 addItem(collectionUtil.folderContentDescription(CollectionTypeUtil::ContentsTypeContact));
24 addItem(collectionUtil.folderContentDescription(CollectionTypeUtil::ContentsTypeNote));
25 addItem(collectionUtil.folderContentDescription(CollectionTypeUtil::ContentsTypeTask));
26 addItem(collectionUtil.folderContentDescription(CollectionTypeUtil::ContentsTypeJournal));
27 addItem(collectionUtil.folderContentDescription(CollectionTypeUtil::ContentsTypeConfiguration));
28 addItem(collectionUtil.folderContentDescription(CollectionTypeUtil::ContentsTypeFreebusy));
29 addItem(collectionUtil.folderContentDescription(CollectionTypeUtil::ContentsTypeFile));
30}
31
32ContentTypeWidget::~ContentTypeWidget() = default;
33
34void ContentTypeWidget::setCurrentItem(const QString &name)
35{
36 const int pos = findText(name);
37 if (pos != -1) {
39 }
40}
41
43{
44 return i18n("&Folder contents:");
45}
46
47#include "moc_contenttypewidget.cpp"
The CollectionTypeUtil class.
static QString labelName()
Label name that should be used in a QFormLayout with a ContentTypeWidget.
QString i18n(const char *text, const TYPE &arg...)
folderdialogacltab.h
void setCurrentIndex(int index)
int findText(const QString &text, Qt::MatchFlags flags) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:02:56 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.