Commit 9caad100 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Create list of action

parent 5d8e187a
......@@ -26,6 +26,7 @@ set(ksieveui_LIB_SRCS
autocreatescripts/sievescriptdescriptiondialog.cpp
autocreatescripts/sieveactionwidgetlister.cpp
autocreatescripts/sievescriptpage.cpp
autocreatescripts/sieveactions/sieveactionlist.cpp
autocreatescripts/sieveactions/sieveaction.cpp
autocreatescripts/sieveactions/sieveactiondiscard.cpp
autocreatescripts/sieveactions/sieveactionstop.cpp
......
/*
Copyright (c) 2013 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "sieveactionlist.h"
#include "sieveaction.h"
#include "sieveactiondiscard.h"
#include "sieveactionsetflags.h"
#include "sieveactionstop.h"
QList<KSieveUi::SieveAction *> KSieveUi::SieveActionList::actionList()
{
QList<KSieveUi::SieveAction*> list;
list.append(new KSieveUi::SieveActionDiscard);
list.append(new KSieveUi::SieveActionStop);
list.append(new KSieveUi::SieveActionSetFlags);
return list;
}
/*
Copyright (c) 2013 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef SIEVEACTIONLIST_H
#define SIEVEACTIONLIST_H
#include <QList>
namespace KSieveUi {
class SieveAction;
namespace SieveActionList {
QList<KSieveUi::SieveAction *> actionList();
}
}
#endif // SIEVEACTIONLIST_H
......@@ -17,6 +17,7 @@
#include "sieveactionwidgetlister.h"
#include "sieveactions/sieveaction.h"
#include "sieveactions/sieveactionlist.h"
#include "pimcommon/minimumcombobox.h"
#include <KPushButton>
......@@ -25,6 +26,7 @@
#include <QGridLayout>
#include <QLabel>
#include <QDebug>
using namespace KSieveUi;
......@@ -65,6 +67,20 @@ void SieveActionWidget::initWidget()
mComboBox = new PimCommon::MinimumComboBox;
mComboBox->setEditable( false );
const QList<KSieveUi::SieveAction*> list = KSieveUi::SieveActionList::actionList();
QList<KSieveUi::SieveAction*>::const_iterator it;
QList<KSieveUi::SieveAction*>::const_iterator end( list.constEnd() );
int index = 0;
for ( index = 0, it = list.constBegin(); it != end; ++it, ++index ) {
// append to the list of actions:
mActionList.append( *it );
// add (i18n-ized) name to combo box
mComboBox->addItem( (*it)->label(),(*it)->name() );
// Register the FilterAction modification signal
connect( *it, SIGNAL(filterActionModified()), this, SIGNAL(filterModified()) );
}
mComboBox->setMaxCount( mComboBox->count() );
mComboBox->adjustSize();
mLayout->addWidget(mComboBox, 1, 1);
......
......@@ -55,8 +55,6 @@ void SieveConditionWidget::generatedScript(QString &script)
//TODO
}
void SieveConditionWidget::initWidget()
{
mLayout = new QGridLayout(this);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment