|
|
|
@ -1,22 +1,20 @@
|
|
|
|
|
|
|
|
|
|
#include "notification-ukcc-plugin.h"
|
|
|
|
|
#include "noticemenu.h"
|
|
|
|
|
#include "notice-menu.h"
|
|
|
|
|
#include <QFileDialog>
|
|
|
|
|
#include <QTimer>
|
|
|
|
|
#include <QFileSystemWatcher>
|
|
|
|
|
#include <QSettings>
|
|
|
|
|
#include <QToolButton>
|
|
|
|
|
#include <QFile>
|
|
|
|
|
#include <QThread>
|
|
|
|
|
#include <QApplication>
|
|
|
|
|
#include <QTranslator>
|
|
|
|
|
|
|
|
|
|
#define THEME_QT_SCHEMA "org.ukui.style"
|
|
|
|
|
|
|
|
|
|
class ukToolButton : public QToolButton
|
|
|
|
|
class ToolButton : public QToolButton
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ukToolButton(QWidget *parent = nullptr):
|
|
|
|
|
explicit ToolButton(QWidget *parent = nullptr):
|
|
|
|
|
QToolButton(parent)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
@ -164,9 +162,9 @@ void Notice::initUi(QWidget *widget)
|
|
|
|
|
m_noticeAppFrame->setMaximumSize(QSize(16777215, 16777215));
|
|
|
|
|
m_noticeAppFrame->setFrameShape(QFrame::Box);
|
|
|
|
|
|
|
|
|
|
m_applistverticalLayout = new QVBoxLayout(m_noticeAppFrame);
|
|
|
|
|
m_applistverticalLayout->setContentsMargins(0,0,0,0);
|
|
|
|
|
m_applistverticalLayout->setSpacing(0);
|
|
|
|
|
m_appListVerticalLayout = new QVBoxLayout(m_noticeAppFrame);
|
|
|
|
|
m_appListVerticalLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
m_appListVerticalLayout->setSpacing(0);
|
|
|
|
|
|
|
|
|
|
NoticeLayout->addWidget(m_noticeLabel);
|
|
|
|
|
NoticeLayout->addWidget(m_getNoticeFrame);
|
|
|
|
@ -206,26 +204,26 @@ void Notice::initNotFaze(QFrame *frame)
|
|
|
|
|
QHBoxLayout *autoLyt = new QHBoxLayout(autoOpenFrame);
|
|
|
|
|
autoLyt->setContentsMargins(16, 0, 16, 0);
|
|
|
|
|
QLabel *autoOpenLabel = new QLabel(tr("Automatically turn on"), autoOpenFrame);
|
|
|
|
|
m_openTimeHCombox = new QComboBox(autoOpenFrame);
|
|
|
|
|
m_openTimeHCombox->setObjectName("opentimehour");
|
|
|
|
|
m_openTimeHCombox->setFixedWidth(64);
|
|
|
|
|
m_openTimeMCombox = new QComboBox(autoOpenFrame);
|
|
|
|
|
m_openTimeMCombox->setObjectName("opentimeminute");
|
|
|
|
|
m_openTimeMCombox->setFixedWidth(64);
|
|
|
|
|
m_closeTimeHCombox = new QComboBox(autoOpenFrame);
|
|
|
|
|
m_closeTimeHCombox->setObjectName("closetimehour");
|
|
|
|
|
m_closeTimeHCombox->setFixedWidth(64);
|
|
|
|
|
m_closeTimeMCombox = new QComboBox(autoOpenFrame);
|
|
|
|
|
m_closeTimeMCombox->setObjectName("closetimeminute");
|
|
|
|
|
m_closeTimeMCombox->setFixedWidth(64);
|
|
|
|
|
m_openTimeHComboBox = new QComboBox(autoOpenFrame);
|
|
|
|
|
m_openTimeHComboBox->setObjectName("opentimehour");
|
|
|
|
|
m_openTimeHComboBox->setFixedWidth(64);
|
|
|
|
|
m_openTimeMComboBox = new QComboBox(autoOpenFrame);
|
|
|
|
|
m_openTimeMComboBox->setObjectName("opentimeminute");
|
|
|
|
|
m_openTimeMComboBox->setFixedWidth(64);
|
|
|
|
|
m_closeTimeHComboBox = new QComboBox(autoOpenFrame);
|
|
|
|
|
m_closeTimeHComboBox->setObjectName("closetimehour");
|
|
|
|
|
m_closeTimeHComboBox->setFixedWidth(64);
|
|
|
|
|
m_closeTimeMComboBox = new QComboBox(autoOpenFrame);
|
|
|
|
|
m_closeTimeMComboBox->setObjectName("closetimeminute");
|
|
|
|
|
m_closeTimeMComboBox->setFixedWidth(64);
|
|
|
|
|
for (int i = 0; i < 24; i++) {
|
|
|
|
|
m_openTimeHCombox->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')));
|
|
|
|
|
m_closeTimeHCombox->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')));
|
|
|
|
|
m_openTimeHComboBox->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')));
|
|
|
|
|
m_closeTimeHComboBox->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 60; i++) {
|
|
|
|
|
m_openTimeMCombox->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')));
|
|
|
|
|
m_closeTimeMCombox->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')));
|
|
|
|
|
m_openTimeMComboBox->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')));
|
|
|
|
|
m_closeTimeMComboBox->addItem(QStringLiteral("%1").arg(i, 2, 10, QLatin1Char('0')));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QLabel * label_1 = new QLabel(autoOpenFrame);
|
|
|
|
@ -242,13 +240,13 @@ void Notice::initNotFaze(QFrame *frame)
|
|
|
|
|
|
|
|
|
|
autoLyt->addWidget(autoOpenLabel);
|
|
|
|
|
autoLyt->addStretch();
|
|
|
|
|
autoLyt->addWidget(m_openTimeHCombox);
|
|
|
|
|
autoLyt->addWidget(m_openTimeHComboBox);
|
|
|
|
|
autoLyt->addWidget(label_2);
|
|
|
|
|
autoLyt->addWidget(m_openTimeMCombox);
|
|
|
|
|
autoLyt->addWidget(m_openTimeMComboBox);
|
|
|
|
|
autoLyt->addWidget(label_1);
|
|
|
|
|
autoLyt->addWidget(m_closeTimeHCombox);
|
|
|
|
|
autoLyt->addWidget(m_closeTimeHComboBox);
|
|
|
|
|
autoLyt->addWidget(label_3);
|
|
|
|
|
autoLyt->addWidget(m_closeTimeMCombox);
|
|
|
|
|
autoLyt->addWidget(m_closeTimeMComboBox);
|
|
|
|
|
autoLyt->addSpacing(24);
|
|
|
|
|
autoLyt->addWidget(m_autoOpenSwitchBtn);
|
|
|
|
|
|
|
|
|
@ -263,9 +261,9 @@ void Notice::initNotFaze(QFrame *frame)
|
|
|
|
|
setFrame(fullScreenFrame, m_fullScreenSwitchBtn, tr("Automatically open in full screen mode"));
|
|
|
|
|
|
|
|
|
|
QFrame *allowAlarmrRemindersFrame = new QFrame(frame);
|
|
|
|
|
m_allowAlarmrSwitchBtn= new KSwitchButton();
|
|
|
|
|
m_allowAlarmrSwitchBtn->setObjectName("allowAlarmr");
|
|
|
|
|
setFrame(allowAlarmrRemindersFrame, m_allowAlarmrSwitchBtn, tr("Allow automatic alarm reminders in Do Not Disturb mode"));
|
|
|
|
|
m_allowAlarmSwitchBtn= new KSwitchButton();
|
|
|
|
|
m_allowAlarmSwitchBtn->setObjectName("allowAlarmr");
|
|
|
|
|
setFrame(allowAlarmrRemindersFrame, m_allowAlarmSwitchBtn, tr("Allow automatic alarm reminders in Do Not Disturb mode"));
|
|
|
|
|
|
|
|
|
|
notFazeLyt->addWidget(autoOpenFrame);
|
|
|
|
|
notFazeLyt->addWidget(line_1);
|
|
|
|
@ -289,7 +287,6 @@ void Notice::setFrame(QFrame *frame, KSwitchButton *btn, QString str)
|
|
|
|
|
hLyt->addWidget(label);
|
|
|
|
|
hLyt->addStretch();
|
|
|
|
|
hLyt->addWidget(btn);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -303,24 +300,24 @@ void Notice::initSearchText()
|
|
|
|
|
void Notice::initConnection()
|
|
|
|
|
{
|
|
|
|
|
if (m_globalSettings) {
|
|
|
|
|
connect(m_openTimeHCombox, QOverload<const QString &>::of(&QComboBox::currentIndexChanged), this, [&](const QString &text){
|
|
|
|
|
connect(m_openTimeHComboBox, QOverload<const QString &>::of(&QComboBox::currentIndexChanged), this, [&](const QString &text){
|
|
|
|
|
//Utils::buriedSettings(name(), "open time(hour) when auto turn on do not disturb mode", QString("settings"), text);
|
|
|
|
|
m_globalSettings->setScheduleTurnOnDNDTime(QTime().fromString(QString("%1%2%3").arg(text).arg(":").arg(m_openTimeMCombox->currentText()), "hh:mm"));
|
|
|
|
|
m_globalSettings->setScheduleTurnOnDNDTime(QTime::fromString(text + ":" + m_openTimeMComboBox->currentText(), "hh:mm"));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
connect(m_openTimeMCombox, QOverload<const QString &>::of(&QComboBox::currentIndexChanged), this, [&](const QString &text){
|
|
|
|
|
connect(m_openTimeMComboBox, QOverload<const QString &>::of(&QComboBox::currentIndexChanged), this, [&](const QString &text){
|
|
|
|
|
//Utils::buriedSettings(name(), "open time(minute) when auto turn on do not disturb mode", QString("settings"), m_openTimeMCombox->currentText());
|
|
|
|
|
m_globalSettings->setScheduleTurnOnDNDTime(QTime().fromString(QString("%1%2%3").arg(text).arg(":").arg(m_openTimeHCombox->currentText()), "mm:hh"));
|
|
|
|
|
m_globalSettings->setScheduleTurnOnDNDTime(QTime::fromString(text + m_openTimeHComboBox->currentText(), "mm:hh"));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
connect(m_closeTimeHCombox, QOverload<const QString &>::of(&QComboBox::currentIndexChanged), this, [&](const QString &text){
|
|
|
|
|
connect(m_closeTimeHComboBox, QOverload<const QString &>::of(&QComboBox::currentIndexChanged), this, [&](const QString &text){
|
|
|
|
|
//Utils::buriedSettings(name(), "close time(hour) when auto turn on do not disturb mode", QString("settings"), m_closeTimeMCombox->currentText());
|
|
|
|
|
m_globalSettings->setScheduleTurnOffDNDTime(QTime().fromString(QString("%1%2%3").arg(text).arg(":").arg(m_closeTimeMCombox->currentText()), "hh:mm"));
|
|
|
|
|
m_globalSettings->setScheduleTurnOffDNDTime(QTime::fromString(text + ":" + m_closeTimeMComboBox->currentText(), "hh:mm"));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
connect(m_closeTimeMCombox, QOverload<const QString &>::of(&QComboBox::currentIndexChanged), this, [&](const QString &text){
|
|
|
|
|
connect(m_closeTimeMComboBox, QOverload<const QString &>::of(&QComboBox::currentIndexChanged), this, [&](const QString &text){
|
|
|
|
|
//Utils::buriedSettings(name(), "close time(minute) when auto turn on do not disturb mode", QString("settings"), m_closeTimeMCombox->currentText());
|
|
|
|
|
m_globalSettings->setScheduleTurnOffDNDTime(QTime().fromString(QString("%1%2%3").arg(text).arg(":").arg(m_closeTimeHCombox->currentText()), "mm:hh"));
|
|
|
|
|
m_globalSettings->setScheduleTurnOffDNDTime(QTime::fromString(text + ":" + m_closeTimeHComboBox->currentText(), "mm:hh"));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
connect(m_autoOpenSwitchBtn, &KSwitchButton::stateChanged, [&](bool state) {
|
|
|
|
@ -336,7 +333,7 @@ void Notice::initConnection()
|
|
|
|
|
//Utils::buriedSettings(name(), "whether auto turn on do not disturb mode", QString("settings"), state ? "true" : "false");
|
|
|
|
|
m_globalSettings->setDNDWhileFullScreen(state);
|
|
|
|
|
});
|
|
|
|
|
connect(m_allowAlarmrSwitchBtn, &KSwitchButton::stateChanged, [&](bool state) {
|
|
|
|
|
connect(m_allowAlarmSwitchBtn, &KSwitchButton::stateChanged, [&](bool state) {
|
|
|
|
|
//Utils::buriedSettings(name(), "whether auto turn on do not disturb mode", QString("settings"), state ? "true" : "false");
|
|
|
|
|
m_globalSettings->setNotifyAlarmWhileDND(state);
|
|
|
|
|
});
|
|
|
|
@ -354,22 +351,22 @@ void Notice::initConnection()
|
|
|
|
|
setComBoxStatus(state);
|
|
|
|
|
});
|
|
|
|
|
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::scheduleTurnOnDNDTimeChanged, this, [&](QTime time) {
|
|
|
|
|
m_openTimeHCombox->blockSignals(true);
|
|
|
|
|
m_openTimeHCombox->setCurrentText(time.toString("hh"));
|
|
|
|
|
m_openTimeHCombox->blockSignals(false);
|
|
|
|
|
m_openTimeHComboBox->blockSignals(true);
|
|
|
|
|
m_openTimeHComboBox->setCurrentText(time.toString("hh"));
|
|
|
|
|
m_openTimeHComboBox->blockSignals(false);
|
|
|
|
|
|
|
|
|
|
m_openTimeMCombox->blockSignals(true);
|
|
|
|
|
m_openTimeMCombox->setCurrentText(time.toString("mm"));
|
|
|
|
|
m_openTimeMCombox->blockSignals(false);
|
|
|
|
|
m_openTimeMComboBox->blockSignals(true);
|
|
|
|
|
m_openTimeMComboBox->setCurrentText(time.toString("mm"));
|
|
|
|
|
m_openTimeMComboBox->blockSignals(false);
|
|
|
|
|
});
|
|
|
|
|
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::scheduleTurnOffDNDTimeChanged, this, [&](QTime time) {
|
|
|
|
|
m_closeTimeHCombox->blockSignals(true);
|
|
|
|
|
m_closeTimeHCombox->setCurrentText(time.toString("hh"));
|
|
|
|
|
m_closeTimeHCombox->blockSignals(false);
|
|
|
|
|
m_closeTimeHComboBox->blockSignals(true);
|
|
|
|
|
m_closeTimeHComboBox->setCurrentText(time.toString("hh"));
|
|
|
|
|
m_closeTimeHComboBox->blockSignals(false);
|
|
|
|
|
|
|
|
|
|
m_closeTimeMCombox->blockSignals(true);
|
|
|
|
|
m_closeTimeMCombox->setCurrentText(time.toString("mm"));
|
|
|
|
|
m_closeTimeMCombox->blockSignals(false);
|
|
|
|
|
m_closeTimeMComboBox->blockSignals(true);
|
|
|
|
|
m_closeTimeMComboBox->setCurrentText(time.toString("mm"));
|
|
|
|
|
m_closeTimeMComboBox->blockSignals(false);
|
|
|
|
|
});
|
|
|
|
|
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::DNDWhileMultiScreenChanged, this, [&](bool state) {
|
|
|
|
|
m_multiScreenSwitchBtn->blockSignals(true);
|
|
|
|
@ -382,9 +379,9 @@ void Notice::initConnection()
|
|
|
|
|
m_fullScreenSwitchBtn->blockSignals(false);
|
|
|
|
|
});
|
|
|
|
|
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::notifyAlarmWhileDNDChanged, this, [&](bool state) {
|
|
|
|
|
m_allowAlarmrSwitchBtn->blockSignals(true);
|
|
|
|
|
m_allowAlarmrSwitchBtn->setChecked(state);
|
|
|
|
|
m_allowAlarmrSwitchBtn->blockSignals(false);
|
|
|
|
|
m_allowAlarmSwitchBtn->blockSignals(true);
|
|
|
|
|
m_allowAlarmSwitchBtn->setChecked(state);
|
|
|
|
|
m_allowAlarmSwitchBtn->blockSignals(false);
|
|
|
|
|
});
|
|
|
|
|
connect(m_globalSettings, &UkuiNotification::NotificationGlobalSettings::receiveNotificationsFromAppsChanged, this, [&](bool state) {
|
|
|
|
|
m_enableSwitchBtn->blockSignals(true);
|
|
|
|
@ -405,20 +402,20 @@ void Notice::initNoticeStatus()
|
|
|
|
|
m_autoOpenSwitchBtn->blockSignals(false);
|
|
|
|
|
|
|
|
|
|
QTime openTime = m_globalSettings->scheduleTurnOnDNDTime();
|
|
|
|
|
m_openTimeHCombox->blockSignals(true);
|
|
|
|
|
m_openTimeHCombox->setCurrentText(openTime.toString("hh"));
|
|
|
|
|
m_openTimeHCombox->blockSignals(false);
|
|
|
|
|
m_openTimeMCombox->blockSignals(true);
|
|
|
|
|
m_openTimeMCombox->setCurrentText(openTime.toString("mm"));
|
|
|
|
|
m_openTimeMCombox->blockSignals(false);
|
|
|
|
|
m_openTimeHComboBox->blockSignals(true);
|
|
|
|
|
m_openTimeHComboBox->setCurrentText(openTime.toString("hh"));
|
|
|
|
|
m_openTimeHComboBox->blockSignals(false);
|
|
|
|
|
m_openTimeMComboBox->blockSignals(true);
|
|
|
|
|
m_openTimeMComboBox->setCurrentText(openTime.toString("mm"));
|
|
|
|
|
m_openTimeMComboBox->blockSignals(false);
|
|
|
|
|
|
|
|
|
|
QTime closeTime = m_globalSettings->scheduleTurnOffDNDTime();
|
|
|
|
|
m_closeTimeHCombox->blockSignals(true);
|
|
|
|
|
m_closeTimeHCombox->setCurrentText(closeTime.toString("hh"));
|
|
|
|
|
m_closeTimeHCombox->blockSignals(false);
|
|
|
|
|
m_closeTimeMCombox->blockSignals(true);
|
|
|
|
|
m_closeTimeMCombox->setCurrentText(closeTime.toString("mm"));
|
|
|
|
|
m_closeTimeMCombox->blockSignals(false);
|
|
|
|
|
m_closeTimeHComboBox->blockSignals(true);
|
|
|
|
|
m_closeTimeHComboBox->setCurrentText(closeTime.toString("hh"));
|
|
|
|
|
m_closeTimeHComboBox->blockSignals(false);
|
|
|
|
|
m_closeTimeMComboBox->blockSignals(true);
|
|
|
|
|
m_closeTimeMComboBox->setCurrentText(closeTime.toString("mm"));
|
|
|
|
|
m_closeTimeMComboBox->blockSignals(false);
|
|
|
|
|
|
|
|
|
|
m_multiScreenSwitchBtn->blockSignals(true);
|
|
|
|
|
m_multiScreenSwitchBtn->setChecked(m_globalSettings->DNDWhileMultiScreen());
|
|
|
|
@ -426,9 +423,9 @@ void Notice::initNoticeStatus()
|
|
|
|
|
m_fullScreenSwitchBtn->blockSignals(true);
|
|
|
|
|
m_fullScreenSwitchBtn->setChecked(m_globalSettings->DNDWhileFullScreen());
|
|
|
|
|
m_fullScreenSwitchBtn->blockSignals(false);
|
|
|
|
|
m_allowAlarmrSwitchBtn->blockSignals(true);
|
|
|
|
|
m_allowAlarmrSwitchBtn->setChecked(m_globalSettings->notifyAlarmWhileDND());
|
|
|
|
|
m_allowAlarmrSwitchBtn->blockSignals(false);
|
|
|
|
|
m_allowAlarmSwitchBtn->blockSignals(true);
|
|
|
|
|
m_allowAlarmSwitchBtn->setChecked(m_globalSettings->notifyAlarmWhileDND());
|
|
|
|
|
m_allowAlarmSwitchBtn->blockSignals(false);
|
|
|
|
|
m_enableSwitchBtn->blockSignals(true);
|
|
|
|
|
m_enableSwitchBtn->setChecked(m_globalSettings->receiveNotificationsFromApps());
|
|
|
|
|
m_enableSwitchBtn->blockSignals(false);
|
|
|
|
@ -463,9 +460,6 @@ void Notice::initItemUi(const QString &desktopPath, UkuiNotification::SingleAppl
|
|
|
|
|
QLabel *iconLabel = new QLabel(baseWidget);
|
|
|
|
|
iconLabel->setFixedSize(32, 32);
|
|
|
|
|
|
|
|
|
|
if (fileName == "ukui-flash-disk")
|
|
|
|
|
iconName = "drive-removable-media-usb";
|
|
|
|
|
|
|
|
|
|
setAppIcon(iconLabel, iconName);
|
|
|
|
|
connect(m_themeSetting, &QGSettings::changed, [&](const QString &key){
|
|
|
|
|
if (key == "iconThemeName")
|
|
|
|
@ -479,7 +473,7 @@ void Notice::initItemUi(const QString &desktopPath, UkuiNotification::SingleAppl
|
|
|
|
|
QLabel *nameLabel = new QLabel(baseWidget);
|
|
|
|
|
nameLabel->setText(localName);
|
|
|
|
|
|
|
|
|
|
ukToolButton *setBtn = new ukToolButton(baseWidget);
|
|
|
|
|
ToolButton *setBtn = new ToolButton(baseWidget);
|
|
|
|
|
setBtn->setProperty("useButtonPalette", true);
|
|
|
|
|
setBtn->setPopupMode(QToolButton::InstantPopup);
|
|
|
|
|
setBtn->setFixedSize(QSize(36, 36));
|
|
|
|
@ -496,15 +490,15 @@ void Notice::initItemUi(const QString &desktopPath, UkuiNotification::SingleAppl
|
|
|
|
|
devHorLayout->addWidget(setBtn);
|
|
|
|
|
devHorLayout->addWidget(appSwitch);
|
|
|
|
|
|
|
|
|
|
m_applistverticalLayout->addWidget(baseWidget);
|
|
|
|
|
if (m_applistverticalLayout->count() >= 2) {
|
|
|
|
|
m_appListVerticalLayout->addWidget(baseWidget);
|
|
|
|
|
if (m_appListVerticalLayout->count() >= 2) {
|
|
|
|
|
QFrame *line = new QFrame(m_pluginWidget);
|
|
|
|
|
line->setMinimumSize(QSize(0, 1));
|
|
|
|
|
line->setMaximumSize(QSize(16777215, 1));
|
|
|
|
|
line->setLineWidth(0);
|
|
|
|
|
line->setFrameShape(QFrame::HLine);
|
|
|
|
|
line->setFrameShadow(QFrame::Sunken);
|
|
|
|
|
m_applistverticalLayout->insertWidget(m_applistverticalLayout->count() - 1, line);
|
|
|
|
|
m_appListVerticalLayout->insertWidget(m_appListVerticalLayout->count() - 1, line);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -513,7 +507,7 @@ void Notice::initItemUi(const QString &desktopPath, UkuiNotification::SingleAppl
|
|
|
|
|
appSwitch->blockSignals(false);
|
|
|
|
|
|
|
|
|
|
menu->blockSignals(true);
|
|
|
|
|
menu->initStaus(settings);
|
|
|
|
|
menu->initStatus(settings);
|
|
|
|
|
menu->blockSignals(false);
|
|
|
|
|
|
|
|
|
|
connect(appSwitch, &KSwitchButton::stateChanged, [=](bool state) {
|
|
|
|
@ -586,13 +580,13 @@ void Notice::initItemUi(const QString &desktopPath, UkuiNotification::SingleAppl
|
|
|
|
|
|
|
|
|
|
void Notice::setAppIcon(QLabel *iconlabel, const QString &icon)
|
|
|
|
|
{
|
|
|
|
|
QFileInfo iconfile(QString("/usr/share/pixmaps/"+ icon + ".png"));
|
|
|
|
|
QFileInfo iconFile(QString("/usr/share/pixmaps/" + icon + ".png"));
|
|
|
|
|
QPixmap pixmap;
|
|
|
|
|
QIcon currenticon = QIcon::fromTheme(icon);
|
|
|
|
|
if (!currenticon.isNull()) {
|
|
|
|
|
pixmap = currenticon.pixmap(QSize(32, 32));
|
|
|
|
|
} else if (iconfile.exists()) {
|
|
|
|
|
pixmap = QPixmap(iconfile.filePath()).scaled(32, 32);
|
|
|
|
|
QIcon currentIcon = QIcon::fromTheme(icon);
|
|
|
|
|
if (!currentIcon.isNull()) {
|
|
|
|
|
pixmap = currentIcon.pixmap(QSize(32, 32));
|
|
|
|
|
} else if (iconFile.exists()) {
|
|
|
|
|
pixmap = QPixmap(iconFile.filePath()).scaled(32, 32);
|
|
|
|
|
} else {
|
|
|
|
|
pixmap = QPixmap(QString(":/img/plugins/autoboot/desktop.png"));
|
|
|
|
|
}
|
|
|
|
@ -606,16 +600,16 @@ void Notice::setHiddenNoticeApp(bool status)
|
|
|
|
|
|
|
|
|
|
void Notice::setComBoxStatus(bool status)
|
|
|
|
|
{
|
|
|
|
|
m_openTimeHCombox->setEnabled(status);
|
|
|
|
|
m_closeTimeHCombox->setEnabled(status);
|
|
|
|
|
m_openTimeMCombox->setEnabled(status);
|
|
|
|
|
m_closeTimeMCombox->setEnabled(status);
|
|
|
|
|
m_openTimeHComboBox->setEnabled(status);
|
|
|
|
|
m_closeTimeHComboBox->setEnabled(status);
|
|
|
|
|
m_openTimeMComboBox->setEnabled(status);
|
|
|
|
|
m_closeTimeMComboBox->setEnabled(status);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ukToolButton::paintEvent(QPaintEvent *event)
|
|
|
|
|
void ToolButton::paintEvent(QPaintEvent *event)
|
|
|
|
|
{
|
|
|
|
|
QPalette paltte;
|
|
|
|
|
paltte.setColor(QPalette::Button, paltte.base().color());
|
|
|
|
|
this->setPalette(paltte);
|
|
|
|
|
QPalette palette;
|
|
|
|
|
palette.setColor(QPalette::Button, palette.base().color());
|
|
|
|
|
this->setPalette(palette);
|
|
|
|
|
QToolButton::paintEvent(event);
|
|
|
|
|
}
|
|
|
|
|