Changeset View
Changeset View
Standalone View
Standalone View
plugins/textshape/TextTool.cpp
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Line(s) | |||||
70 | #include <KoChangeTrackerElement.h> | 70 | #include <KoChangeTrackerElement.h> | ||
71 | #include <KoInlineNote.h> | 71 | #include <KoInlineNote.h> | ||
72 | #include <KoBookmark.h> | 72 | #include <KoBookmark.h> | ||
73 | #include <KoBookmarkManager.h> | 73 | #include <KoBookmarkManager.h> | ||
74 | #include <KoListLevelProperties.h> | 74 | #include <KoListLevelProperties.h> | ||
75 | #include <KoTextLayoutRootArea.h> | 75 | #include <KoTextLayoutRootArea.h> | ||
76 | //#include <ResizeTableCommand.h> | 76 | //#include <ResizeTableCommand.h> | ||
77 | #include <KoIcon.h> | 77 | #include <KoIcon.h> | ||
78 | #include "kis_action_registry.h" | ||||
78 | 79 | | |||
79 | #include <QDebug> | 80 | #include <QDebug> | ||
80 | #include <kstandardshortcut.h> | 81 | #include <kstandardshortcut.h> | ||
81 | #include <kactionmenu.h> | 82 | #include <kactionmenu.h> | ||
82 | #include <kstandardaction.h> | 83 | #include <kstandardaction.h> | ||
83 | #include <ksharedconfig.h> | 84 | #include <ksharedconfig.h> | ||
84 | 85 | | |||
85 | #include <QDesktopServices> | 86 | #include <QDesktopServices> | ||
▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Line(s) | 166 | { | |||
208 | connect(&m_editTipTimer, SIGNAL(timeout()), this, SLOT(showEditTip())); | 209 | connect(&m_editTipTimer, SIGNAL(timeout()), this, SLOT(showEditTip())); | ||
209 | } | 210 | } | ||
210 | 211 | | |||
211 | void TextTool::createActions() | 212 | void TextTool::createActions() | ||
212 | { | 213 | { | ||
213 | bool useAdvancedText = !(canvas()->resourceManager()->intResource(KoCanvasResourceManager::ApplicationSpeciality) | 214 | bool useAdvancedText = !(canvas()->resourceManager()->intResource(KoCanvasResourceManager::ApplicationSpeciality) | ||
214 | & KoCanvasResourceManager::NoAdvancedText); | 215 | & KoCanvasResourceManager::NoAdvancedText); | ||
215 | 216 | | |||
216 | m_actionConfigureSection = new QAction(koIcon("configure"), i18n("Configure current section"), this); //FIXME: Find another icon for this. | 217 | KisActionRegistry *actionRegistry = KisActionRegistry::instance(); | ||
218 | | ||||
219 | // FIXME: find new icons for these | ||||
220 | m_actionConfigureSection = actionRegistry->makeQAction("configure_section", this); | ||||
217 | addAction("configure_section", m_actionConfigureSection); | 221 | addAction("configure_section", m_actionConfigureSection); | ||
218 | connect(m_actionConfigureSection, SIGNAL(triggered(bool)), this, SLOT(configureSection())); | 222 | connect(m_actionConfigureSection, SIGNAL(triggered(bool)), this, SLOT(configureSection())); | ||
219 | 223 | | |||
220 | m_actionInsertSection = new QAction(koIcon("insert-text"), i18n("Insert new section"), this); //FIXME: Find another icon for this. | 224 | m_actionInsertSection = actionRegistry->makeQAction("insert_section", this); | ||
221 | addAction("insert_section", m_actionInsertSection); | 225 | addAction("insert_section", m_actionInsertSection); | ||
222 | connect(m_actionInsertSection, SIGNAL(triggered(bool)), this, SLOT(insertNewSection())); | 226 | connect(m_actionInsertSection, SIGNAL(triggered(bool)), this, SLOT(insertNewSection())); | ||
223 | 227 | | |||
224 | m_actionSplitSections = new QAction(koIcon("split"), i18n("Insert paragraph between sections"), this); //FIXME: Find another icon for this. | 228 | m_actionSplitSections = actionRegistry->makeQAction("split_sections", this); | ||
225 | addAction("split_sections", m_actionSplitSections); | 229 | addAction("split_sections", m_actionSplitSections); | ||
226 | connect(m_actionSplitSections, SIGNAL(triggered(bool)), this, SLOT(splitSections())); | 230 | connect(m_actionSplitSections, SIGNAL(triggered(bool)), this, SLOT(splitSections())); | ||
227 | 231 | | |||
228 | m_actionPasteAsText = new QAction(koIcon("edit-paste"), i18n("Paste As Text"), this); | 232 | m_actionPasteAsText = actionRegistry->makeQAction("edit_paste_text", this); | ||
229 | m_actionPasteAsText->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_V); | | |||
230 | addAction("edit_paste_text", m_actionPasteAsText); | 233 | addAction("edit_paste_text", m_actionPasteAsText); | ||
231 | connect(m_actionPasteAsText, SIGNAL(triggered(bool)), this, SLOT(pasteAsText())); | 234 | connect(m_actionPasteAsText, SIGNAL(triggered(bool)), this, SLOT(pasteAsText())); | ||
232 | 235 | | |||
233 | m_actionFormatBold = new QAction(koIcon("format-text-bold"), i18n("Bold"), this); | 236 | m_actionFormatBold = actionRegistry->makeQAction("format_bold", this); | ||
234 | m_actionFormatBold->setShortcut(Qt::CTRL + Qt::Key_B); | | |||
235 | addAction("format_bold", m_actionFormatBold); | 237 | addAction("format_bold", m_actionFormatBold); | ||
236 | m_actionFormatBold->setCheckable(true); | 238 | m_actionFormatBold->setCheckable(true); | ||
237 | connect(m_actionFormatBold, SIGNAL(triggered(bool)), this, SLOT(bold(bool))); | 239 | connect(m_actionFormatBold, SIGNAL(triggered(bool)), this, SLOT(bold(bool))); | ||
238 | 240 | | |||
239 | m_actionFormatItalic = new QAction(koIcon("format-text-italic"), i18n("Italic"), this); | 241 | m_actionFormatItalic = actionRegistry->makeQAction("format_italic", this); | ||
240 | m_actionFormatItalic->setShortcut(Qt::CTRL + Qt::Key_I); | | |||
241 | m_actionFormatItalic->setCheckable(true); | 242 | m_actionFormatItalic->setCheckable(true); | ||
242 | addAction("format_italic", m_actionFormatItalic); | 243 | addAction("format_italic", m_actionFormatItalic); | ||
243 | connect(m_actionFormatItalic, SIGNAL(triggered(bool)), this, SLOT(italic(bool))); | 244 | connect(m_actionFormatItalic, SIGNAL(triggered(bool)), this, SLOT(italic(bool))); | ||
244 | 245 | | |||
245 | m_actionFormatUnderline = new QAction(koIcon("format-text-underline"), i18nc("Text formatting", "Underline"), this); | 246 | m_actionFormatUnderline = actionRegistry->makeQAction("format_underline", this); | ||
246 | m_actionFormatUnderline->setShortcut(Qt::CTRL + Qt::Key_U); | | |||
247 | m_actionFormatUnderline->setCheckable(true); | 247 | m_actionFormatUnderline->setCheckable(true); | ||
248 | addAction("format_underline", m_actionFormatUnderline); | 248 | addAction("format_underline", m_actionFormatUnderline); | ||
249 | connect(m_actionFormatUnderline, SIGNAL(triggered(bool)), this, SLOT(underline(bool))); | 249 | connect(m_actionFormatUnderline, SIGNAL(triggered(bool)), this, SLOT(underline(bool))); | ||
250 | 250 | | |||
251 | m_actionFormatStrikeOut = new QAction(koIcon("format-text-strikethrough"), i18n("Strikethrough"), this); | 251 | m_actionFormatStrikeOut = actionRegistry->makeQAction("format_strike", this); | ||
252 | m_actionFormatStrikeOut->setCheckable(true); | 252 | m_actionFormatStrikeOut->setCheckable(true); | ||
253 | addAction("format_strike", m_actionFormatStrikeOut); | 253 | addAction("format_strike", m_actionFormatStrikeOut); | ||
254 | connect(m_actionFormatStrikeOut, SIGNAL(triggered(bool)), this, SLOT(strikeOut(bool))); | 254 | connect(m_actionFormatStrikeOut, SIGNAL(triggered(bool)), this, SLOT(strikeOut(bool))); | ||
255 | 255 | | |||
256 | QActionGroup *alignmentGroup = new QActionGroup(this); | 256 | QActionGroup *alignmentGroup = new QActionGroup(this); | ||
257 | m_actionAlignLeft = new QAction(koIcon("format-justify-left"), i18n("Align Left"), this); | 257 | m_actionAlignLeft = actionRegistry->makeQAction("format_alignleft", this); | ||
258 | m_actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L); | | |||
259 | m_actionAlignLeft->setCheckable(true); | 258 | m_actionAlignLeft->setCheckable(true); | ||
260 | alignmentGroup->addAction(m_actionAlignLeft); | 259 | alignmentGroup->addAction(m_actionAlignLeft); | ||
261 | addAction("format_alignleft", m_actionAlignLeft); | 260 | addAction("format_alignleft", m_actionAlignLeft); | ||
262 | connect(m_actionAlignLeft, SIGNAL(triggered(bool)), this, SLOT(alignLeft())); | 261 | connect(m_actionAlignLeft, SIGNAL(triggered(bool)), this, SLOT(alignLeft())); | ||
263 | 262 | | |||
264 | m_actionAlignRight = new QAction(koIcon("format-justify-right"), i18n("Align Right"), this); | 263 | m_actionAlignRight = actionRegistry->makeQAction("format_alignright", this); | ||
265 | m_actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R); | | |||
266 | m_actionAlignRight->setCheckable(true); | 264 | m_actionAlignRight->setCheckable(true); | ||
267 | alignmentGroup->addAction(m_actionAlignRight); | 265 | alignmentGroup->addAction(m_actionAlignRight); | ||
268 | addAction("format_alignright", m_actionAlignRight); | 266 | addAction("format_alignright", m_actionAlignRight); | ||
269 | connect(m_actionAlignRight, SIGNAL(triggered(bool)), this, SLOT(alignRight())); | 267 | connect(m_actionAlignRight, SIGNAL(triggered(bool)), this, SLOT(alignRight())); | ||
270 | 268 | | |||
271 | m_actionAlignCenter = new QAction(koIcon("format-justify-center"), i18n("Align Center"), this); | 269 | m_actionAlignCenter = actionRegistry->makeQAction("format_aligncenter", this); | ||
272 | m_actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E); | | |||
273 | m_actionAlignCenter->setCheckable(true); | 270 | m_actionAlignCenter->setCheckable(true); | ||
274 | addAction("format_aligncenter", m_actionAlignCenter); | 271 | addAction("format_aligncenter", m_actionAlignCenter); | ||
275 | 272 | | |||
276 | alignmentGroup->addAction(m_actionAlignCenter); | 273 | alignmentGroup->addAction(m_actionAlignCenter); | ||
277 | connect(m_actionAlignCenter, SIGNAL(triggered(bool)), this, SLOT(alignCenter())); | 274 | connect(m_actionAlignCenter, SIGNAL(triggered(bool)), this, SLOT(alignCenter())); | ||
278 | 275 | | |||
279 | m_actionAlignBlock = new QAction(koIcon("format-justify-fill"), i18n("Align Block"), this); | 276 | m_actionAlignBlock = actionRegistry->makeQAction("format_alignblock", this); | ||
280 | m_actionAlignBlock->setShortcut(Qt::CTRL + Qt::Key_J); | | |||
281 | m_actionAlignBlock->setCheckable(true); | 277 | m_actionAlignBlock->setCheckable(true); | ||
282 | alignmentGroup->addAction(m_actionAlignBlock); | 278 | alignmentGroup->addAction(m_actionAlignBlock); | ||
283 | addAction("format_alignblock", m_actionAlignBlock); | 279 | addAction("format_alignblock", m_actionAlignBlock); | ||
284 | connect(m_actionAlignBlock, SIGNAL(triggered(bool)), this, SLOT(alignBlock())); | 280 | connect(m_actionAlignBlock, SIGNAL(triggered(bool)), this, SLOT(alignBlock())); | ||
285 | 281 | | |||
286 | m_actionChangeDirection = new QAction(koIcon("format-text-direction-rtl"), i18n("Change text direction"), this); | 282 | m_actionChangeDirection = actionRegistry->makeQAction("change_text_direction", this); | ||
287 | m_actionChangeDirection->setToolTip(i18n("Change writing direction")); | | |||
288 | m_actionChangeDirection->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_D); | | |||
289 | m_actionChangeDirection->setCheckable(true); | 283 | m_actionChangeDirection->setCheckable(true); | ||
290 | addAction("change_text_direction", m_actionChangeDirection); | 284 | addAction("change_text_direction", m_actionChangeDirection); | ||
291 | connect(m_actionChangeDirection, SIGNAL(triggered()), this, SLOT(textDirectionChanged())); | 285 | connect(m_actionChangeDirection, SIGNAL(triggered()), this, SLOT(textDirectionChanged())); | ||
292 | 286 | | |||
293 | 287 | | |||
294 | m_actionFormatSuper = new QAction(koIcon("format-text-superscript"), i18n("Superscript"), this); | 288 | m_actionFormatSuper = actionRegistry->makeQAction("format_super", this); | ||
295 | m_actionFormatSuper->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_P); | | |||
296 | m_actionFormatSuper->setCheckable(true); | 289 | m_actionFormatSuper->setCheckable(true); | ||
297 | addAction("format_super", m_actionFormatSuper); | 290 | addAction("format_super", m_actionFormatSuper); | ||
298 | connect(m_actionFormatSuper, SIGNAL(triggered(bool)), this, SLOT(superScript(bool))); | 291 | connect(m_actionFormatSuper, SIGNAL(triggered(bool)), this, SLOT(superScript(bool))); | ||
299 | 292 | | |||
300 | m_actionFormatSub = new QAction(koIcon("format-text-subscript"), i18n("Subscript"), this); | 293 | m_actionFormatSub = actionRegistry->makeQAction("format_sub", this); | ||
301 | m_actionFormatSub->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_B); | | |||
302 | m_actionFormatSub->setCheckable(true); | 294 | m_actionFormatSub->setCheckable(true); | ||
303 | addAction("format_sub", m_actionFormatSub); | 295 | addAction("format_sub", m_actionFormatSub); | ||
304 | connect(m_actionFormatSub, SIGNAL(triggered(bool)), this, SLOT(subScript(bool))); | 296 | connect(m_actionFormatSub, SIGNAL(triggered(bool)), this, SLOT(subScript(bool))); | ||
305 | 297 | | |||
306 | const char* const increaseIndentActionIconName = | 298 | | ||
307 | QApplication::isRightToLeft() ? koIconNameCStr("format-indent-less") : koIconNameCStr("format-indent-more"); | 299 | // TODO: check these rtl-things work properly | ||
308 | m_actionFormatIncreaseIndent = new QAction( | 300 | m_actionFormatIncreaseIndent = actionRegistry->makeQAction("format_increaseindent", this); | ||
309 | KisIconUtils::loadIcon(QLatin1String(increaseIndentActionIconName)), | | |||
310 | i18n("Increase Indent"), this); | | |||
311 | addAction("format_increaseindent", m_actionFormatIncreaseIndent); | 301 | addAction("format_increaseindent", m_actionFormatIncreaseIndent); | ||
312 | connect(m_actionFormatIncreaseIndent, SIGNAL(triggered()), this, SLOT(increaseIndent())); | 302 | connect(m_actionFormatIncreaseIndent, SIGNAL(triggered()), this, SLOT(increaseIndent())); | ||
313 | 303 | | |||
314 | const char* const decreaseIndentActionIconName = | 304 | m_actionFormatDecreaseIndent = actionRegistry->makeQAction("format_decreaseindent", this); | ||
315 | QApplication::isRightToLeft() ? koIconNameCStr("format-indent-more") : koIconNameCStr("format-indent-less"); | | |||
316 | m_actionFormatDecreaseIndent = new QAction(KisIconUtils::loadIcon(QLatin1String(decreaseIndentActionIconName)), | | |||
317 | i18n("Decrease Indent"), this); | | |||
318 | addAction("format_decreaseindent", m_actionFormatDecreaseIndent); | 305 | addAction("format_decreaseindent", m_actionFormatDecreaseIndent); | ||
319 | connect(m_actionFormatDecreaseIndent, SIGNAL(triggered()), this, SLOT(decreaseIndent())); | 306 | connect(m_actionFormatDecreaseIndent, SIGNAL(triggered()), this, SLOT(decreaseIndent())); | ||
320 | 307 | | |||
321 | QAction *action = new QAction(koIcon("format-list-unordered"), i18n("Bullet list"), this); | 308 | const char* const increaseIndentActionIconName = | ||
309 | QApplication::isRightToLeft() ? koIconNameCStr("format-indent-less") : koIconNameCStr("format-indent-more"); | ||||
310 | m_actionFormatIncreaseIndent->setIcon(koIcon(increaseIndentActionIconName)); | ||||
311 | | ||||
312 | const char* const decreaseIndentActionIconName = | ||||
313 | QApplication::isRightToLeft() ? koIconNameCStr("format_decreaseindent") : koIconNameCStr("format-indent-less"); | ||||
314 | m_actionFormatIncreaseIndent->setIcon(koIcon(increaseIndentActionIconName)); | ||||
315 | | ||||
316 | QAction *action = actionRegistry->makeQAction("format_bulletlist", this); | ||||
322 | addAction("format_bulletlist", action); | 317 | addAction("format_bulletlist", action); | ||
323 | 318 | | |||
324 | action = new QAction(koIcon("format-list-ordered"), i18n("Numbered list"), this); | 319 | action = actionRegistry->makeQAction("format_numberlist", this); | ||
325 | addAction("format_numberlist", action); | 320 | addAction("format_numberlist", action); | ||
326 | 321 | | |||
327 | action = new QAction(i18n("Increase Font Size"), this); | 322 | action = actionRegistry->makeQAction("fontsizeup", this); | ||
328 | action->setShortcut(Qt::CTRL + Qt::Key_Greater); | | |||
329 | addAction("fontsizeup", action); | 323 | addAction("fontsizeup", action); | ||
330 | connect(action, SIGNAL(triggered()), this, SLOT(increaseFontSize())); | 324 | connect(action, SIGNAL(triggered()), this, SLOT(increaseFontSize())); | ||
331 | 325 | | |||
332 | action = new QAction(i18n("Decrease Font Size"), this); | 326 | action = actionRegistry->makeQAction("fontsizedown", this); | ||
333 | action->setShortcut(Qt::CTRL + Qt::Key_Less); | | |||
334 | addAction("fontsizedown", action); | 327 | addAction("fontsizedown", action); | ||
335 | connect(action, SIGNAL(triggered()), this, SLOT(decreaseFontSize())); | 328 | connect(action, SIGNAL(triggered()), this, SLOT(decreaseFontSize())); | ||
336 | 329 | | |||
337 | m_actionFormatFontFamily = new KoFontFamilyAction(this); | 330 | m_actionFormatFontFamily = new KoFontFamilyAction(this); | ||
338 | m_actionFormatFontFamily->setText(i18n("Font Family")); | 331 | m_actionFormatFontFamily->setText(i18n("Font Family")); | ||
339 | addAction("format_fontfamily", m_actionFormatFontFamily); | 332 | addAction("format_fontfamily", m_actionFormatFontFamily); | ||
340 | connect(m_actionFormatFontFamily, SIGNAL(triggered(const QString &)), | 333 | connect(m_actionFormatFontFamily, SIGNAL(triggered(const QString &)), | ||
341 | this, SLOT(setFontFamily(const QString &))); | 334 | this, SLOT(setFontFamily(const QString &))); | ||
342 | 335 | | |||
343 | m_variableMenu = new KActionMenu(i18n("Variable"), this); | 336 | m_variableMenu = new KActionMenu(i18n("Variable"), this); | ||
344 | addAction("insert_variable", m_variableMenu); | 337 | addAction("insert_variable", m_variableMenu); | ||
345 | 338 | | |||
346 | // ------------------- Actions with a key binding and no GUI item | 339 | // ------------------- Actions with a key binding and no GUI item | ||
347 | action = new QAction(i18n("Insert Non-Breaking Space"), this); | 340 | action = actionRegistry->makeQAction("nonbreaking_space", this); | ||
348 | action->setShortcut(Qt::CTRL + Qt::Key_Space); | | |||
349 | addAction("nonbreaking_space", action); | 341 | addAction("nonbreaking_space", action); | ||
350 | connect(action, SIGNAL(triggered()), this, SLOT(nonbreakingSpace())); | 342 | connect(action, SIGNAL(triggered()), this, SLOT(nonbreakingSpace())); | ||
351 | 343 | | |||
352 | action = new QAction(i18n("Insert Non-Breaking Hyphen"), this); | 344 | action = actionRegistry->makeQAction("nonbreaking_hyphen", this); | ||
353 | action->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Minus); | | |||
354 | addAction("nonbreaking_hyphen", action); | 345 | addAction("nonbreaking_hyphen", action); | ||
355 | connect(action, SIGNAL(triggered()), this, SLOT(nonbreakingHyphen())); | 346 | connect(action, SIGNAL(triggered()), this, SLOT(nonbreakingHyphen())); | ||
356 | 347 | | |||
357 | action = new QAction(i18n("Insert Index"), this); | 348 | action = actionRegistry->makeQAction("insert_index", this); | ||
358 | action->setShortcut(Qt::CTRL + Qt::Key_T); | | |||
359 | addAction("insert_index", action); | 349 | addAction("insert_index", action); | ||
360 | connect(action, SIGNAL(triggered()), this, SLOT(insertIndexMarker())); | 350 | connect(action, SIGNAL(triggered()), this, SLOT(insertIndexMarker())); | ||
361 | 351 | | |||
362 | action = new QAction(i18n("Insert Soft Hyphen"), this); | 352 | action = actionRegistry->makeQAction("soft_hyphen", this); | ||
363 | //action->setShortcut(Qt::CTRL + Qt::Key_Minus); // TODO this one is also used for the kde-global zoom-out :( | 353 | // TODO: double check this one works, conflicts with "zoom out" | ||
364 | addAction("soft_hyphen", action); | 354 | addAction("soft_hyphen", action); | ||
365 | connect(action, SIGNAL(triggered()), this, SLOT(softHyphen())); | 355 | connect(action, SIGNAL(triggered()), this, SLOT(softHyphen())); | ||
366 | 356 | | |||
367 | if (useAdvancedText) { | 357 | if (useAdvancedText) { | ||
368 | action = new QAction(i18n("Line Break"), this); | 358 | action = actionRegistry->makeQAction("line_break", this); | ||
369 | action->setShortcut(Qt::SHIFT + Qt::Key_Return); | | |||
370 | addAction("line_break", action); | 359 | addAction("line_break", action); | ||
371 | connect(action, SIGNAL(triggered()), this, SLOT(lineBreak())); | 360 | connect(action, SIGNAL(triggered()), this, SLOT(lineBreak())); | ||
372 | 361 | | |||
373 | action = new QAction(koIcon("insert-pagebreak"), i18n("Page Break"), this); | 362 | action = actionRegistry->makeQAction("insert_framebreak", this); | ||
374 | action->setShortcut(Qt::CTRL + Qt::Key_Return); | | |||
375 | addAction("insert_framebreak", action); | 363 | addAction("insert_framebreak", action); | ||
376 | connect(action, SIGNAL(triggered()), this, SLOT(insertFrameBreak())); | 364 | connect(action, SIGNAL(triggered()), this, SLOT(insertFrameBreak())); | ||
377 | action->setToolTip(i18n("Insert a page break")); | | |||
378 | action->setWhatsThis(i18n("All text after this point will be moved into the next page.")); | | |||
379 | } | 365 | } | ||
380 | 366 | | |||
381 | action = new QAction(i18n("Font..."), this); | 367 | action = actionRegistry->makeQAction("format_font", this); | ||
382 | action->setShortcut(Qt::ALT + Qt::CTRL + Qt::Key_F); | | |||
383 | action->setToolTip(i18n("Change character size, font, boldface, italics etc.")); | | |||
384 | action->setWhatsThis(i18n("Change the attributes of the currently selected characters.")); | | |||
385 | addAction("format_font", action); | 368 | addAction("format_font", action); | ||
386 | connect(action, SIGNAL(triggered()), this, SLOT(selectFont())); | 369 | connect(action, SIGNAL(triggered()), this, SLOT(selectFont())); | ||
387 | 370 | | |||
371 | | ||||
388 | m_actionFormatFontSize = new FontSizeAction(i18n("Font Size"), this); | 372 | m_actionFormatFontSize = new FontSizeAction(i18n("Font Size"), this); | ||
389 | addAction("format_fontsize", m_actionFormatFontSize); | 373 | addAction("format_fontsize", m_actionFormatFontSize); | ||
390 | connect(m_actionFormatFontSize, SIGNAL(fontSizeChanged(qreal)), this, SLOT(setFontSize(qreal))); | 374 | connect(m_actionFormatFontSize, SIGNAL(fontSizeChanged(qreal)), this, SLOT(setFontSize(qreal))); | ||
391 | 375 | | |||
392 | m_actionFormatTextColor = new KoColorPopupAction(this); | 376 | m_actionFormatTextColor = new KoColorPopupAction(this); | ||
393 | m_actionFormatTextColor->setIcon(koIcon("format-text-color")); | | |||
394 | m_actionFormatTextColor->setToolTip(i18n("Text Color...")); | | |||
395 | m_actionFormatTextColor->setText(i18n("Text Color")); | | |||
396 | addAction("format_textcolor", m_actionFormatTextColor); | 377 | addAction("format_textcolor", m_actionFormatTextColor); | ||
397 | connect(m_actionFormatTextColor, SIGNAL(colorChanged(const KoColor &)), this, SLOT(setTextColor(const KoColor &))); | 378 | connect(m_actionFormatTextColor, SIGNAL(colorChanged(const KoColor &)), this, SLOT(setTextColor(const KoColor &))); | ||
398 | 379 | | |||
399 | m_actionFormatBackgroundColor = new KoColorPopupAction(this); | 380 | m_actionFormatBackgroundColor = new KoColorPopupAction(this); | ||
400 | m_actionFormatBackgroundColor->setIcon(koIcon("format-fill-color")); | | |||
401 | m_actionFormatBackgroundColor->setToolTip(i18n("Background Color...")); | | |||
402 | m_actionFormatBackgroundColor->setText(i18n("Background")); | | |||
403 | addAction("format_backgroundcolor", m_actionFormatBackgroundColor); | 381 | addAction("format_backgroundcolor", m_actionFormatBackgroundColor); | ||
404 | connect(m_actionFormatBackgroundColor, SIGNAL(colorChanged(const KoColor &)), this, SLOT(setBackgroundColor(const KoColor &))); | 382 | connect(m_actionFormatBackgroundColor, SIGNAL(colorChanged(const KoColor &)), this, SLOT(setBackgroundColor(const KoColor &))); | ||
405 | 383 | | |||
406 | m_growWidthAction = new QAction(koIcon("zoom-fit-best"), i18n("Grow To Fit Width"), this); | 384 | m_growWidthAction = actionRegistry->makeQAction("grow_to_fit_width", this); | ||
407 | m_growWidthAction->setCheckable(true); | | |||
408 | addAction("grow_to_fit_width", m_growWidthAction); | 385 | addAction("grow_to_fit_width", m_growWidthAction); | ||
409 | connect(m_growWidthAction, SIGNAL(triggered(bool)), this, SLOT(setGrowWidthToFit(bool))); | 386 | connect(m_growWidthAction, SIGNAL(triggered(bool)), this, SLOT(setGrowWidthToFit(bool))); | ||
410 | 387 | | |||
411 | m_growHeightAction = new QAction(koIcon("zoom-fit-best"), i18n("Grow To Fit Height"), this); | 388 | m_growHeightAction = actionRegistry->makeQAction("grow_to_fit_height", this); | ||
412 | m_growHeightAction->setCheckable(true); | | |||
413 | addAction("grow_to_fit_height", m_growHeightAction); | 389 | addAction("grow_to_fit_height", m_growHeightAction); | ||
414 | connect(m_growHeightAction, SIGNAL(triggered(bool)), this, SLOT(setGrowHeightToFit(bool))); | 390 | connect(m_growHeightAction, SIGNAL(triggered(bool)), this, SLOT(setGrowHeightToFit(bool))); | ||
415 | 391 | | |||
416 | m_shrinkToFitAction = new QAction(koIcon("zoom-fit-best"), i18n("Shrink To Fit"), this); | 392 | m_shrinkToFitAction = actionRegistry->makeQAction("shrink_to_fit", this); | ||
417 | m_shrinkToFitAction->setCheckable(true); | | |||
418 | addAction("shrink_to_fit", m_shrinkToFitAction); | 393 | addAction("shrink_to_fit", m_shrinkToFitAction); | ||
419 | connect(m_shrinkToFitAction, SIGNAL(triggered(bool)), this, SLOT(setShrinkToFit(bool))); | 394 | connect(m_shrinkToFitAction, SIGNAL(triggered(bool)), this, SLOT(setShrinkToFit(bool))); | ||
420 | 395 | | |||
421 | if (useAdvancedText) { | 396 | if (useAdvancedText) { | ||
422 | action = new QAction(koIcon("insert-table"), i18n("Insert Custom..."), this); | 397 | action = actionRegistry->makeQAction("insert_table", this); | ||
423 | action->setToolTip(i18n("Insert a table into the document.")); | | |||
424 | addAction("insert_table", action); | 398 | addAction("insert_table", action); | ||
425 | connect(action, SIGNAL(triggered()), this, SLOT(insertTable())); | 399 | connect(action, SIGNAL(triggered()), this, SLOT(insertTable())); | ||
426 | 400 | | |||
427 | action = new QAction(koIcon("edit-table-insert-row-above"), i18n("Row Above"), this); | 401 | action = actionRegistry->makeQAction("insert_tablerow_above", this); | ||
428 | action->setToolTip(i18n("Insert Row Above")); | | |||
429 | addAction("insert_tablerow_above", action); | 402 | addAction("insert_tablerow_above", action); | ||
430 | connect(action, SIGNAL(triggered(bool)), this, SLOT(insertTableRowAbove())); | 403 | connect(action, SIGNAL(triggered(bool)), this, SLOT(insertTableRowAbove())); | ||
431 | 404 | | |||
432 | action = new QAction(koIcon("edit-table-insert-row-below"), i18n("Row Below"), this); | 405 | action = actionRegistry->makeQAction("insert_tablerow_below", this); | ||
433 | action->setToolTip(i18n("Insert Row Below")); | | |||
434 | addAction("insert_tablerow_below", action); | 406 | addAction("insert_tablerow_below", action); | ||
435 | connect(action, SIGNAL(triggered(bool)), this, SLOT(insertTableRowBelow())); | 407 | connect(action, SIGNAL(triggered(bool)), this, SLOT(insertTableRowBelow())); | ||
436 | 408 | | |||
437 | action = new QAction(koIcon("edit-table-insert-column-left"), i18n("Column Left"), this); | 409 | action = actionRegistry->makeQAction("insert_tablecolumn_left", this); | ||
438 | action->setToolTip(i18n("Insert Column Left")); | | |||
439 | addAction("insert_tablecolumn_left", action); | 410 | addAction("insert_tablecolumn_left", action); | ||
440 | connect(action, SIGNAL(triggered(bool)), this, SLOT(insertTableColumnLeft())); | 411 | connect(action, SIGNAL(triggered(bool)), this, SLOT(insertTableColumnLeft())); | ||
441 | 412 | | |||
442 | action = new QAction(koIcon("edit-table-insert-column-right"), i18n("Column Right"), this); | 413 | action = actionRegistry->makeQAction("insert_tablecolumn_right", this); | ||
443 | action->setToolTip(i18n("Insert Column Right")); | | |||
444 | addAction("insert_tablecolumn_right", action); | 414 | addAction("insert_tablecolumn_right", action); | ||
445 | connect(action, SIGNAL(triggered(bool)), this, SLOT(insertTableColumnRight())); | 415 | connect(action, SIGNAL(triggered(bool)), this, SLOT(insertTableColumnRight())); | ||
446 | 416 | | |||
447 | action = new QAction(koIcon("edit-table-delete-column"), i18n("Column"), this); | 417 | action = actionRegistry->makeQAction("delete_tablecolumn", this); | ||
448 | action->setToolTip(i18n("Delete Column")); | | |||
449 | addAction("delete_tablecolumn", action); | 418 | addAction("delete_tablecolumn", action); | ||
450 | connect(action, SIGNAL(triggered(bool)), this, SLOT(deleteTableColumn())); | 419 | connect(action, SIGNAL(triggered(bool)), this, SLOT(deleteTableColumn())); | ||
451 | 420 | | |||
452 | action = new QAction(koIcon("edit-table-delete-row"), i18n("Row"), this); | 421 | action = actionRegistry->makeQAction("delete_tablerow", this); | ||
453 | action->setToolTip(i18n("Delete Row")); | | |||
454 | addAction("delete_tablerow", action); | 422 | addAction("delete_tablerow", action); | ||
455 | connect(action, SIGNAL(triggered(bool)), this, SLOT(deleteTableRow())); | 423 | connect(action, SIGNAL(triggered(bool)), this, SLOT(deleteTableRow())); | ||
456 | 424 | | |||
457 | action = new QAction(koIcon("edit-table-cell-merge"), i18n("Merge Cells"), this); | 425 | action = actionRegistry->makeQAction("merge_tablecells", this); | ||
458 | addAction("merge_tablecells", action); | 426 | addAction("merge_tablecells", action); | ||
459 | connect(action, SIGNAL(triggered(bool)), this, SLOT(mergeTableCells())); | 427 | connect(action, SIGNAL(triggered(bool)), this, SLOT(mergeTableCells())); | ||
460 | 428 | | |||
461 | action = new QAction(koIcon("edit-table-cell-split"), i18n("Split Cells"), this); | 429 | action = actionRegistry->makeQAction("split_tablecells", this); | ||
462 | addAction("split_tablecells", action); | 430 | addAction("split_tablecells", action); | ||
463 | connect(action, SIGNAL(triggered(bool)), this, SLOT(splitTableCells())); | 431 | connect(action, SIGNAL(triggered(bool)), this, SLOT(splitTableCells())); | ||
464 | 432 | | |||
465 | action = new QAction(koIcon("borderpainter"), "", this); | 433 | action = actionRegistry->makeQAction("activate_borderpainter", this); | ||
466 | action->setToolTip(i18n("Select a border style and paint that style onto a table")); | | |||
467 | addAction("activate_borderpainter", action); | 434 | addAction("activate_borderpainter", action); | ||
468 | } | 435 | } | ||
469 | 436 | | |||
470 | action = new QAction(i18n("Paragraph..."), this); | 437 | action = actionRegistry->makeQAction("format_paragraph", this); | ||
471 | action->setShortcut(Qt::ALT + Qt::CTRL + Qt::Key_P); | | |||
472 | action->setToolTip(i18n("Change paragraph margins, text flow, borders, bullets, numbering etc.")); | | |||
473 | action->setWhatsThis(i18n("<p>Change paragraph margins, text flow, borders, bullets, numbering etc.</p><p>Select text in multiple paragraphs to change the formatting of all selected paragraphs.</p><p>If no text is selected, the paragraph where the cursor is located will be changed.</p>")); | | |||
474 | addAction("format_paragraph", action); | 438 | addAction("format_paragraph", action); | ||
475 | connect(action, SIGNAL(triggered()), this, SLOT(formatParagraph())); | 439 | connect(action, SIGNAL(triggered()), this, SLOT(formatParagraph())); | ||
476 | 440 | | |||
477 | action = new QAction(i18n("Style Manager..."), this); | 441 | action = actionRegistry->makeQAction("format_stylist", this); | ||
478 | action->setShortcut(Qt::ALT + Qt::CTRL + Qt::Key_S); | | |||
479 | action->setToolTip(i18n("Change attributes of styles")); | | |||
480 | action->setWhatsThis(i18n("<p>Change font and paragraph attributes of styles.</p><p>Multiple styles can be changed using the dialog box.</p>")); | | |||
481 | addAction("format_stylist", action); | 442 | addAction("format_stylist", action); | ||
482 | connect(action, SIGNAL(triggered()), this, SLOT(showStyleManager())); | 443 | connect(action, SIGNAL(triggered()), this, SLOT(showStyleManager())); | ||
483 | 444 | | |||
484 | action = KStandardAction::selectAll(this, SLOT(selectAll()), this); | 445 | action = KStandardAction::selectAll(this, SLOT(selectAll()), this); | ||
485 | addAction("edit_select_all", action); | 446 | addAction("edit_select_all", action); | ||
486 | 447 | | |||
487 | action = new QAction(i18n("Special Character..."), this); | 448 | action = actionRegistry->makeQAction("insert_specialchar", this); | ||
488 | action->setIcon(koIcon("character-set")); | | |||
489 | action->setShortcut(Qt::ALT + Qt::SHIFT + Qt::Key_C); | | |||
490 | action->setToolTip(i18n("Insert one or more symbols or characters not found on the keyboard")); | | |||
491 | action->setWhatsThis(i18n("Insert one or more symbols or characters not found on the keyboard.")); | | |||
492 | addAction("insert_specialchar", action); | 449 | addAction("insert_specialchar", action); | ||
493 | connect(action, SIGNAL(triggered()), this, SLOT(insertSpecialCharacter())); | 450 | connect(action, SIGNAL(triggered()), this, SLOT(insertSpecialCharacter())); | ||
494 | 451 | | |||
495 | action = new QAction(i18n("Repaint"), this); | 452 | action = actionRegistry->makeQAction("repaint", this); | ||
496 | action->setIcon(koIcon("view-refresh")); | | |||
497 | addAction("repaint", action); | 453 | addAction("repaint", action); | ||
498 | connect(action, SIGNAL(triggered()), this, SLOT(relayoutContent())); | 454 | connect(action, SIGNAL(triggered()), this, SLOT(relayoutContent())); | ||
499 | 455 | | |||
500 | action = new QAction(i18n("Insert Comment"), this); | 456 | action = actionRegistry->makeQAction("insert_annotation", this); | ||
501 | action->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_C); | | |||
502 | addAction("insert_annotation", action); | 457 | addAction("insert_annotation", action); | ||
503 | connect(action, SIGNAL(triggered()), this, SLOT(insertAnnotation())); | 458 | connect(action, SIGNAL(triggered()), this, SLOT(insertAnnotation())); | ||
504 | 459 | | |||
505 | #ifndef NDEBUG | 460 | #ifndef NDEBUG | ||
506 | action = new QAction("Paragraph Debug", this); // do NOT add i18n! | 461 | action = actionRegistry->makeQAction("detailed_debug_paragraphs", this); | ||
507 | action->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::ALT + Qt::Key_P); | | |||
508 | addAction("detailed_debug_paragraphs", action); | 462 | addAction("detailed_debug_paragraphs", action); | ||
509 | connect(action, SIGNAL(triggered()), this, SLOT(debugTextDocument())); | 463 | connect(action, SIGNAL(triggered()), this, SLOT(debugTextDocument())); | ||
510 | action = new QAction("Styles Debug", this); // do NOT add i18n! | 464 | action = actionRegistry->makeQAction("detailed_debug_styles", this); | ||
511 | action->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::ALT + Qt::Key_S); | | |||
512 | addAction("detailed_debug_styles", action); | 465 | addAction("detailed_debug_styles", action); | ||
513 | connect(action, SIGNAL(triggered()), this, SLOT(debugTextStyles())); | 466 | connect(action, SIGNAL(triggered()), this, SLOT(debugTextStyles())); | ||
514 | #endif | 467 | #endif | ||
515 | } | 468 | } | ||
516 | 469 | | |||
517 | 470 | | |||
518 | #ifndef NDEBUG | 471 | #ifndef NDEBUG | ||
519 | #include "tests/MockShapes.h" | 472 | #include "tests/MockShapes.h" | ||
▲ Show 20 Lines • Show All 2581 Lines • Show Last 20 Lines |