@@ -2815,6 +2815,32 @@ void MainWindow::setDirty()
28152815 dirtyTest = true ;
28162816}
28172817
2818+ void MainWindow::rebuildPackageViews ()
2819+ {
2820+ setDirty ();
2821+ // Rebuild Enabled Repos (temporarily switch currentTree so dirty flag is cleared)
2822+ QTreeView *savedTree = currentTree;
2823+ if (currentTree != ui->treeEnabled ) {
2824+ currentTree = ui->treeEnabled ;
2825+ buildPackageLists ();
2826+ currentTree = savedTree;
2827+ // Also update original tree if it's an APT tab (data already loaded, just refresh display)
2828+ if (currentTree == ui->treeMXtest ) {
2829+ displayPackages ();
2830+ dirtyTest = false ;
2831+ } else if (currentTree == ui->treeBackports ) {
2832+ displayPackages ();
2833+ dirtyBackports = false ;
2834+ }
2835+ } else {
2836+ buildPackageLists ();
2837+ }
2838+ // Only refresh Popular if we're on that tab, otherwise it stays dirty for tab switch
2839+ if (currentTree == ui->treePopularApps ) {
2840+ refreshPopularApps ();
2841+ }
2842+ }
2843+
28182844void MainWindow::setIcons ()
28192845{
28202846
@@ -3304,9 +3330,7 @@ void MainWindow::pushInstall_clicked()
33043330 } else {
33053331 success = installSelected ();
33063332 }
3307- setDirty ();
3308- buildPackageLists ();
3309- refreshPopularApps ();
3333+ rebuildPackageViews ();
33103334 if (success) {
33113335 QMessageBox::information (this , tr (" Done" ), tr (" Processing finished successfully." ));
33123336 ui->tabWidget ->setCurrentWidget (currentTree->parentWidget ());
@@ -3462,9 +3486,7 @@ void MainWindow::pushUninstall_clicked()
34623486 }
34633487
34643488 bool success = uninstall (names, preuninstall, postuninstall);
3465- setDirty ();
3466- buildPackageLists ();
3467- refreshPopularApps ();
3489+ rebuildPackageViews ();
34683490 if (success) {
34693491 QMessageBox::information (this , tr (" Success" ), tr (" Processing finished successfully." ));
34703492 ui->tabWidget ->setCurrentWidget (currentTree->parentWidget ());
@@ -4243,8 +4265,7 @@ void MainWindow::pushUpgradeAll_clicked()
42434265 }
42444266 }
42454267 bool success = install (names.join (' ' ));
4246- setDirty ();
4247- buildPackageLists ();
4268+ rebuildPackageViews ();
42484269 if (success) {
42494270 QMessageBox::information (this , tr (" Done" ), tr (" Processing finished successfully." ));
42504271 ui->tabWidget ->setCurrentWidget (currentTree->parentWidget ());
@@ -4466,9 +4487,7 @@ void MainWindow::pushRemoveAutoremovable_clicked()
44664487 " carefully the list of packages to be removed." ));
44674488 showOutput ();
44684489 bool success = uninstall (names);
4469- setDirty ();
4470- buildPackageLists ();
4471- refreshPopularApps ();
4490+ rebuildPackageViews ();
44724491 if (success) {
44734492 QMessageBox::information (this , tr (" Success" ), tr (" Processing finished successfully." ));
44744493 ui->tabWidget ->setCurrentWidget (currentTree->parentWidget ());
0 commit comments