20#include <KNotification>
28void NotifyAction::setText(
const QString& text)
39QString NotifyAction::text()
const
45,m_defaultAction(nullptr)
54void Notify::appendAction(NotifyAction* action)
56 m_actions.append(action);
59int Notify::actionsCount()
const
61 return m_actions.count();
64NotifyAction * Notify::action(
int index)
const
66 return m_actions.at(index);
69void Notify::clearActions()
74void Notify::replaceAction(
int index, NotifyAction* action)
76 m_actions[index] = action;
79void Notify::removeLastAction()
81 m_actions.removeLast();
86 reinterpret_cast< Notify*
>(
list->
data)->appendAction(action);
91 return reinterpret_cast< Notify*
>(
list->
data)->actionsCount();
96 return reinterpret_cast< Notify*
>(
list->
data)->action(index);
101 reinterpret_cast< Notify*
>(
list->
data)->clearActions();
106 reinterpret_cast< Notify*
>(
list->
data)->replaceAction(index, action);
111 reinterpret_cast< Notify*
>(
list->
data)->removeLastAction();
123 auto notification =
new KNotification(m_eventId);
126 QStringList actionsLabels;
139 notification->setComponentName (m_componentName);
140 notification->setText (m_message);
141 notification->setTitle (m_title);
142 notification->setIconName (m_iconName);
143 notification->setPixmap (QPixmap(m_imageSource.toString()));
144 notification->setUrls (m_urls);
146 qDebug() << notification->eventId ();
157 notification->sendEvent();
160const QString &Notify::componentName()
const
162 return m_componentName;
165void Notify::setComponentName(
const QString &newComponentName)
167 if (m_componentName == newComponentName)
169 m_componentName = newComponentName;
170 Q_EMIT componentNameChanged(m_componentName);
173void Notify::actionActivated(
int index)
175 qDebug() <<
"notify action was activated at <<" << index;
181 if(index >= 1 && index-1 < m_actions.count ())
183 Q_EMIT m_actions.at (index-1)->triggered (
this);
187const QString &Notify::eventId()
const
192void Notify::setEventId(
const QString &newEventId)
194 m_eventId = newEventId;
197const QString &Notify::title()
const
202void Notify::setTitle(
const QString &newTitle)
204 if (m_title == newTitle)
207 Q_EMIT titleChanged(m_title);
210const QString &Notify::message()
const
215void Notify::setMessage(
const QString &newMessage)
217 if (m_message == newMessage)
219 m_message = newMessage;
220 Q_EMIT messageChanged(m_message);
223const QString &Notify::iconName()
const
228void Notify::setIconName(
const QString &newIconName)
230 if (m_iconName == newIconName)
232 m_iconName = newIconName;
233 Q_EMIT iconNameChanged(m_iconName);
236const QUrl &Notify::imageSource()
const
238 return m_imageSource;
241void Notify::setImageSource(
const QUrl &newImageSource)
243 if (m_imageSource == newImageSource)
245 m_imageSource = newImageSource;
246 Q_EMIT imageSourceChanged(m_imageSource);
249NotifyAction *Notify::defaultAction()
const
251 return m_defaultAction;
254void Notify::setDefaultAction(NotifyAction *newDefaultAction)
256 if (m_defaultAction == newDefaultAction)
258 m_defaultAction = newDefaultAction;
259 Q_EMIT defaulActionChanged();
269 if (m_urls == newUrls)
272 Q_EMIT urlsChanged(m_urls);
KIOCORE_EXPORT QStringList list(const QString &fileClass)