17 explicit Private(EventType eventType)
19 , m_targetPage(nullptr)
21 , m_sourcePage(nullptr)
22 , m_eventType(eventType)
24 , m_shiftModifier(false)
35 EventType m_eventType;
47 : d(new Private(UnknownEvent))
51Event::Event(EventType eventType)
52 : d(new Private(eventType))
56Event::EventType Event::eventType()
const
58 return d->m_eventType;
63 switch (d->m_eventType) {
65 return QStringLiteral(
"Calculate");
67 return QStringLiteral(
"Format");
69 return QStringLiteral(
"Keystroke");
71 return QStringLiteral(
"Focus");
73 return QStringLiteral(
"Validate");
75 return QStringLiteral(
"Open");
77 return QStringLiteral(
"WillClose");
79 return QStringLiteral(
"WillSave");
81 return QStringLiteral(
"WillPrint");
83 return QStringLiteral(
"DidSave");
85 return QStringLiteral(
"DidPrint");
87 return QStringLiteral(
"MouseUp");
89 return QStringLiteral(
"MouseDown");
91 return QStringLiteral(
"MouseEnter");
93 return QStringLiteral(
"MouseExit");
96 return QStringLiteral(
"Unknown");
102 switch (d->m_eventType) {
110 case FieldMouseEnter:
112 return QStringLiteral(
"Field");
119 return QStringLiteral(
"Doc");
122 return QStringLiteral(
"Unknown");
126QString Event::targetName()
const
128 if (!d->m_targetName.isNull()) {
129 return d->m_targetName;
132 return QStringLiteral(
"JavaScript for: ") +
type() +
name();
135void Event::setTargetName(
const QString &val)
137 d->m_targetName = val;
150Page *Event::sourcePage()
const
152 return d->m_sourcePage;
155void Event::setSourcePage(
Page *val)
157 d->m_sourcePage = val;
160void *Event::target()
const
165void Event::setTarget(
void *target)
167 d->m_target = target;
170Page *Event::targetPage()
const
172 return d->m_targetPage;
175void Event::setTargetPage(
Page *val)
177 d->m_targetPage = val;
185void Event::setValue(
const QVariant &val)
190bool Event::returnCode()
const
192 return d->m_returnCode;
195void Event::setReturnCode(
bool returnCode)
197 d->m_returnCode = returnCode;
200bool Event::shiftModifier()
const
202 return d->m_shiftModifier;
205void Event::setShiftModifier(
bool shiftModifier)
207 d->m_shiftModifier = shiftModifier;
210bool Event::willCommit()
const
212 return d->m_willCommit;
215void Event::setWillCommit(
bool willCommit)
217 d->m_willCommit = willCommit;
225void Event::setChange(
const QString &change)
227 d->m_change = change;
230int Event::selStart()
const
232 return d->m_selStart;
235void Event::setSelStart(
const int selStart)
237 d->m_selStart = selStart;
240int Event::selEnd()
const
245void Event::setSelEnd(
const int selEnd)
247 d->m_selEnd = selEnd;
253 std::shared_ptr<Event> ret(
new Event(Event::FieldCalculate));
254 ret->setSource(source);
255 ret->setSourcePage(sourcePage);
256 ret->setTarget(target);
257 ret->setTargetPage(targetPage);
258 ret->setTargetName(targetName);
260 ret->setValue(target->
value());
265std::shared_ptr<Event> Event::createFormatEvent(
FormField *target,
Page *targetPage,
const QString &targetName)
267 std::shared_ptr<Event> ret(
new Event(Event::FieldFormat));
268 ret->setTarget(target);
269 ret->setTargetPage(targetPage);
270 ret->setTargetName(targetName);
272 ret->setValue(target->
value());
277std::shared_ptr<Event> Event::createKeystrokeEvent(
FormField *target,
Page *targetPage)
279 std::shared_ptr<Event> ret(
new Event(Event::FieldKeystroke));
280 ret->setTarget(target);
281 ret->setTargetPage(targetPage);
283 ret->setReturnCode(
true);
284 ret->setValue(target->
value());
288std::shared_ptr<Event> Event::createFormFocusEvent(
FormField *target,
Page *targetPage,
const QString &targetName)
290 std::shared_ptr<Event> ret(
new Event(Event::FieldFocus));
291 ret->setTarget(target);
292 ret->setTargetPage(targetPage);
293 ret->setTargetName(targetName);
296 ret->setValue(target->
value());
300std::shared_ptr<Event> Event::createFormValidateEvent(
FormField *target,
Page *targetPage,
const QString &targetName)
302 std::shared_ptr<Event> ret(
new Event(Event::FieldValidate));
303 ret->setTarget(target);
304 ret->setTargetPage(targetPage);
305 ret->setTargetName(targetName);
308 ret->setValue(target->
value());
309 ret->setReturnCode(
true);
313std::shared_ptr<Event> Event::createFieldMouseEvent(
FormField *target,
Page *targetPage, Event::EventType fieldMouseEventType)
315 Q_ASSERT(fieldMouseEventType >= Okular::Event::FieldMouseDown && fieldMouseEventType <= Okular::Event::FieldMouseUp);
316 std::shared_ptr<Event> ret = std::make_shared<Event>(fieldMouseEventType);
317 ret->setTarget(target);
318 ret->setTargetPage(targetPage);
323std::shared_ptr<Event> Event::createDocEvent(Event::EventType type)
325 std::shared_ptr<Event> ret = std::make_shared<Event>(type);
Type type(const QSqlDatabase &db)
QString name(StandardAction id)
Qt::KeyboardModifiers keyboardModifiers()