Skip to content

Commit

Permalink
Remove repo version for the packages that are not availabe in the repo
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianTM committed Aug 16, 2024
1 parent de2874d commit 87da572
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
14 changes: 5 additions & 9 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -816,8 +816,7 @@ void MainWindow::displayPackages()
newtree->setUpdatesEnabled(false);
newtree->clear();

auto items = createTreeItems(list);
addInstalledAppsToItems(items, list);
auto items = createTreeItemsList(list);

newtree->addTopLevelItems(items);
newtree->sortItems(TreeCol::Name, Qt::AscendingOrder);
Expand Down Expand Up @@ -884,7 +883,7 @@ QMap<QString, PackageInfo> *MainWindow::getCurrentList()
}
}

QList<QTreeWidgetItem *> MainWindow::createTreeItems(QMap<QString, PackageInfo> *list) const
QList<QTreeWidgetItem *> MainWindow::createTreeItemsList(QMap<QString, PackageInfo> *list) const
{
QList<QTreeWidgetItem *> items;
items.reserve(list->size() + installed_packages.size());
Expand All @@ -893,16 +892,13 @@ QList<QTreeWidgetItem *> MainWindow::createTreeItems(QMap<QString, PackageInfo>
items.append(createTreeItem(it.key(), it.value().version, it.value().description));
}

return items;
}

void MainWindow::addInstalledAppsToItems(QList<QTreeWidgetItem *> &items, QMap<QString, PackageInfo> *list) const
{
for (auto it = installed_packages.constBegin(); it != installed_packages.constEnd(); ++it) {
if (!list->contains(it.key())) {
items.append(createTreeItem(it.key(), it.value().version, it.value().description));
items.append(createTreeItem(it.key(), QString(), it.value().description));
}
}

return items;
}

void MainWindow::updateTreeItems(QTreeWidget *tree)
Expand Down
3 changes: 1 addition & 2 deletions mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ private slots:
[[nodiscard]] static QString getDebianVerName();
[[nodiscard]] static bool isFilteredName(const QString &name);
[[nodiscard]] static uchar getDebianVerNum();
[[nodiscard]] QList<QTreeWidgetItem *> createTreeItems(QMap<QString, PackageInfo> *list) const;
[[nodiscard]] QList<QTreeWidgetItem *> createTreeItemsList(QMap<QString, PackageInfo> *list) const;
[[nodiscard]] QMap<QString, PackageInfo> *getCurrentList();
[[nodiscard]] QTreeWidget *getCurrentTree();

Expand All @@ -265,7 +265,6 @@ private slots:
bool updateApt();
static QString convert(quint64 bytes);
static quint64 convert(const QString &size);
void addInstalledAppsToItems(QList<QTreeWidgetItem *> &items, QMap<QString, PackageInfo> *list) const;
void blockInterfaceFP(bool block);
void buildChangeList(QTreeWidgetItem *item);
void cancelDownload();
Expand Down

0 comments on commit 87da572

Please sign in to comment.