@@ -701,8 +701,10 @@ void addRecentActivities(QMenu *menu, const int userId, const QVariantList &rece
701701
702702void populateAccountMenu (QMenu *menu, const int userId, const bool fetchActivityPreview = true )
703703{
704- setFixedMenuWidth (menu);
705- clearDynamicMenu (menu);
704+ if (!fetchActivityPreview) {
705+ setFixedMenuWidth (menu);
706+ clearDynamicMenu (menu);
707+ }
706708
707709 const auto userModel = UserModel::instance ();
708710 if (!userModel || userId < 0 || userId >= userModel->rowCount ()) {
@@ -716,6 +718,7 @@ void populateAccountMenu(QMenu *menu, const int userId, const bool fetchActivity
716718 };
717719 if (fetchActivityPreview && policy.fetchActivityPreview ()) {
718720 userModel->fetchActivityPreview (userId);
721+ return ;
719722 }
720723
721724 const auto menuIconPalette = nativeMenuIconPalette (menu);
@@ -807,9 +810,6 @@ void populateAccountMenu(QMenu *menu, const int userId, const bool fetchActivity
807810 QCoreApplication::translate (" TrayWindowHeader" , " Apps" ));
808811 setFixedMenuWidth (appsMenu);
809812 appsMenu->menuAction ()->setEnabled (populateAppsMenu (appsMenu, userId));
810- QObject::connect (appsMenu, &QMenu::aboutToShow, appsMenu, [appsMenu, userId] {
811- appsMenu->menuAction ()->setEnabled (populateAppsMenu (appsMenu, userId));
812- });
813813
814814 menu->addSeparator ();
815815
@@ -842,8 +842,9 @@ void populateTrayMenu(QMenu *menu, Systray *systray)
842842
843843 const auto accountMenu = addSubMenu (menu, accountIcon, accountText);
844844 setFixedMenuWidth (accountMenu);
845+ populateAccountMenu (accountMenu, userId, false );
845846 QObject::connect (accountMenu, &QMenu::aboutToShow, accountMenu, [accountMenu, userId] {
846- populateAccountMenu (accountMenu, userId);
847+ populateAccountMenu (accountMenu, userId, true );
847848 });
848849 QObject::connect (userModel,
849850 &QAbstractItemModel::dataChanged,
0 commit comments