Skip to content
This repository was archived by the owner on Sep 27, 2024. It is now read-only.

Commit 4f78f24

Browse files
committed
Make it possible to influence the default product choice on the content loading screen.
1 parent 5c68d02 commit 4f78f24

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ if (CPPCHECK_EXECUTABLE)
332332
)
333333
endif()
334334

335+
set(SCAP_WORKBENCH_PREFERRED_DATASTREAM_BASENAME "ssg-<productname>-ds.xml" CACHE STRING "Name of the datastream that should be the first one on the selection list in the initial dialogue.")
336+
335337
# only CPack should follow
336338
set(CPACK_CMAKE_GENERATOR "Unix Makefiles")
337339
set(CPACK_SOURCE_GENERATOR "TBZ2")

include/Config.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#define SCAP_WORKBENCH_SCAP_CONTENT_DIRECTORY "@SCAP_WORKBENCH_SCAP_CONTENT_DIRECTORY@"
3636

3737
#cmakedefine SCAP_WORKBENCH_LOCAL_SCAN_ENABLED
38+
#define SCAP_WORKBENCH_PREFERRED_DATASTREAM_BASENAME "@SCAP_WORKBENCH_PREFERRED_DATASTREAM_BASENAME@"
3839
#define SCAP_WORKBENCH_LOCAL_OSCAP_PATH "oscap"
3940
#define SCAP_WORKBENCH_LOCAL_PKEXEC_OSCAP_PATH "@CMAKE_INSTALL_FULL_LIBEXECDIR@/scap-workbench-pkexec-oscap.sh"
4041
#define SCAP_WORKBENCH_LOCAL_RPM_EXTRACT_PATH "@CMAKE_INSTALL_FULL_LIBEXECDIR@/scap-workbench-rpm-extract.sh"

src/SSGIntegrationDialog.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,22 @@ void SSGIntegrationDialog::loadContent()
8989
accept();
9090
}
9191

92+
/*
93+
* Given the string list passed as the first argument,
94+
* either make sure that the passed value is the first item,
95+
* or don't do anything (if the value is not present in the string).
96+
*/
97+
static void put_value_as_first_item(QStringList& list, const QString& value)
98+
{
99+
const int value_index = list.indexOf(value);
100+
if (value_index == -1)
101+
{
102+
return;
103+
}
104+
list.removeAt(value_index);
105+
list.push_front(value);
106+
}
107+
92108
void SSGIntegrationDialog::scrapeSSGVariants()
93109
{
94110
const QDir& dir = getSSGDirectory();
@@ -97,6 +113,7 @@ void SSGIntegrationDialog::scrapeSSGVariants()
97113

98114
int lastFavoriteIndex = 0;
99115
variants.sort();
116+
put_value_as_first_item(variants, QString(SCAP_WORKBENCH_PREFERRED_DATASTREAM_BASENAME));
100117
for (QStringList::const_iterator it = variants.constBegin();
101118
it != variants.constEnd(); ++it)
102119
{

0 commit comments

Comments
 (0)