3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Abdelrazak Younes
8 * Full author contact details are available in file CREDITS.
15 // DispatchResult.h is needed by the windows compiler because lyx::dispatch
16 // returns a DispatchResult const reference. Gcc does not complain. Weird...
17 #include "DispatchResult.h"
18 #include "FuncRequest.h"
19 #include "FuncStatus.h"
22 #include "qt_helpers.h"
24 #include "support/debug.h"
25 #include "support/lstrings.h"
34 Action::Action(FuncRequest func, QIcon const & icon, QString const & text,
35 QString const & tooltip, QObject * parent)
36 : QAction(parent), func_(make_shared<FuncRequest>(move(func)))
38 init(icon, text, tooltip);
42 Action::Action(shared_ptr<FuncRequest const> func,
43 QIcon const & icon, QString const & text,
44 QString const & tooltip, QObject * parent)
45 : QAction(parent), func_(func)
47 init(icon, text, tooltip);
51 void Action::init(QIcon const & icon, QString const & text,
52 QString const & tooltip)
54 // only Qt/Mac handles that
59 setStatusTip(tooltip);
60 connect(this, SIGNAL(triggered()), this, SLOT(action()));
67 FuncStatus const status = getStatus(*func_);
69 if (status.onOff(true)) {
72 } else if (status.onOff(false)) {
79 setEnabled(status.enabled());
85 //LYXERR(Debug::ACTION, "calling lyx::dispatch: func_: ");
87 lyx::dispatch(*func_);
91 } // namespace frontend
94 #include "moc_Action.cpp"