fix the tray interface of the powermanagement is not localized
This commit is contained in:
parent
5ab8cffabb
commit
2d0dec6862
|
@ -1,3 +1,14 @@
|
|||
ukui-power-manager (3.1.1.3-ok3~0719) yangtze; urgency=medium
|
||||
|
||||
* bug:128438-五分钟后关闭显示器不生效
|
||||
127768-盒盖设置关闭显示器不生效
|
||||
127705-托盘电源管理提示名未汉化
|
||||
* 需求号:无
|
||||
* 其他改动说明:无
|
||||
* 其他改动影响域:无
|
||||
|
||||
-- lizhuoan <lizhuoan@kylinos.cn> Tue, 19 Jul 2022 19:03:35 +0800
|
||||
|
||||
ukui-power-manager (3.1.1.3-ok2~0624) yangtze; urgency=medium
|
||||
|
||||
* Initial for openKylin.
|
||||
|
|
|
@ -55,7 +55,7 @@ PowerTray::PowerTray(QObject *parent) : QObject(parent)
|
|||
replyState.waitForFinished();
|
||||
if (replyState.isValid()) {
|
||||
qDebug() << "BatteryState is:" << replyState.value();
|
||||
if (0 == replyState.value()){
|
||||
if (0 == replyState.value()) {
|
||||
qDebug() << "ukui-power-manager-tray is about to quit";
|
||||
exit(0);
|
||||
}
|
||||
|
@ -69,11 +69,11 @@ void PowerTray::initPowerTray()
|
|||
trayIcon = new QSystemTrayIcon(this);
|
||||
EngineDevice *ed;
|
||||
ed = EngineDevice::getInstance();
|
||||
// m_isPowerWindowInit = false;
|
||||
// m_isPowerWindowInit = false;
|
||||
QDBusConnection::sessionBus().connect(
|
||||
QString(), "/", "org.ukui.upower", "BatteryIcon", this, SLOT(IconChanged(QString)));
|
||||
connect(ed, SIGNAL(engine_signal_summary_change(QString)), this, SLOT(onSumChanged(QString)));
|
||||
initUi();
|
||||
initUi(ed->engine_get_summary());
|
||||
connect(
|
||||
trayIcon,
|
||||
SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
|
||||
|
@ -116,28 +116,29 @@ void PowerTray::IconChanged(QString str)
|
|||
|
||||
void PowerTray::onActivatedIcon(QSystemTrayIcon::ActivationReason reason)
|
||||
{
|
||||
// if (!m_isPowerWindowInit) {
|
||||
// powerWindow = new powerwindow();
|
||||
// m_isPowerWindowInit = true;
|
||||
// } else {
|
||||
// qDebug() << "power window init is :" << m_isPowerWindowInit;
|
||||
// }
|
||||
// if (!m_isPowerWindowInit) {
|
||||
// powerWindow = new powerwindow();
|
||||
// m_isPowerWindowInit = true;
|
||||
// } else {
|
||||
// qDebug() << "power window init is :" << m_isPowerWindowInit;
|
||||
// }
|
||||
if (reason == 3) {
|
||||
if (powerWindow->isVisible()) {
|
||||
powerWindow->hide();
|
||||
return;
|
||||
}
|
||||
powerWindow->set_window_position();
|
||||
//powerWindow->showByWaylandHelper();
|
||||
// powerWindow->showByWaylandHelper();
|
||||
KWindowSystem::setState(powerWindow->winId(), NET::SkipTaskbar | NET::SkipPager);
|
||||
powerWindow->show();
|
||||
}
|
||||
}
|
||||
|
||||
void PowerTray::initUi()
|
||||
void PowerTray::initUi(QString tooltip)
|
||||
{
|
||||
menu = new QMenu();
|
||||
menu->setAttribute(Qt::WA_TranslucentBackground);
|
||||
trayIcon->setToolTip(tooltip);
|
||||
trayIcon->setContextMenu(menu);
|
||||
QAction *pset_preference = new QAction(menu);
|
||||
QIcon icon = QIcon::fromTheme("document-page-setup-symbolic");
|
||||
|
@ -170,8 +171,20 @@ void PowerTray::set_preference_func()
|
|||
|
||||
PowerTray::~PowerTray()
|
||||
{
|
||||
delete powerWindow;
|
||||
delete menu;
|
||||
delete trayIcon;
|
||||
delete iface;
|
||||
if (nullptr != powerWindow) {
|
||||
delete powerWindow;
|
||||
powerWindow = nullptr;
|
||||
}
|
||||
if (nullptr != menu) {
|
||||
delete menu;
|
||||
menu = nullptr;
|
||||
}
|
||||
if (nullptr != trayIcon) {
|
||||
delete trayIcon;
|
||||
trayIcon = nullptr;
|
||||
}
|
||||
if (nullptr != iface) {
|
||||
delete iface;
|
||||
iface = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
~PowerTray();
|
||||
void initPowerTray();
|
||||
QString getMachineType();
|
||||
void initUi();
|
||||
void initUi(QString tooltip);
|
||||
|
||||
private:
|
||||
powerwindow *powerWindow;
|
||||
|
|
Loading…
Reference in New Issue