Mailcommon

filteractionwithstringlist.cpp
1/*
2 * SPDX-FileCopyrightText: 1996-1998 Stefan Taferner <taferner@kde.org>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 *
6 */
7
8#include "filteractionwithstringlist.h"
9
10#include <QComboBox>
11
12using namespace MailCommon;
13
18
20{
21 auto comboBox = new QComboBox(parent);
22 comboBox->setMinimumWidth(50);
23 comboBox->setObjectName(QLatin1StringView("combobox"));
24 comboBox->setEditable(false);
25 comboBox->addItems(mParameterList);
26 setParamWidgetValue(comboBox);
28
29 return comboBox;
30}
31
33{
34 mParameter = static_cast<QComboBox *>(paramWidget)->currentText();
35}
36
38{
39 const int index = mParameterList.indexOf(mParameter);
40 static_cast<QComboBox *>(paramWidget)->setCurrentIndex(index >= 0 ? index : 0);
41}
42
44{
45 static_cast<QComboBox *>(paramWidget)->setCurrentIndex(0);
46}
47
49{
50 int index = mParameterList.indexOf(argsStr);
51 if (index < 0) {
52 mParameterList.append(argsStr);
53 index = mParameterList.count() - 1;
54 }
55
56 mParameter = mParameterList.at(index);
57}
58
59#include "moc_filteractionwithstringlist.cpp"
QWidget * createParamWidget(QWidget *parent) const override
Creates a widget for setting the filter action parameter.
void setParamWidgetValue(QWidget *paramWidget) const override
The filter action shall set it's widget's contents from it's parameter.
void applyParamWidgetValue(QWidget *paramWidget) override
The filter action shall set it's parameter from the widget's contents.
void clearParamWidget(QWidget *paramWidget) const override
The filter action shall clear it's parameter widget's contents.
FilterActionWithStringList(const QString &name, const QString &label, QObject *parent=nullptr)
Creates a new filter action.
void argsFromString(const QString &argsStr) override
Read extra arguments from given string.
FilterActionWithString(const QString &name, const QString &label, QObject *parent=nullptr)
Creates a new filter action.
QString name() const
Returns identifier name, ie.
void filterActionModified()
Called to notify that the current FilterAction has had some value modification.
QString label() const
Returns i18n'd label, ie.
The filter dialog.
void currentIndexChanged(int index)
QObject(QObject *parent)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:56:35 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.