!43 修复任务栏中“显示任务视图按钮”取消勾选,任务视图还是存在的问题

From: @pei-jiankang 
Reviewed-by: @dou33 
Signed-off-by: @dou33
This commit is contained in:
openeuler-ci-bot 2022-03-28 08:52:04 +00:00 committed by Gitee
commit 58a9bc6d31
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 116 additions and 1 deletions

View File

@ -0,0 +1,110 @@
From fc05b2c7a20bdcd12fd64e84dbbc8911045e531e Mon Sep 17 00:00:00 2001
From: pei-jiankang <peijiankang@kylinos.cn>
Date: Mon, 28 Mar 2022 15:31:38 +0800
Subject: [PATCH] modify close ShowTaskview no replay
---
plugin-startbar/startbar.cpp | 40 +++++++++++++++++++++++++++++++-----
plugin-startbar/startbar.h | 1 +
2 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/plugin-startbar/startbar.cpp b/plugin-startbar/startbar.cpp
index 47e1ac8..62078d7 100644
--- a/plugin-startbar/startbar.cpp
+++ b/plugin-startbar/startbar.cpp
@@ -27,13 +27,16 @@
#include "../panel/customstyle.h"
#define THEME_QT_SCHEMA "org.ukui.style"
#define THEME_Style_Name "styleName"
+#define UKUI_PANEL_SETTINGS "org.ukui.panel.settings"
+#define SHOW_TASKVIEW "showtaskview"
UKUIStartbarPlugin::UKUIStartbarPlugin(const IUKUIPanelPluginStartupInfo &startupInfo):
QObject(),
IUKUIPanelPlugin(startupInfo),
mWidget(new UKUIStartBarWidget(this))
{
-
+
+ mWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
}
@@ -57,11 +60,18 @@ UKUIStartBarWidget::UKUIStartBarWidget( IUKUIPanelPlugin *plugin, QWidget* paren
{
translator();
mStartMenuButton=new StartMenuButton(plugin,this);
- mTaskViewButton=new TaskViewButton(plugin,this);
mLayout=new UKUi::GridLayout(this);
mLayout->addWidget(mStartMenuButton);
- mLayout->addWidget(mTaskViewButton);
+ const QByteArray id(UKUI_PANEL_SETTINGS);
+ if(QGSettings::isSchemaInstalled(id)) {
+ m_gsettings = new QGSettings(id);
+ }
+ connect(m_gsettings, &QGSettings::changed, this, [=] (const QString &key){
+ if(key==SHOW_TASKVIEW)
+ realign();
+ });
+ realign();
}
void UKUIStartBarWidget::translator(){
@@ -77,19 +87,39 @@ void UKUIStartBarWidget::translator(){
UKUIStartBarWidget::~UKUIStartBarWidget()
{
+ mStartMenuButton->deleteLater();
+ mTaskViewButton->deleteLater();
}
/*plugin-startmenu refresh function*/
void UKUIStartBarWidget::realign()
{
+ if(m_gsettings->get(SHOW_TASKVIEW).toBool()){
+ if (!this->findChild<TaskViewButton *>("TaskViewButton")) {
+ mTaskViewButton=new TaskViewButton(mPlugin,this);
+ mTaskViewButton->setObjectName("TaskViewButton");
+ mLayout->addWidget(mTaskViewButton);
+ }
+ } else {
+ if (this->findChild<TaskViewButton *>("TaskViewButton")) {
+ if (mTaskViewButton != nullptr) {
+ mLayout->removeWidget(mTaskViewButton);
+ mTaskViewButton->deleteLater();
+ }
+ } else {
+ mStartMenuButton->realign();
+ return;
+ }
+ }
+
if (mPlugin->panel()->isHorizontal()){
mLayout->setColumnCount(mLayout->count());
mLayout->setRowCount(0);
- this->setFixedSize(mPlugin->panel()->panelSize()*2.3,mPlugin->panel()->panelSize());
+ // this->setFixedSize(mPlugin->panel()->panelSize()*2.3,mPlugin->panel()->panelSize());
}else{
mLayout->setRowCount(mLayout->count());
mLayout->setColumnCount(0);
- this->setFixedSize(mPlugin->panel()->panelSize(),mPlugin->panel()->panelSize()*2.3);
+ // this->setFixedSize(mPlugin->panel()->panelSize(),mPlugin->panel()->panelSize()*2.3);
}
mStartMenuButton->realign();
mTaskViewButton->realign();
diff --git a/plugin-startbar/startbar.h b/plugin-startbar/startbar.h
index e4c4292..368ff9a 100644
--- a/plugin-startbar/startbar.h
+++ b/plugin-startbar/startbar.h
@@ -92,6 +92,7 @@ private:
TaskViewButton *mTaskViewButton;
UKUi::GridLayout *mLayout;
QTranslator *m_translator;
+ QGSettings *m_gsettings;
private:
void translator();
--
2.33.0

View File

@ -2,7 +2,7 @@
Name: ukui-panel
Version: 3.0.6
Release: 5
Release: 6
Summary: ukui desktop panel
License: LGPL-2.1+ GPL-2+ LGPL-3
URL: http://www.ukui.org
@ -11,6 +11,7 @@ Source1: ukui-panel_zh_CN.qm
Patch0: fix-panel-translation.patch
Patch1: 0001-modify-show-taskview-not-translation.patch
Patch2: 0002-tran-to-zh_cn.patch
Patch3: 0003-modify-close-ShowTaskview-no-replay.patch
BuildRequires: cmake
BuildRequires: alsa-lib-devel
@ -62,6 +63,7 @@ Provides: ukui-indicators
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
cp -rf %{SOURCE1} %{_builddir}/%{name}-%{version}/panel/resources
%build
@ -85,6 +87,9 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/*
%changelog
* Mon Mar 28 2022 pei-jiankang <peijiankang@kylinos.cn> - 3.0.6-6
- modify close ShowTaskview no replay
* Wed Mar 16 2022 pei-jiankang <peijiankang@kylinos.cn> - 3.0.6-5
- trans to zh_cn