Changeset View
Changeset View
Standalone View
Standalone View
Modules/about-distro/src/Module.cpp
Show First 20 Lines • Show All 144 Lines • ▼ Show 20 Line(s) | 144 | { | |||
---|---|---|---|---|---|
145 | // NOTE: do not include globals, otherwise kdeglobals could provide values | 145 | // NOTE: do not include globals, otherwise kdeglobals could provide values | ||
146 | // even though we only explicitly want them from our own config. | 146 | // even though we only explicitly want them from our own config. | ||
147 | KSharedConfig::Ptr config = KSharedConfig::openConfig(QStringLiteral("kcm-about-distrorc"), | 147 | KSharedConfig::Ptr config = KSharedConfig::openConfig(QStringLiteral("kcm-about-distrorc"), | ||
148 | KConfig::NoGlobals); | 148 | KConfig::NoGlobals); | ||
149 | KConfigGroup cg = KConfigGroup(config, "General"); | 149 | KConfigGroup cg = KConfigGroup(config, "General"); | ||
150 | 150 | | |||
151 | OSRelease os; | 151 | OSRelease os; | ||
152 | 152 | | |||
153 | QString logoPath = cg.readEntry("LogoPath", os.logo); | 153 | QString logoPath = cg.readEntry("LogoPath", os.logo()); | ||
154 | if (logoPath.isEmpty()) { | 154 | if (logoPath.isEmpty()) { | ||
155 | logoPath = QStringLiteral("start-here-kde"); | 155 | logoPath = QStringLiteral("start-here-kde"); | ||
156 | } | 156 | } | ||
157 | const QPixmap logo = QIcon::fromTheme(logoPath).pixmap(128, 128); | 157 | const QPixmap logo = QIcon::fromTheme(logoPath).pixmap(128, 128); | ||
158 | ui->logoLabel->setPixmap(logo); | 158 | ui->logoLabel->setPixmap(logo); | ||
159 | 159 | | |||
160 | // We allow overriding of the OS name for branding purposes. | 160 | // We allow overriding of the OS name for branding purposes. | ||
161 | // For example OS Ubuntu may be rebranded as Kubuntu. Also Kubuntu Active | 161 | // For example OS Ubuntu may be rebranded as Kubuntu. Also Kubuntu Active | ||
162 | // as a product brand is different from Kubuntu. | 162 | // as a product brand is different from Kubuntu. | ||
163 | const QString distroName = cg.readEntry("Name", os.name); | 163 | const QString distroName = cg.readEntry("Name", os.name()); | ||
164 | const QString osrVersion = cg.readEntry("UseOSReleaseVersion", false) | 164 | const QString osrVersion = cg.readEntry("UseOSReleaseVersion", false) | ||
165 | ? os.version | 165 | ? os.version() | ||
166 | : os.versionId; | 166 | : os.versionId(); | ||
167 | const QString versionId = cg.readEntry("Version", osrVersion); | 167 | const QString versionId = cg.readEntry("Version", osrVersion); | ||
168 | const QString distroNameVersion = QStringLiteral("%1 %2").arg(distroName, versionId); | 168 | const QString distroNameVersion = QStringLiteral("%1 %2").arg(distroName, versionId); | ||
169 | ui->nameVersionLabel->setText(distroNameVersion); | 169 | ui->nameVersionLabel->setText(distroNameVersion); | ||
170 | 170 | | |||
171 | const auto dummyDistroDescriptionLabel = new QLabel(i18nc("@title:row", "Operating System:"), this); | 171 | const auto dummyDistroDescriptionLabel = new QLabel(i18nc("@title:row", "Operating System:"), this); | ||
172 | dummyDistroDescriptionLabel->hide(); | 172 | dummyDistroDescriptionLabel->hide(); | ||
173 | labelsForClipboard << qMakePair(dummyDistroDescriptionLabel, ui->nameVersionLabel); | 173 | labelsForClipboard << qMakePair(dummyDistroDescriptionLabel, ui->nameVersionLabel); | ||
174 | englishTextForClipboard += QStringLiteral("Operating System: %1\n").arg(distroNameVersion); | 174 | englishTextForClipboard += QStringLiteral("Operating System: %1\n").arg(distroNameVersion); | ||
175 | 175 | | |||
176 | const QString variant = cg.readEntry("Variant", os.variant); | 176 | const QString variant = cg.readEntry("Variant", os.variant()); | ||
177 | if (variant.isEmpty()) { | 177 | if (variant.isEmpty()) { | ||
178 | ui->variantLabel->hide(); | 178 | ui->variantLabel->hide(); | ||
179 | } else { | 179 | } else { | ||
180 | ui->variantLabel->setText(variant); | 180 | ui->variantLabel->setText(variant); | ||
181 | } | 181 | } | ||
182 | 182 | | |||
183 | const QString url = cg.readEntry("Website", os.homeUrl); | 183 | const QString url = cg.readEntry("Website", os.homeUrl()); | ||
184 | if (url.isEmpty()) { | 184 | if (url.isEmpty()) { | ||
185 | ui->urlLabel->hide(); | 185 | ui->urlLabel->hide(); | ||
186 | } else { | 186 | } else { | ||
187 | ui->urlLabel->setText(QStringLiteral("<a href='%1'>%1</a>").arg(url)); | 187 | ui->urlLabel->setText(QStringLiteral("<a href='%1'>%1</a>").arg(url)); | ||
188 | } | 188 | } | ||
189 | 189 | | |||
190 | // Since Plasma version detection isn't based on a library query it can fail | 190 | // Since Plasma version detection isn't based on a library query it can fail | ||
191 | // in weird cases; instead of admitting defeat we simply hide everything :P | 191 | // in weird cases; instead of admitting defeat we simply hide everything :P | ||
▲ Show 20 Lines • Show All 124 Lines • Show Last 20 Lines |