Commit d01ff29492b805ed96c07371c4840def2b6e9c92
- Diff rendering mode:
- inline
- side by side
src/plugins/help/helpplugin.cpp
(29 / 22)
|   | |||
| 418 | 418 | cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl++"))); | |
| 419 | 419 | connect(a, SIGNAL(triggered()), m_centralWidget, SLOT(zoomIn())); | |
| 420 | 420 | advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT); | |
| 421 | |||
| 421 | |||
| 422 | 422 | a = new QAction(tr("Decrease Font Size"), this); | |
| 423 | 423 | cmd = am->registerAction(a, TextEditor::Constants::DECREASE_FONT_SIZE, | |
| 424 | 424 | modecontext); | |
| … | … | ||
| 572 | 572 | return; | |
| 573 | 573 | } | |
| 574 | 574 | ||
| 575 | bool needsSetup = false; | ||
| 576 | 575 | bool assistantInternalDocRegistered = false; | |
| 577 | 576 | QStringList documentationToRemove; | |
| 578 | 577 | QStringList filtersToRemove; | |
| … | … | ||
| 600 | 600 | QHelpEngineCore hc(m_helpEngine->collectionFile()); | |
| 601 | 601 | hc.setupData(); | |
| 602 | 602 | foreach (const QString &ns, documentationToRemove) { | |
| 603 | if (hc.unregisterDocumentation(ns)) | ||
| 604 | needsSetup = true; | ||
| 603 | hc.unregisterDocumentation(ns); | ||
| 605 | 604 | } | |
| 606 | 605 | foreach (const QString &filter, filtersToRemove) { | |
| 607 | if (hc.removeCustomFilter(filter)) | ||
| 608 | needsSetup = true; | ||
| 606 | hc.removeCustomFilter(filter); | ||
| 609 | 607 | } | |
| 610 | 608 | ||
| 611 | 609 | if (!assistantInternalDocRegistered) { | |
| … | … | ||
| 616 | 616 | #endif | |
| 617 | 617 | if (!hc.registerDocumentation(qchFileName)) | |
| 618 | 618 | qDebug() << qPrintable(hc.error()); | |
| 619 | needsSetup = true; | ||
| 620 | 619 | } | |
| 621 | 620 | ||
| 622 | 621 | } | |
| 623 | 622 | ||
| 624 | QLatin1String key("UnfilteredFilterInserted"); | ||
| 625 | int i = m_helpEngine->customValue(key).toInt(); | ||
| 626 | if (i != 1) { | ||
| 627 | { | ||
| 628 | QHelpEngineCore hc(m_helpEngine->collectionFile()); | ||
| 629 | hc.setupData(); | ||
| 630 | hc.addCustomFilter(tr("Unfiltered"), QStringList()); | ||
| 631 | hc.setCustomValue(key, 1); | ||
| 623 | const QLatin1String weAddedFilterKey("UnfilteredFilterInserted"); | ||
| 624 | const QLatin1String previousFilterNameKey("UnfilteredFilterName"); | ||
| 625 | int i = m_helpEngine->customValue(weAddedFilterKey).toInt(); | ||
| 626 | const QString filterName = tr("Unfiltered"); | ||
| 627 | if (i == 1) { // we added a filter at some point | ||
| 628 | // remove previously added filter | ||
| 629 | QHelpEngineCore hc(m_helpEngine->collectionFile()); | ||
| 630 | hc.setupData(); | ||
| 631 | QString previousFilterName = hc.customValue(previousFilterNameKey).toString(); | ||
| 632 | if (!previousFilterName.isEmpty()) { // we noted down the name of the previously added filter | ||
| 633 | hc.removeCustomFilter(previousFilterName); | ||
| 632 | 634 | } | |
| 633 | bool blocked = m_helpEngine->blockSignals(true); | ||
| 634 | m_helpEngine->setCurrentFilter(tr("Unfiltered")); | ||
| 635 | m_helpEngine->blockSignals(blocked); | ||
| 636 | needsSetup = true; | ||
| 635 | if (previousFilterName != filterName) { // potentially remove a filter with new name | ||
| 636 | hc.removeCustomFilter(filterName); | ||
| 637 | } | ||
| 637 | 638 | } | |
| 639 | { | ||
| 640 | QHelpEngineCore hc(m_helpEngine->collectionFile()); | ||
| 641 | hc.setupData(); | ||
| 642 | hc.addCustomFilter(filterName, QStringList()); | ||
| 643 | hc.setCustomValue(weAddedFilterKey, 1); | ||
| 644 | hc.setCustomValue(previousFilterNameKey, filterName); | ||
| 645 | } | ||
| 646 | bool blocked = m_helpEngine->blockSignals(true); | ||
| 647 | m_helpEngine->setCurrentFilter(filterName); | ||
| 648 | m_helpEngine->blockSignals(blocked); | ||
| 638 | 649 | ||
| 639 | if (needsSetup) | ||
| 640 | m_helpEngine->setupData(); | ||
| 650 | m_helpEngine->setupData(); | ||
| 641 | 651 | ||
| 642 | 652 | updateFilterComboBox(); | |
| 643 | 653 | m_bookmarkManager->setupBookmarkModels(); | |
| … | … | ||
| 659 | 659 | ||
| 660 | 660 | font = qVariantValue<QFont>(m_helpEngine->customValue(QLatin1String("font"), | |
| 661 | 661 | font)); | |
| 662 | |||
| 662 | |||
| 663 | 663 | webSettings->setFontFamily(QWebSettings::StandardFont, font.family()); | |
| 664 | 664 | webSettings->setFontSize(QWebSettings::DefaultFontSize, font.pointSize()); | |
| 665 | 665 | #endif |
Comments
Add a new comment:
Login or create an account to post a comment
Add your comment
Please log in to comment

