From 1792e6329b8da3461f330fb46f7a0ebca06f40ca Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Sun, 19 Jan 2014 23:10:42 +0100 Subject: [PATCH] Change sort order so that OPKs are listed after normal links --- src/menu.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/menu.cpp b/src/menu.cpp index 5beec72..be05372 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -812,6 +812,15 @@ void Menu::readLinksOfSection(std::string path, std::vector &linkfi static bool compare_links(Link *a, Link *b) { + LinkApp *app1 = dynamic_cast(a); + LinkApp *app2 = dynamic_cast(b); + bool app1_is_opk = app1 && app1->isOpk(), + app2_is_opk = app2 && app2->isOpk(); + + if (app1_is_opk && !app2_is_opk) + return false; + if (app2_is_opk && !app1_is_opk) + return true; return a->getTitle().compare(b->getTitle()) <= 0; }