Changeset View
Changeset View
Standalone View
Standalone View
plugins/textshape/ReferencesTool.cpp
Show All 35 Lines | |||||
36 | #include <KoCanvasBase.h> | 36 | #include <KoCanvasBase.h> | ||
37 | #include <KoTextEditor.h> | 37 | #include <KoTextEditor.h> | ||
38 | #include <KoParagraphStyle.h> | 38 | #include <KoParagraphStyle.h> | ||
39 | #include <KoTableOfContentsGeneratorInfo.h> | 39 | #include <KoTableOfContentsGeneratorInfo.h> | ||
40 | #include <KoBookmark.h> | 40 | #include <KoBookmark.h> | ||
41 | #include <KoInlineNote.h> | 41 | #include <KoInlineNote.h> | ||
42 | #include <KoTextDocumentLayout.h> | 42 | #include <KoTextDocumentLayout.h> | ||
43 | #include <KoIcon.h> | 43 | #include <KoIcon.h> | ||
44 | #include <QMessageBox> | 44 | #include "kis_action_registry.h" | ||
45 | 45 | | |||
46 | #include <QMessageBox> | ||||
46 | #include <QDebug> | 47 | #include <QDebug> | ||
47 | #include <QAction> | 48 | #include <QAction> | ||
48 | #include <QTextDocument> | 49 | #include <QTextDocument> | ||
49 | #include <QLineEdit> | 50 | #include <QLineEdit> | ||
50 | #include <QBoxLayout> | 51 | #include <QBoxLayout> | ||
51 | #include <QMenu> | 52 | #include <QMenu> | ||
52 | #include <QWidgetAction> | 53 | #include <QWidgetAction> | ||
53 | 54 | | |||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Line(s) | |||||
117 | } | 118 | } | ||
118 | 119 | | |||
119 | ReferencesTool::~ReferencesTool() | 120 | ReferencesTool::~ReferencesTool() | ||
120 | { | 121 | { | ||
121 | } | 122 | } | ||
122 | 123 | | |||
123 | void ReferencesTool::createActions() | 124 | void ReferencesTool::createActions() | ||
124 | { | 125 | { | ||
125 | QWidgetAction *wAction = 0; | 126 | KisActionRegistry * actionRegistry = KisActionRegistry::instance(); | ||
126 | 127 | | |||
127 | QAction *action = new QAction(i18n("Insert"), this); | 128 | QAction *action = actionRegistry->makeQAction("insert_tableofcontents", this); | ||
128 | addAction("insert_tableofcontents", action); | 129 | addAction("insert_tableofcontents", action); | ||
129 | action->setToolTip(i18n("Insert a Table of Contents into the document.")); | | |||
130 | 130 | | |||
131 | action = new QAction(i18n("Insert Custom..."), this); | 131 | action = actionRegistry->makeQAction("insert_configure_tableofcontents", this); | ||
132 | addAction("insert_configure_tableofcontents", action); | 132 | addAction("insert_configure_tableofcontents", action); | ||
133 | action->setToolTip(i18n("Insert a custom Table of Contents into the document.")); | | |||
134 | 133 | | |||
135 | action = new QAction(koIcon("configure"), i18n("Configure..."), this); | 134 | action = actionRegistry->makeQAction("format_tableofcontents", this); | ||
136 | addAction("format_tableofcontents", action); | 135 | addAction("format_tableofcontents", action); | ||
137 | action->setToolTip(i18n("Configure the Table of Contents")); | 136 | connect(action, SIGNAL(triggered().act), this, SLOT(formatTableOfContents())); | ||
138 | connect(action, SIGNAL(triggered()), this, SLOT(formatTableOfContents())); | | |||
139 | 137 | | |||
140 | action = new QAction(i18n("Insert footnote with auto number"),this); | 138 | action = actionRegistry->makeQAction("insert_autofootnote", this); | ||
141 | addAction("insert_autofootnote",action); | 139 | addAction("insert_autofootnote",action); | ||
142 | connect(action, SIGNAL(triggered()), this, SLOT(insertAutoFootNote())); | 140 | connect(action, SIGNAL(triggered()), this, SLOT(insertAutoFootNote())); | ||
143 | 141 | | |||
144 | wAction = new QWidgetAction(this); | 142 | QWidgetAction * wAction = new QWidgetAction(this); | ||
145 | wAction->setText(i18n("Insert Labeled Footnote")); | 143 | wAction->setText(i18n("Insert Labeled Footnote")); | ||
146 | QWidget *w = new LabeledWidget(wAction, i18n("Insert with label:"), LabeledWidget::INLINE, false); | 144 | QWidget *w = new LabeledWidget(wAction, i18n("Insert with label:"), LabeledWidget::INLINE, false); | ||
147 | wAction->setDefaultWidget(w); | 145 | wAction->setDefaultWidget(w); | ||
148 | addAction("insert_labeledfootnote", wAction); | 146 | addAction("insert_labeledfootnote", wAction); | ||
149 | connect(w, SIGNAL(triggered(QString)), this, SLOT(insertLabeledFootNote(QString))); | 147 | connect(w, SIGNAL(triggered(QString)), this, SLOT(insertLabeledFootNote(QString))); | ||
150 | 148 | | |||
151 | action = new QAction(i18n("Insert endnote with auto number"),this); | 149 | action = actionRegistry->makeQAction("insert_autoendnote", this); | ||
152 | addAction("insert_autoendnote",action); | 150 | addAction("insert_autoendnote",action); | ||
153 | connect(action, SIGNAL(triggered()), this, SLOT(insertAutoEndNote())); | 151 | connect(action, SIGNAL(triggered()), this, SLOT(insertAutoEndNote())); | ||
154 | 152 | | |||
155 | wAction = new QWidgetAction(this); | 153 | wAction = new QWidgetAction(this); | ||
156 | wAction->setText(i18n("Insert Labeled Endnote")); | 154 | wAction->setText(i18n("Insert Labeled Endnote")); | ||
157 | w = new LabeledWidget(wAction, i18n("Insert with label:"), LabeledWidget::INLINE, false); | 155 | w = new LabeledWidget(wAction, i18n("Insert with label:"), LabeledWidget::INLINE, false); | ||
158 | wAction->setDefaultWidget(w); | 156 | wAction->setDefaultWidget(w); | ||
159 | addAction("insert_labeledendnote", wAction); connect(w, SIGNAL(triggered(QString)), this, SLOT(insertLabeledEndNote(QString))); | 157 | addAction("insert_labeledendnote", wAction); connect(w, SIGNAL(triggered(QString)), this, SLOT(insertLabeledEndNote(QString))); | ||
160 | 158 | | |||
161 | action = new QAction(koIcon("configure"), i18n("Settings..."), this); | 159 | action = actionRegistry->makeQAction("format_footnotes", this); | ||
162 | addAction("format_footnotes",action); | 160 | addAction("format_footnotes",action); | ||
163 | connect(action, SIGNAL(triggered()), this, SLOT(showFootnotesConfigureDialog())); | 161 | connect(action, SIGNAL(triggered()), this, SLOT(showFootnotesConfigureDialog())); | ||
164 | 162 | | |||
165 | action = new QAction(koIcon("configure"), i18n("Settings..."), this); | 163 | action = actionRegistry->makeQAction("format_endnotes", this); | ||
166 | addAction("format_endnotes",action); | 164 | addAction("format_endnotes",action); | ||
167 | connect(action, SIGNAL(triggered()), this, SLOT(showEndnotesConfigureDialog())); | 165 | connect(action, SIGNAL(triggered()), this, SLOT(showEndnotesConfigureDialog())); | ||
168 | 166 | | |||
169 | action = new QAction(i18n("Insert Citation"), this); | 167 | action = actionRegistry->makeQAction("insert_citation", this); | ||
170 | addAction("insert_citation",action); | 168 | addAction("insert_citation",action); | ||
171 | action->setToolTip(i18n("Insert a citation into the document.")); | | |||
172 | connect(action, SIGNAL(triggered()), this, SLOT(insertCitation())); | 169 | connect(action, SIGNAL(triggered()), this, SLOT(insertCitation())); | ||
173 | 170 | | |||
174 | action = new QAction(i18n("Insert Bibliography"), this); | 171 | action = actionRegistry->makeQAction("insert_bibliography", this); | ||
175 | addAction("insert_bibliography",action); | 172 | addAction("insert_bibliography",action); | ||
176 | action->setToolTip(i18n("Insert a bibliography into the document.")); | | |||
177 | 173 | | |||
178 | action = new QAction(i18n("Insert Custom Bibliography"), this); | 174 | action = actionRegistry->makeQAction("insert_custom_bibliography", this); | ||
179 | addAction("insert_custom_bibliography", action); | 175 | addAction("insert_custom_bibliography", action); | ||
180 | action->setToolTip(i18n("Insert a custom Bibliography into the document.")); | | |||
181 | 176 | | |||
182 | action = new QAction(i18n("Configure"),this); | 177 | action = actionRegistry->makeQAction("configure_bibliography", this); | ||
183 | addAction("configure_bibliography",action); | 178 | addAction("configure_bibliography",action); | ||
184 | action->setToolTip(i18n("Configure the bibliography")); | | |||
185 | connect(action, SIGNAL(triggered()), this, SLOT(configureBibliography())); | 179 | connect(action, SIGNAL(triggered()), this, SLOT(configureBibliography())); | ||
186 | 180 | | |||
187 | action = new QAction(i18n("Insert Link"), this); | 181 | action = actionRegistry->makeQAction("insert_link", this); | ||
188 | addAction("insert_link", action); | 182 | addAction("insert_link", action); | ||
189 | action->setToolTip(i18n("Insert a weblink or link to a bookmark.")); | | |||
190 | connect(action, SIGNAL(triggered()), this, SLOT(insertLink())); | 183 | connect(action, SIGNAL(triggered()), this, SLOT(insertLink())); | ||
191 | 184 | | |||
192 | wAction = new QWidgetAction(this); | 185 | wAction = new QWidgetAction(this); | ||
193 | wAction->setText(i18n("Add Bookmark")); | 186 | wAction->setText(i18n("Add Bookmark")); | ||
194 | m_bmark = new LabeledWidget(wAction, i18n("Add Bookmark :"), LabeledWidget::ABOVE, true); | 187 | m_bmark = new LabeledWidget(wAction, i18n("Add Bookmark :"), LabeledWidget::ABOVE, true); | ||
195 | connect(m_bmark, SIGNAL(lineEditChanged(QString)), this, SLOT(validateBookmark(QString))); | 188 | connect(m_bmark, SIGNAL(lineEditChanged(QString)), this, SLOT(validateBookmark(QString))); | ||
196 | wAction->setDefaultWidget(m_bmark); | 189 | wAction->setDefaultWidget(m_bmark); | ||
197 | addAction("insert_bookmark", wAction); | 190 | addAction("insert_bookmark", wAction); | ||
198 | connect(m_bmark, SIGNAL(triggered(QString)), this, SLOT(insertBookmark(QString))); | 191 | connect(m_bmark, SIGNAL(triggered(QString)), this, SLOT(insertBookmark(QString))); | ||
199 | wAction->setToolTip(i18n("Insert a Bookmark. This is useful to create links that point to areas within the document")); | 192 | wAction->setToolTip(i18n("Insert a Bookmark. This is useful to create links that point to areas within the document")); | ||
200 | 193 | | |||
201 | action = new QAction(i18n("Bookmarks"), this); | 194 | action = actionRegistry->makeQAction("invoke_bookmark_handler", this); | ||
202 | addAction("invoke_bookmark_handler", action); | 195 | addAction("invoke_bookmark_handler", action); | ||
203 | action->setToolTip(i18n("Display a pop up that hosts the options to add new Bookmark or handle existing Bookmarks")); | | |||
204 | 196 | | |||
205 | action = new QAction(i18n("Manage Bookmarks"), this); | 197 | action = actionRegistry->makeQAction("manage_bookmarks", this); | ||
206 | addAction("manage_bookmarks", action); | 198 | addAction("manage_bookmarks", action); | ||
207 | action->setToolTip(i18n("Manage your Bookmarks. Check where are they pointing to, Delete or Rename.")); | | |||
208 | } | 199 | } | ||
209 | 200 | | |||
210 | 201 | | |||
211 | void ReferencesTool::activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) | 202 | void ReferencesTool::activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) | ||
212 | { | 203 | { | ||
213 | TextTool::activate(toolActivation, shapes); | 204 | TextTool::activate(toolActivation, shapes); | ||
214 | } | 205 | } | ||
215 | 206 | | |||
▲ Show 20 Lines • Show All 189 Lines • Show Last 20 Lines |