Changeset View
Changeset View
Standalone View
Standalone View
src/kmoretools/kmoretools.cpp
Show First 20 Lines • Show All 546 Lines • ▼ Show 20 Line(s) | 541 | { | |||
---|---|---|---|---|---|
547 | KMoreToolsConfigDialog *dlg = new KMoreToolsConfigDialog(defaultStructureDto, currentStructureDto, title); | 547 | KMoreToolsConfigDialog *dlg = new KMoreToolsConfigDialog(defaultStructureDto, currentStructureDto, title); | ||
548 | if (dlg->exec() == QDialog::Accepted) { | 548 | if (dlg->exec() == QDialog::Accepted) { | ||
549 | currentStructureDto = dlg->currentStructure(); | 549 | currentStructureDto = dlg->currentStructure(); | ||
550 | writeUserConfig(currentStructureDto); | 550 | writeUserConfig(currentStructureDto); | ||
551 | } | 551 | } | ||
552 | 552 | | |||
553 | delete dlg; | 553 | delete dlg; | ||
554 | } | 554 | } | ||
555 | | ||||
556 | /** | ||||
557 | * Create the 'More' menu with parent as parent | ||||
558 | * @param parent The parent of the menu | ||||
559 | */ | ||||
560 | void createMoreMenu(const KmtMenuStructure &mstruct, QMenu *parent) | ||||
561 | { | ||||
562 | Q_FOREACH (auto item, mstruct.moreItems) { | ||||
563 | const auto action = item->action(); | ||||
564 | action->setParent(parent); | ||||
565 | parent->addAction(action); | ||||
566 | } | ||||
567 | | ||||
568 | if (!mstruct.notInstalledServices.isEmpty()) { | ||||
569 | //qDebug() << "notInstalledItems not empty => build 'Not installed' section"; | ||||
dhaumann: Ah, and please comment out this qDebug() statement again - it was commented out before as well… | |||||
570 | parent->addSection(i18nc("@action:inmenu", "Not installed:")); | ||||
571 | | ||||
572 | Q_FOREACH (auto registeredService, mstruct.notInstalledServices) { | ||||
573 | | ||||
574 | QMenu* submenuForNotInstalled = KmtNotInstalledUtil::createSubmenuForNotInstalledApp( | ||||
575 | registeredService->formatString(QStringLiteral("$Name")), parent, registeredService->icon(), registeredService->homepageUrl(), registeredService->appstreamId()); | ||||
576 | parent->addMenu(submenuForNotInstalled); | ||||
577 | } | ||||
578 | } | ||||
579 | } | ||||
555 | }; | 580 | }; | ||
556 | 581 | | |||
557 | KMoreToolsMenuBuilder::KMoreToolsMenuBuilder() | 582 | KMoreToolsMenuBuilder::KMoreToolsMenuBuilder() | ||
558 | { | 583 | { | ||
559 | Q_ASSERT(false); | 584 | Q_ASSERT(false); | ||
560 | } | 585 | } | ||
561 | 586 | | |||
562 | KMoreToolsMenuBuilder::KMoreToolsMenuBuilder(const QString& uniqueId, const QString& userConfigPostfix) | 587 | KMoreToolsMenuBuilder::KMoreToolsMenuBuilder(const QString& uniqueId, const QString& userConfigPostfix) | ||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Line(s) | 662 | Q_FOREACH (auto item, mstruct.mainItems) { | |||
641 | } | 666 | } | ||
642 | menu->addAction(action); | 667 | menu->addAction(action); | ||
643 | } | 668 | } | ||
644 | 669 | | |||
645 | QMenu* moreMenu = new QMenu(i18nc("@action:inmenu", "More"), menu); | 670 | QMenu* moreMenu = new QMenu(i18nc("@action:inmenu", "More"), menu); | ||
646 | 671 | | |||
647 | if (!mstruct.moreItems.isEmpty() || !mstruct.notInstalledServices.isEmpty()) { | 672 | if (!mstruct.moreItems.isEmpty() || !mstruct.notInstalledServices.isEmpty()) { | ||
648 | 673 | | |||
674 | if (mstruct.mainItems.isEmpty()) { | ||||
675 | d->createMoreMenu(mstruct, menu); | ||||
dhaumann: This line then changes to d->createMoreMenu(...); | |||||
676 | } else { | ||||
649 | menu->addSeparator(); | 677 | menu->addSeparator(); | ||
650 | menu->addMenu(moreMenu); | 678 | menu->addMenu(moreMenu); | ||
651 | 679 | d->createMoreMenu(mstruct, moreMenu); | |||
652 | Q_FOREACH (auto item, mstruct.moreItems) { | | |||
653 | const auto action = item->action(); | | |||
654 | action->setParent(menu); | | |||
655 | moreMenu->addAction(action); | | |||
656 | } | | |||
657 | | ||||
658 | if (!mstruct.notInstalledServices.isEmpty()) { | | |||
659 | //qDebug() << "notInstalledItems not empty => build 'Not installed' section"; | | |||
660 | moreMenu->addSection(i18nc("@action:inmenu", "Not installed:")); | | |||
661 | | ||||
662 | Q_FOREACH (auto registeredService, mstruct.notInstalledServices) { | | |||
663 | | ||||
664 | QMenu* submenuForNotInstalled = KmtNotInstalledUtil::createSubmenuForNotInstalledApp( | | |||
665 | registeredService->formatString(QStringLiteral("$Name")), menu, registeredService->icon(), registeredService->homepageUrl(), registeredService->appstreamId()); | | |||
666 | moreMenu->addMenu(submenuForNotInstalled); | | |||
667 | } | | |||
668 | } | 680 | } | ||
669 | } | 681 | } | ||
670 | 682 | | |||
671 | if (moreMenu->isEmpty()) { | 683 | if (moreMenu->isEmpty()) { | ||
672 | if (outMoreMenu) { | 684 | if (outMoreMenu) { | ||
673 | *outMoreMenu = nullptr; | 685 | *outMoreMenu = nullptr; | ||
674 | } | 686 | } | ||
675 | } else { | 687 | } else { | ||
▲ Show 20 Lines • Show All 131 Lines • Show Last 20 Lines |
Ah, and please comment out this qDebug() statement again - it was commented out before as well :-)