fix get Weather error
This commit is contained in:
parent
1c67632eed
commit
f4cfd9a8b3
94
0001-fix-get-Weather-error.patch
Normal file
94
0001-fix-get-Weather-error.patch
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
From 4208da6c0f07a645b2cfe3b53c5ce28412639af9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: peijiankang <peijiankang@kylinos.cn>
|
||||||
|
Date: Fri, 13 Jan 2023 15:14:11 +0800
|
||||||
|
Subject: [PATCH] fix get Weather error
|
||||||
|
|
||||||
|
---
|
||||||
|
src/gsettingmanager.cpp | 6 +++---
|
||||||
|
src/platforminfo.cpp | 21 +++++++++++++++++++++
|
||||||
|
src/platforminfo.h | 6 ++++--
|
||||||
|
3 files changed, 28 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/gsettingmanager.cpp b/src/gsettingmanager.cpp
|
||||||
|
index fad7961..5869fa2 100644
|
||||||
|
--- a/src/gsettingmanager.cpp
|
||||||
|
+++ b/src/gsettingmanager.cpp
|
||||||
|
@@ -677,7 +677,7 @@ Q_GLOBAL_STATIC(WeatherGsetting, weatherGsetting)
|
||||||
|
WeatherGsetting::WeatherGsetting()
|
||||||
|
{
|
||||||
|
//获取系统
|
||||||
|
- if (PLATFORM::Intel.compare(PLATFORM::g_platformType,Qt::CaseInsensitive) == 0) {
|
||||||
|
+ if (PLATFORM::Weathername.compare(PLATFORM::g_weathername,Qt::CaseInsensitive) == 0) {
|
||||||
|
const QByteArray id(WEATHER_GSETTING_OLD);
|
||||||
|
if (QGSettings::isSchemaInstalled(id)) {
|
||||||
|
m_pWeatherSetting = new QGSettings(id);
|
||||||
|
@@ -712,7 +712,7 @@ WeatherGsetting *WeatherGsetting::getInstance()
|
||||||
|
QString WeatherGsetting::getWeather()
|
||||||
|
{
|
||||||
|
//获取系统
|
||||||
|
- if (PLATFORM::Intel.compare(PLATFORM::g_platformType,Qt::CaseInsensitive) == 0) {
|
||||||
|
+ if (PLATFORM::Weathername.compare(PLATFORM::g_weathername,Qt::CaseInsensitive) == 0) {
|
||||||
|
const QByteArray id(WEATHER_GSETTING_OLD);
|
||||||
|
if (QGSettings::isSchemaInstalled(id) && m_pWeatherSetting != nullptr \
|
||||||
|
&& m_pWeatherSetting->keys().contains(WEATHER_GSETTING_KEY)) {
|
||||||
|
@@ -740,7 +740,7 @@ QString WeatherGsetting::getWeather()
|
||||||
|
QString WeatherGsetting::getIcon()
|
||||||
|
{
|
||||||
|
//获取系统
|
||||||
|
- if (PLATFORM::Intel.compare(PLATFORM::g_platformType,Qt::CaseInsensitive) == 0) {
|
||||||
|
+ if (PLATFORM::Weathername.compare(PLATFORM::g_weathername,Qt::CaseInsensitive) == 0) {
|
||||||
|
const QByteArray id(WEATHER_GSETTING_OLD);
|
||||||
|
if (QGSettings::isSchemaInstalled(id) && m_pWeatherSetting != nullptr \
|
||||||
|
&& m_pWeatherSetting->keys().contains(WEATHER_GSETTING_KEY)) {
|
||||||
|
diff --git a/src/platforminfo.cpp b/src/platforminfo.cpp
|
||||||
|
index 8a16c2b..58f0792 100644
|
||||||
|
--- a/src/platforminfo.cpp
|
||||||
|
+++ b/src/platforminfo.cpp
|
||||||
|
@@ -1,5 +1,26 @@
|
||||||
|
#include "platforminfo.h"
|
||||||
|
|
||||||
|
+QString getweathername() {
|
||||||
|
+ FILE *pp = NULL;
|
||||||
|
+ char *line = NULL;
|
||||||
|
+ size_t len = 0;
|
||||||
|
+ QString weathername = "none";
|
||||||
|
+
|
||||||
|
+ pp = popen("rpm -q indicator-china-weather", "r");
|
||||||
|
+ if(NULL == pp)
|
||||||
|
+ return weathername;
|
||||||
|
+
|
||||||
|
+ if(getline(&line, &len, pp) != -1){
|
||||||
|
+ weathername = "indicator-china-weather";
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ free(line);
|
||||||
|
+ line = NULL;
|
||||||
|
+ pclose(pp);
|
||||||
|
+ return weathername;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
namespace PLATFORM {
|
||||||
|
QString g_platformType = KDKGetPrjCodeName().c_str();
|
||||||
|
+ QString g_weathername = getweathername();
|
||||||
|
}
|
||||||
|
diff --git a/src/platforminfo.h b/src/platforminfo.h
|
||||||
|
index 1e331d9..17e6ca2 100644
|
||||||
|
--- a/src/platforminfo.h
|
||||||
|
+++ b/src/platforminfo.h
|
||||||
|
@@ -6,9 +6,11 @@
|
||||||
|
#include <ukuisdk/kylin-com4cxx.h>
|
||||||
|
|
||||||
|
namespace PLATFORM {
|
||||||
|
- const QString V101 = "V10SP1";
|
||||||
|
- const QString Intel = "V10SP1-edu";
|
||||||
|
+ const QString V101 = "V10SP1";
|
||||||
|
+ const QString Intel = "V10SP1-edu";
|
||||||
|
+ const QString Weathername = "indicator-china-weather";
|
||||||
|
extern QString g_platformType ;
|
||||||
|
+ extern QString g_weathername ;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // PLATFORMINFO_H
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -1,11 +1,12 @@
|
|||||||
%define debug_package %{nil}
|
%define debug_package %{nil}
|
||||||
Name: ukui-sidebar
|
Name: ukui-sidebar
|
||||||
Version: 3.3.0
|
Version: 3.3.0
|
||||||
Release: 1
|
Release: 2
|
||||||
Summary: parallels toolbox for UKUI
|
Summary: parallels toolbox for UKUI
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
URL: http://www.ukui.org
|
URL: http://www.ukui.org
|
||||||
Source0: %{name}-%{version}.tar.gz
|
Source0: %{name}-%{version}.tar.gz
|
||||||
|
Patch01: 0001-fix-get-Weather-error.patch
|
||||||
|
|
||||||
BuildRequires: glib2-devel
|
BuildRequires: glib2-devel
|
||||||
BuildRequires: qt5-qtbase-devel
|
BuildRequires: qt5-qtbase-devel
|
||||||
@ -29,6 +30,7 @@ Recommends: ukui-notebook ukylin-feedback-client ukui-clock
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
%patch01 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
@ -72,6 +74,9 @@ done
|
|||||||
%{_datadir}/glib-2.0/schemas/
|
%{_datadir}/glib-2.0/schemas/
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Jan 12 2023 peijiankang <peijiankang@kylinos.cn> - 3.3.0-2
|
||||||
|
- fix get Weather error
|
||||||
|
|
||||||
* Mon Oct 31 2022 peijiankang <peijiankang@kylinos.cn> - 3.3.0-1
|
* Mon Oct 31 2022 peijiankang <peijiankang@kylinos.cn> - 3.3.0-1
|
||||||
- update version to 3.3.0
|
- update version to 3.3.0
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user