Commit c42d4c91 authored by David Jarvie's avatar David Jarvie
Browse files

Rename some KAEvent methods to make names more descriptive

parent 3f983522
......@@ -127,7 +127,7 @@ void SerializerPluginKAlarm::compare(AbstractDifferencesReporter* reporter, cons
reportDifference(reporter, KAEventFormatter::Id);
if (eventL.revision() != eventR.revision())
reportDifference(reporter, KAEventFormatter::Revision);
if (eventL.action() != eventR.action())
if (eventL.actionSubType() != eventR.actionSubType())
reportDifference(reporter, KAEventFormatter::AlarmType);
if (eventL.category() != eventR.category())
reportDifference(reporter, KAEventFormatter::AlarmCategory);
......
......@@ -145,9 +145,9 @@ bool KAEventFormatter::isApplicable(Parameter param) const
case MessageText:
return mEvent.action() == KAEvent::MESSAGE;
return mEvent.actionSubType() == KAEvent::MESSAGE;
case MessageFile:
return mEvent.action() == KAEvent::FILE;
return mEvent.actionSubType() == KAEvent::FILE;
case FgColour:
case BgColour:
case Font:
......@@ -158,7 +158,7 @@ bool KAEventFormatter::isApplicable(Parameter param) const
case Reminder:
case DeferralType:
case DeferDefault:
return mEvent.displayAction();
return mEvent.actionTypes() & KAEvent::ACT_DISPLAY;
case ReminderOnce:
return mEvent.reminderMinutes() && mEvent.recurs();
case DeferralTime:
......@@ -169,7 +169,7 @@ bool KAEventFormatter::isApplicable(Parameter param) const
case PreActionNoError:
return !mEvent.preAction().isEmpty();
case Sound:
return mEvent.action() == KAEvent::MESSAGE || mEvent.action() == KAEvent::AUDIO;
return mEvent.actionSubType() == KAEvent::MESSAGE || mEvent.actionSubType() == KAEvent::AUDIO;
case SoundRepeat:
return !mEvent.audioFile().isEmpty();
case SoundVolume:
......@@ -181,7 +181,7 @@ bool KAEventFormatter::isApplicable(Parameter param) const
case Command:
case LogFile:
case CommandXTerm:
return mEvent.action() == KAEvent::COMMAND;
return mEvent.actionSubType() == KAEvent::COMMAND;
case EmailSubject:
case EmailFromId:
......@@ -189,7 +189,7 @@ bool KAEventFormatter::isApplicable(Parameter param) const
case EmailBcc:
case EmailBody:
case EmailAttachments:
return mEvent.action() == KAEvent::EMAIL;
return mEvent.actionSubType() == KAEvent::EMAIL;
}
return false;
}
......@@ -200,7 +200,7 @@ QString KAEventFormatter::value(Parameter param) const
{
case Id: return mEvent.id();
case AlarmType:
switch (mEvent.action())
switch (mEvent.actionSubType())
{
case KAEvent::MESSAGE: return i18nc("@info/plain Alarm type", "Display (text)");
case KAEvent::FILE: return i18nc("@info/plain Alarm type", "Display (file)");
......@@ -258,8 +258,8 @@ QString KAEventFormatter::value(Parameter param) const
return i18nc("@info/plain", "%1", value);
}
case MessageText: return (mEvent.action() == KAEvent::MESSAGE) ? mEvent.cleanText() : QString();
case MessageFile: return (mEvent.action() == KAEvent::FILE) ? mEvent.cleanText() : QString();
case MessageText: return (mEvent.actionSubType() == KAEvent::MESSAGE) ? mEvent.cleanText() : QString();
case MessageFile: return (mEvent.actionSubType() == KAEvent::FILE) ? mEvent.cleanText() : QString();
case FgColour: return mEvent.fgColour().name();
case BgColour: return mEvent.bgColour().name();
case Font: return mEvent.useDefaultFont() ? i18nc("@info/plain Using default font", "Default") : mEvent.font().toString();
......@@ -289,12 +289,12 @@ QString KAEventFormatter::value(Parameter param) const
? i18ncp("@info/plain", "1 Second", "%s Seconds", mEvent.fadeSeconds())
: mUnspecifiedValue;
case Command: return (mEvent.action() == KAEvent::COMMAND) ? mEvent.cleanText() : QString();
case Command: return (mEvent.actionSubType() == KAEvent::COMMAND) ? mEvent.cleanText() : QString();
case LogFile: return mEvent.logFile();
case CommandXTerm: return trueFalse(mEvent.commandXterm());
case EmailSubject: return mEvent.emailSubject();
case EmailFromId: return (mEvent.action() == KAEvent::EMAIL) ? number(mEvent.emailFromId()) : QString();
case EmailFromId: return (mEvent.actionSubType() == KAEvent::EMAIL) ? number(mEvent.emailFromId()) : QString();
case EmailTo: return mEvent.emailAddresses(", ");
case EmailBcc: return trueFalse(mEvent.emailBcc());
case EmailBody: return mEvent.emailMessage();
......
......@@ -185,7 +185,7 @@ QVariant AkonadiModel::data(const QModelIndex& index, int role) const
case ValueRole:
case StatusRole:
case AlarmActionsRole:
case AlarmActionRole:
case AlarmSubActionRole:
case EnabledRole:
case EnabledTypesRole:
case CommandErrorRole:
......@@ -282,9 +282,9 @@ QVariant AkonadiModel::data(const QModelIndex& index, int role) const
if (!event.isValid())
return QVariant();
if (role == AlarmActionsRole)
return event.actions();
if (role == AlarmActionRole)
return event.action();
return event.actionTypes();
if (role == AlarmSubActionRole)
return event.actionSubType();
bool calendarColour = false;
switch (column)
{
......@@ -352,20 +352,21 @@ QVariant AkonadiModel::data(const QModelIndex& index, int role) const
switch (role)
{
case Qt::BackgroundRole:
if (event.action() == KAEvent::MESSAGE
|| event.action() == KAEvent::FILE
|| (event.action() == KAEvent::COMMAND && event.commandDisplay()))
{
KAEvent::Actions type = event.actionTypes();
if (type & KAEvent::ACT_DISPLAY)
return event.bgColour();
if (event.action() == KAEvent::COMMAND)
if (type == KAEvent::ACT_COMMAND)
{
if (event.commandError() != KAEvent::CMD_NO_ERROR)
return Qt::red;
}
break;
}
case Qt::ForegroundRole:
if (event.commandError() != KAEvent::CMD_NO_ERROR)
{
if (event.action() == KAEvent::COMMAND && !event.commandDisplay())
if (event.actionTypes() == KAEvent::ACT_COMMAND)
return Qt::white;
QColor colour = Qt::red;
int r, g, b;
......@@ -381,8 +382,8 @@ QVariant AkonadiModel::data(const QModelIndex& index, int role) const
break;
case SortRole:
{
unsigned i = (event.action() == KAEvent::MESSAGE || event.action() == KAEvent::FILE)
? event.bgColour().rgb() : 0;
unsigned i = (event.actionTypes() == KAEvent::ACT_DISPLAY)
? event.bgColour().rgb() : 0;
return QString("%1").arg(i, 6, 10, QLatin1Char('0'));
}
default:
......@@ -411,9 +412,9 @@ QVariant AkonadiModel::data(const QModelIndex& index, int role) const
#endif
return QString();
case ValueRole:
return static_cast<int>(event.action());
return static_cast<int>(event.actionSubType());
case SortRole:
return QString("%1").arg(event.action(), 2, 10, QLatin1Char('0'));
return QString("%1").arg(event.actionSubType(), 2, 10, QLatin1Char('0'));
}
break;
case TextColumn:
......@@ -1040,19 +1041,19 @@ QString AkonadiModel::repeatOrder(const KAEvent& event) const
*/
QPixmap* AkonadiModel::eventIcon(const KAEvent& event) const
{
switch (event.action())
switch (event.actionTypes())
{
case KAAlarm::FILE:
return mFileIcon;
case KAAlarm::EMAIL:
case KAEvent::ACT_EMAIL:
return mEmailIcon;
case KAAlarm::AUDIO:
case KAEvent::ACT_AUDIO:
return mAudioIcon;
case KAAlarm::COMMAND:
if (!event.commandDisplay())
return mCommandIcon;
// fall through to MESSAGE
case KAAlarm::MESSAGE:
case KAEvent::ACT_COMMAND:
return mCommandIcon;
case KAEvent::ACT_DISPLAY:
if (event.actionSubType() == KAEvent::FILE)
return mFileIcon;
// fall through to ACT_DISPLAY_COMMAND
case KAEvent::ACT_DISPLAY_COMMAND:
default:
return mTextIcon;
}
......
......@@ -63,7 +63,7 @@ class AkonadiModel : public Akonadi::EntityTreeModel
EnabledRole, // true for enabled alarm, false for disabled
StatusRole, // KAEvent::ACTIVE/ARCHIVED/TEMPLATE
AlarmActionsRole, // KAEvent::Actions
AlarmActionRole, // KAEvent::Action
AlarmSubActionRole, // KAEvent::Action
ValueRole, // numeric value
SortRole, // the value to use for sorting
CommandErrorRole // last command execution error for alarm (per user)
......
......@@ -2,7 +2,7 @@
* birthdaymodel.cpp - model class for birthdays from address book
* Program: kalarm
* Copyright © 2009 by Tobias Koenig <tokoe@kde.org>
* Copyright © 2007-2010 by David Jarvie <djarvie@kde.org>
* Copyright © 2007-2011 by David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -99,7 +99,7 @@ void BirthdaySortModel::setPrefixSuffix(const QString& prefix, const QString& su
for (int i = 0, end = events.count(); i < end; ++i)
{
KAEvent* event = events[i];
if (event->action() == KAEvent::MESSAGE
if (event->actionSubType() == KAEvent::MESSAGE
&& event->recurType() == KARecurrence::ANNUAL_DATE
&& (prefix.isEmpty() || event->message().startsWith(prefix)))
mContactsWithAlarm.append(event->message());
......
/*
* alarmtext.cpp - text/email alarm text conversion
* Program: kalarm
* Copyright © 2004,2005,2007-2010 by David Jarvie <djarvie@kde.org>
* Copyright © 2004,2005,2007-2011 by David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -354,7 +354,7 @@ QString AlarmText::summary(const KAEvent& event, int maxLines, bool* truncated)
{
static const QRegExp localfile("^file:/+");
QString text;
switch (event.action())
switch (event.actionSubType())
{
case KAEvent::AUDIO:
text = event.audioFile();
......
......@@ -1262,7 +1262,7 @@ void KAEvent::Private::setRepeatAtLogin(bool rl)
mRepeatAtLogin = rl;
if (mRepeatAtLogin)
{
// Cancel reminder, late-cancel and copy-to-KOrganizer
// Cancel pre-alarm reminder, late-cancel and copy-to-KOrganizer
if (mReminderMinutes >= 0)
setReminder(0, false);
mLateCancel = 0;
......@@ -2049,7 +2049,7 @@ int KAEvent::Private::flags() const
| (mEnabled ? 0 : DISABLED);
}
KAEvent::Actions KAEvent::actions() const
KAEvent::Actions KAEvent::actionTypes() const
{
switch (d->mActionType)
{
......
......@@ -341,7 +341,6 @@ class KALARM_CAL_EXPORT KAEvent
OccurType setNextOccurrence(const KDateTime& preDateTime) { return d->setNextOccurrence(preDateTime); }
void setFirstRecurrence() { d->setFirstRecurrence(); }
void setCategory(KAlarm::CalEvent::Type s) { d->setCategory(s); }
void setUid(KAlarm::CalEvent::Type s) { d->mEventID = KAlarm::CalEvent::uid(d->mEventID, s); }
void setEventId(const QString& id) { d->mEventID = id; }
#ifdef USE_AKONADI
void setItemId(Akonadi::Item::Id id) { d->mItemId = id; }
......@@ -430,9 +429,8 @@ class KALARM_CAL_EXPORT KAEvent
bool updateKCalEvent(KCal::Event* e, UidAction u) const
{ return d->updateKCalEvent(e, u); }
#endif
Action action() const { return (Action)d->mActionType; }
Actions actions() const;
bool displayAction() const { return d->mActionType == KAAlarmEventBase::T_MESSAGE || d->mActionType == KAAlarmEventBase::T_FILE || (d->mActionType == KAAlarmEventBase::T_COMMAND && d->mCommandDisplay); }
Action actionSubType() const { return (Action)d->mActionType; }
Actions actionTypes() const;
const QString& id() const { return d->mEventID; }
#ifdef USE_AKONADI
Akonadi::Item::Id itemId() const { return d->mItemId; }
......
......@@ -119,7 +119,7 @@ EditAlarmDlg* EditAlarmDlg::create(bool Template, Type type, QWidget* parent, Ge
EditAlarmDlg* EditAlarmDlg::create(bool Template, const KAEvent* event, bool newAlarm, QWidget* parent,
GetResourceType getResource, bool readOnly)
{
switch (event->actions())
switch (event->actionTypes())
{
case KAEvent::ACT_COMMAND: return new EditCommandAlarmDlg(Template, event, newAlarm, parent, getResource, readOnly);
case KAEvent::ACT_DISPLAY_COMMAND:
......@@ -168,7 +168,7 @@ EditAlarmDlg::EditAlarmDlg(bool Template, KAEvent::Action action, QWidget* paren
EditAlarmDlg::EditAlarmDlg(bool Template, const KAEvent* event, bool newAlarm, QWidget* parent,
GetResourceType getResource, bool readOnly)
: KDialog(parent),
mAlarmType(event->action()),
mAlarmType(event->actionSubType()),
mMainPageShown(false),
mRecurPageShown(false),
mRecurSetDefaultEndDate(true),
......@@ -553,7 +553,7 @@ void EditAlarmDlg::initValues(const KAEvent* event)
}
}
KAEvent::Action action = event->action();
KAEvent::Action action = event->actionSubType();
AlarmText altext;
if (event->commandScript())
altext.setScript(event->cleanText());
......
......@@ -201,7 +201,7 @@ QVariant EventListModel::data(const QModelIndex& index, int role) const
switch (role)
{
case Qt::BackgroundRole:
switch (event->actions())
switch (event->actionTypes())
{
case KAEvent::ACT_DISPLAY_COMMAND:
case KAEvent::ACT_DISPLAY:
......@@ -217,7 +217,7 @@ QVariant EventListModel::data(const QModelIndex& index, int role) const
case Qt::ForegroundRole:
if (event->commandError() != KAEvent::CMD_NO_ERROR)
{
if (event->actions() == KAEvent::ACT_COMMAND)
if (event->actionTypes() == KAEvent::ACT_COMMAND)
return Qt::white;
QColor colour = Qt::red;
int r, g, b;
......@@ -233,7 +233,7 @@ QVariant EventListModel::data(const QModelIndex& index, int role) const
break;
case SortRole:
{
unsigned i = (event->actions() == KAEvent::ACT_DISPLAY)
unsigned i = (event->actionTypes() == KAEvent::ACT_DISPLAY)
? event->bgColour().rgb() : 0;
return QString("%1").arg(i, 6, 10, QLatin1Char('0'));
}
......@@ -260,9 +260,9 @@ QVariant EventListModel::data(const QModelIndex& index, int role) const
#endif
return QString();
case ValueRole:
return static_cast<int>(event->action());
return static_cast<int>(event->actionSubType());
case SortRole:
return QString("%1").arg(event->action(), 2, 10, QLatin1Char('0'));
return QString("%1").arg(event->actionSubType(), 2, 10, QLatin1Char('0'));
}
break;
case TextColumn:
......@@ -939,7 +939,7 @@ QString EventListModel::repeatOrder(const KAEvent* event) const
*/
QPixmap* EventListModel::eventIcon(const KAEvent* event) const
{
switch (event->actions())
switch (event->actionTypes())
{
case KAEvent::ACT_EMAIL:
return mEmailIcon;
......@@ -948,7 +948,7 @@ QPixmap* EventListModel::eventIcon(const KAEvent* event) const
case KAEvent::ACT_COMMAND:
return mCommandIcon;
case KAEvent::ACT_DISPLAY:
if (event->action() == KAEvent::FILE)
if (event->actionSubType() == KAEvent::FILE)
return mFileIcon;
// fall through to ACT_DISPLAY_COMMAND
case KAEvent::ACT_DISPLAY_COMMAND:
......
......@@ -226,13 +226,22 @@ void Find::display()
archived = true;
else
live = true;
switch (event->action())
switch (event->actionTypes())
{
case KAEvent::MESSAGE: text = true; break;
case KAEvent::FILE: file = true; break;
case KAEvent::COMMAND: command = true; break;
case KAEvent::EMAIL: email = true; break;
case KAEvent::AUDIO: audio = true; break;
case KAEvent::ACT_EMAIL: email = true; break;
case KAEvent::ACT_AUDIO: audio = true; break;
case KAEvent::ACT_COMMAND: command = true; break;
case KAEvent::ACT_DISPLAY:
if (event->actionSubType() == KAEvent::FILE)
{
file = true;
break;
}
// fall through to ACT_DISPLAY_COMMAND
case KAEvent::ACT_DISPLAY_COMMAND:
default:
text = true;
break;
}
}
mLive->setEnabled(live);
......@@ -350,30 +359,9 @@ void Find::findNext(bool forward, bool checkEnd, bool fromCurrent)
if ((live && !(mOptions & FIND_LIVE))
|| (!live && !(mOptions & FIND_ARCHIVED)))
continue; // we're not searching this type of alarm
switch (event->action())
switch (event->actionTypes())
{
case KAEvent::MESSAGE:
if (!(mOptions & FIND_MESSAGE))
break;
mFind->setData(event->cleanText());
found = (mFind->find() == KFind::Match);
break;
case KAEvent::FILE:
if (!(mOptions & FIND_FILE))
break;
mFind->setData(event->cleanText());
found = (mFind->find() == KFind::Match);
break;
case KAEvent::COMMAND:
if (!(mOptions & FIND_COMMAND))
break;
mFind->setData(event->cleanText());
found = (mFind->find() == KFind::Match);
break;
case KAEvent::EMAIL:
case KAEvent::ACT_EMAIL:
if (!(mOptions & FIND_EMAIL))
break;
mFind->setData(event->emailAddresses(", "));
......@@ -392,12 +380,38 @@ void Find::findNext(bool forward, bool checkEnd, bool fromCurrent)
found = (mFind->find() == KFind::Match);
break;
case KAEvent::AUDIO:
case KAEvent::ACT_AUDIO:
if (!(mOptions & FIND_AUDIO))
break;
mFind->setData(event->audioFile());
found = (mFind->find() == KFind::Match);
break;
case KAEvent::ACT_COMMAND:
if (!(mOptions & FIND_COMMAND))
break;
mFind->setData(event->cleanText());
found = (mFind->find() == KFind::Match);
break;
case KAEvent::ACT_DISPLAY:
if (event->actionSubType() == KAEvent::FILE)
{
if (!(mOptions & FIND_FILE))
break;
mFind->setData(event->cleanText());
found = (mFind->find() == KFind::Match);
break;
}
// fall through to ACT_DISPLAY_COMMAND
case KAEvent::ACT_DISPLAY_COMMAND:
if (!(mOptions & FIND_MESSAGE))
break;
mFind->setData(event->cleanText());
found = (mFind->find() == KFind::Match);
break;
default:
break;
}
if (found)
break;
......
......@@ -966,7 +966,7 @@ UpdateStatus enableEvents(KAEvent::List& events, bool enable, QWidget* msgParent
cal->disabledChanged(newev);
// If we're disabling a display alarm, close any message window
if (!enable && event->displayAction())
if (!enable && (event->actionTypes() & KAEvent::ACT_DISPLAY))
{
MessageWin* win = MessageWin::findEvent(event->id());
delete win;
......@@ -1617,7 +1617,7 @@ KAEvent::List templateList()
for (int i = 0, end = events.count(); i < end; ++i)
{
KAEvent* event = events[i];
if (includeCmdAlarms || !(event->actions() & KAEvent::ACT_COMMAND))
if (includeCmdAlarms || !(event->actionTypes() & KAEvent::ACT_COMMAND))
templates.append(event);
}
return templates;
......@@ -1630,7 +1630,7 @@ KAEvent::List templateList()
*/
void outputAlarmWarnings(QWidget* parent, const KAEvent* event)
{
if (event && event->action() == KAEvent::EMAIL
if (event && event->actionTypes() == KAEvent::ACT_EMAIL
&& Preferences::emailAddress().isEmpty())
KAMessageBox::information(parent, i18nc("@info Please set the 'From' email address...",
"<para>%1</para><para>Please set it in the Configuration dialog.</para>", KAMail::i18n_NeedFromEmailAddress()));
......@@ -1676,7 +1676,7 @@ void refreshAlarmsIfQueued()
for (int i = 0, end = events.count(); i < end; ++i)
{
KAEvent* event = events[i];
if (!event->enabled() && event->displayAction())
if (!event->enabled() && (event->actionTypes() & KAEvent::ACT_DISPLAY))
{
MessageWin* win = MessageWin::findEvent(event->id());
delete win;
......@@ -2281,7 +2281,7 @@ KAlarm::UpdateStatus sendToKOrganizer(const KAEvent* event)
kcalEvent->setUid(uid);
kcalEvent->clearAlarms();
QString userEmail;
switch (event->actions())
switch (event->actionTypes())
{
case KAEvent::ACT_DISPLAY:
case KAEvent::ACT_COMMAND:
......
......@@ -1596,11 +1596,19 @@ void* KAlarmApp::execAlarm(KAEvent& event, const KAAlarm& alarm, bool reschedule
void* result = (void*)1;
event.setArchive();
KAAlarm::Action action = alarm.action();
if (action == KAAlarm::COMMAND && event.commandDisplay())
action = KAAlarm::MESSAGE;
switch (action)
switch (alarm.action())
{
case KAAlarm::COMMAND:
if (!event.commandDisplay())
{
// execCommandAlarm() will error if the user is not authorised
// to run shell commands.
result = execCommandAlarm(event, alarm);
if (reschedule)
rescheduleAlarm(event, alarm, true);
break;
}
// fall through to MESSAGE
case KAAlarm::MESSAGE:
case KAAlarm::FILE:
{
......@@ -1620,7 +1628,6 @@ void* KAlarmApp::execAlarm(KAEvent& event, const KAAlarm& alarm, bool reschedule
//
// NOTE: The pre-action is not executed for a recurring alarm if an
// alarm message window for a previous occurrence is still visible.
// Check whether the command is already being executed for this alarm.
for (int i = 0, end = mCommandProcesses.count(); i < end; ++i)
{
......@@ -1684,13 +1691,6 @@ void* KAlarmApp::execAlarm(KAEvent& event, const KAAlarm& alarm, bool reschedule
}
break;
}
case KAAlarm::COMMAND:
// execCommandAlarm() will error if the user is not authorised
// to run shell commands.
result = execCommandAlarm(event, alarm);
if (reschedule)
rescheduleAlarm(event, alarm, true);
break;
case KAAlarm::EMAIL:
{
kDebug() << "EMAIL to:" << event.emailAddresses(",");
......
......@@ -189,7 +189,7 @@ MessageWin::MessageWin(const KAEvent* event, const KAAlarm& alarm, int flags)
mFadeSeconds(qMin(event->fadeSeconds(), 86400)),
mDefaultDeferMinutes(event->deferDefaultMinutes()),
mAlarmType(alarm.type()),
mAction(event->action()),
mAction(event->actionSubType()),
#ifdef KMAIL_SUPPORTED
mKMailSerialNumber(event->kmailSerialNumber()),
#else
......@@ -312,7 +312,7 @@ MessageWin::MessageWin(const KAEvent* event, const DateTime& alarmDateTime,
#endif
mEventID(event->id()),
mAlarmType(KAAlarm::MAIN_ALARM),
mAction(event->action()),
mAction(event->actionSubType()),
mKMailSerialNumber(0),
mCommandError(KAEvent::CMD_NO_ERROR),
mErrorMsgs(errmsgs),
......
/*
* templatelistfiltermodel.cpp - proxy model class for lists of alarm templates
* Program: kalarm
* Copyright © 2007,2009,2010 by David Jarvie <djarvie@kde.org>
* Copyright © 2007,2009-2011 by David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -55,16 +55,9 @@ bool TemplateListFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex&
return false;
if (mTypeFilter == KAEvent::ACT_ALL)
return true;
int type;
switch (static_cast<EventListModel*>(sourceModel())->event(sourceIndex)->action())
{
case KAEvent::MESSAGE:
case KAEvent::FILE: type = KAEvent::ACT_DISPLAY; break;
case KAEvent::COMMAND: type = KAEvent::ACT_COMMAND; break;
case KAEvent::EMAIL: type = KAEvent::ACT_EMAIL; break;
case KAEvent::AUDIO: type = KAEvent::ACT_AUDIO; break;
default: type = KAEvent::ACT_ALL; break;
}
KAEvent::Actions type = static_cast<EventListModel*>(sourceModel())->event(sourceIndex)->actionTypes();
if (type == KAEvent::ACT_DISPLAY_COMMAND)
type = KAEvent::ACT_DISPLAY;
return type & mTypeFilter;
}
......@@ -115,16 +108,9 @@ Qt::ItemFlags TemplateListFilterModel::flags(const QModelIndex& index) const
Qt::ItemFlags f = sourceModel()->flags(sourceIndex);
if (mTypesEnabled == KAEvent::ACT_ALL)
return f;
int type;
switch (static_cast<EventListModel*>(sourceModel())->event(sourceIndex)->action())
{
case KAEvent::MESSAGE:
case KAEvent::FILE: type = KAEvent::ACT_DISPLAY; break;
case KAEvent::COMMAND: type = KAEvent::ACT_COMMAND; break;
case KAEvent::EMAIL: type = KAEvent::ACT_EMAIL; break;