mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fixed(dde-dock): add GSettings config for bug 13911 of trash-plugin
This commit is contained in:
parent
e069fbe8c0
commit
1171b9c639
@ -48,6 +48,12 @@ static QGSettings *GSettingsByMenu()
|
|||||||
return &settings;
|
return &settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QGSettings *GSettingsByTrash()
|
||||||
|
{
|
||||||
|
static QGSettings settings("com.deepin.dde.dock.module.trash");
|
||||||
|
return &settings;
|
||||||
|
}
|
||||||
|
|
||||||
DockSettings::DockSettings(QWidget *parent)
|
DockSettings::DockSettings(QWidget *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_dockInter(new DBusDock("com.deepin.dde.daemon.Dock", "/com/deepin/dde/daemon/Dock", QDBusConnection::sessionBus(), this))
|
, m_dockInter(new DBusDock("com.deepin.dde.daemon.Dock", "/com/deepin/dde/daemon/Dock", QDBusConnection::sessionBus(), this))
|
||||||
@ -65,6 +71,7 @@ DockSettings::DockSettings(QWidget *parent)
|
|||||||
, m_smartHideAct(tr("Smart Hide"), this)
|
, m_smartHideAct(tr("Smart Hide"), this)
|
||||||
, m_displayInter(new DBusDisplay(this))
|
, m_displayInter(new DBusDisplay(this))
|
||||||
, m_itemManager(DockItemManager::instance(this))
|
, m_itemManager(DockItemManager::instance(this))
|
||||||
|
, m_trashPluginShow(true)
|
||||||
{
|
{
|
||||||
checkService();
|
checkService();
|
||||||
|
|
||||||
@ -140,6 +147,8 @@ DockSettings::DockSettings(QWidget *parent)
|
|||||||
connect(m_displayInter, &DBusDisplay::ScreenHeightChanged, this, &DockSettings::primaryScreenChanged, Qt::QueuedConnection);
|
connect(m_displayInter, &DBusDisplay::ScreenHeightChanged, this, &DockSettings::primaryScreenChanged, Qt::QueuedConnection);
|
||||||
connect(m_displayInter, &DBusDisplay::ScreenWidthChanged, this, &DockSettings::primaryScreenChanged, Qt::QueuedConnection);
|
connect(m_displayInter, &DBusDisplay::ScreenWidthChanged, this, &DockSettings::primaryScreenChanged, Qt::QueuedConnection);
|
||||||
connect(m_displayInter, &DBusDisplay::PrimaryChanged, this, &DockSettings::primaryScreenChanged, Qt::QueuedConnection);
|
connect(m_displayInter, &DBusDisplay::PrimaryChanged, this, &DockSettings::primaryScreenChanged, Qt::QueuedConnection);
|
||||||
|
connect(GSettingsByTrash(), &QGSettings::changed, this, &DockSettings::onTrashGSettingsChanged);
|
||||||
|
QTimer::singleShot(0, this, [=] {onGSettingsChanged("enable");});
|
||||||
|
|
||||||
DApplication *app = qobject_cast<DApplication *>(qApp);
|
DApplication *app = qobject_cast<DApplication *>(qApp);
|
||||||
if (app) {
|
if (app) {
|
||||||
@ -240,10 +249,9 @@ void DockSettings::showDockSettingsMenu()
|
|||||||
const QString &name = p->pluginName();
|
const QString &name = p->pluginName();
|
||||||
const QString &display = p->pluginDisplayName();
|
const QString &display = p->pluginDisplayName();
|
||||||
|
|
||||||
// // do not show trash in context menu under Efficient mode
|
if (!m_trashPluginShow && name == "trash") {
|
||||||
// if (m_displayMode == Efficient && name == "trash") {
|
continue;
|
||||||
// continue;
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
QAction *act = new QAction(display, this);
|
QAction *act = new QAction(display, this);
|
||||||
act->setCheckable(true);
|
act->setCheckable(true);
|
||||||
@ -619,3 +627,16 @@ void DockSettings::checkService()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DockSettings::onTrashGSettingsChanged(const QString &key)
|
||||||
|
{
|
||||||
|
if (key != "enable") {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
QGSettings *setting = GSettingsByTrash();
|
||||||
|
|
||||||
|
if (setting->keys().contains("enable")) {
|
||||||
|
m_trashPluginShow = GSettingsByTrash()->keys().contains("enable") && GSettingsByTrash()->get("enable").toBool();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -105,6 +105,7 @@ private slots:
|
|||||||
void onOpacityChanged(const double value);
|
void onOpacityChanged(const double value);
|
||||||
void trayVisableCountChanged(const int &count);
|
void trayVisableCountChanged(const int &count);
|
||||||
void onWindowSizeChanged();
|
void onWindowSizeChanged();
|
||||||
|
void onTrashGSettingsChanged(const QString &key);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DockSettings(QWidget *parent = 0);
|
DockSettings(QWidget *parent = 0);
|
||||||
@ -145,6 +146,7 @@ private:
|
|||||||
|
|
||||||
DBusDisplay *m_displayInter;
|
DBusDisplay *m_displayInter;
|
||||||
DockItemManager *m_itemManager;
|
DockItemManager *m_itemManager;
|
||||||
|
bool m_trashPluginShow;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DOCKSETTINGS_H
|
#endif // DOCKSETTINGS_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user