mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-23 01:33:50 +03:00
support sticker for configuration window
This commit is contained in:
parent
a45d9691dc
commit
63739ac77b
@ -36,7 +36,10 @@
|
||||
namespace Latte {
|
||||
|
||||
DockConfigView::DockConfigView(Plasma::Containment *containment, DockView *dockView, QWindow *parent)
|
||||
: PlasmaQuick::ConfigView(containment, parent), m_containment(containment), m_dockView(dockView)
|
||||
: PlasmaQuick::ConfigView(containment, parent),
|
||||
m_containment(containment),
|
||||
m_dockView(dockView),
|
||||
m_blockFocusLost(false)
|
||||
{
|
||||
m_deleterTimer.setSingleShot(true);
|
||||
m_deleterTimer.setInterval(10 * 1000);
|
||||
@ -80,6 +83,7 @@ void DockConfigView::init()
|
||||
setDefaultAlphaBuffer(true);
|
||||
setColor(Qt::transparent);
|
||||
rootContext()->setContextProperty(QStringLiteral("dock"), m_dockView);
|
||||
rootContext()->setContextProperty(QStringLiteral("dockConfig"), this);
|
||||
engine()->rootContext()->setContextObject(new KLocalizedContext(this));
|
||||
auto source = QUrl::fromLocalFile(m_containment->corona()->kPackage().filePath("lattedockconfigurationui"));
|
||||
setSource(source);
|
||||
@ -220,7 +224,9 @@ void DockConfigView::focusOutEvent(QFocusEvent *ev)
|
||||
if (focusWindow && focusWindow->flags().testFlag(Qt::Popup))
|
||||
return;
|
||||
|
||||
hide();
|
||||
if (!m_blockFocusLost) {
|
||||
hide();
|
||||
}
|
||||
}
|
||||
|
||||
void DockConfigView::configurationShown(PlasmaQuick::ConfigView *configView)
|
||||
@ -237,5 +243,15 @@ void DockConfigView::immutabilityChanged(Plasma::Types::ImmutabilityType type)
|
||||
}
|
||||
}
|
||||
|
||||
void DockConfigView::setSticker(bool blockFocusLost)
|
||||
{
|
||||
if (m_blockFocusLost == blockFocusLost) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_blockFocusLost = blockFocusLost;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// kate: indent-mode cstyle; indent-width 4; replace-tabs on;
|
||||
|
@ -49,6 +49,9 @@ public:
|
||||
void init() override;
|
||||
Qt::WindowFlags wFlags() const;
|
||||
|
||||
public slots:
|
||||
Q_INVOKABLE void setSticker(bool blockFocusLost);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *ev) override;
|
||||
void hideEvent(QHideEvent *ev) override;
|
||||
@ -62,11 +65,12 @@ private slots:
|
||||
void configurationShown(PlasmaQuick::ConfigView *configView);
|
||||
|
||||
private:
|
||||
bool m_blockFocusLost;
|
||||
|
||||
Plasma::Containment *m_containment{nullptr};
|
||||
QPointer<DockView> m_dockView;
|
||||
QTimer m_deleterTimer;
|
||||
QTimer m_screenSyncTimer;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -52,7 +52,10 @@
|
||||
</choices>
|
||||
<default>1</default>
|
||||
</entry>
|
||||
|
||||
<!-- Config properties -->
|
||||
<entry name="configurationSticker" type="Bool">
|
||||
<default>false</default>
|
||||
</entry>
|
||||
<!-- Tasks properties -->
|
||||
<entry name="showGlow" type="Bool">
|
||||
<default>true</default>
|
||||
|
@ -47,6 +47,33 @@ PlasmaCore.FrameSvgItem {
|
||||
|
||||
FontLoader { id: tangerineFont; name: "Tangerine"; source: "../fonts/tangerine.ttf" }
|
||||
|
||||
PlasmaComponents.ToolButton{
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
|
||||
checkable: true
|
||||
|
||||
iconSource: "emblem-symbolic-link"
|
||||
|
||||
minimumWidth: units.iconSizes.small
|
||||
minimumHeight: units.iconSizes.small
|
||||
|
||||
property bool inStartup: true
|
||||
|
||||
onCheckedChanged: {
|
||||
if (!inStartup) {
|
||||
plasmoid.configuration.configurationSticker = checked;
|
||||
dockConfig.setSticker(checked);
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
checked = plasmoid.configuration.configurationSticker;
|
||||
dockConfig.setSticker(plasmoid.configuration.configurationSticker);
|
||||
inStartup = false;
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout{
|
||||
width: parent.width - 2*windowSpace
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@ -85,6 +112,7 @@ PlasmaCore.FrameSvgItem {
|
||||
font.bold: true
|
||||
opacity: 0.4
|
||||
|
||||
Layout.topMargin: 1.4 * units.iconSizes.small
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
horizontalAlignment: Text.AlignRight
|
||||
Layout.fillWidth: true
|
||||
|
@ -59,8 +59,6 @@ PlasmaComponents.Page{
|
||||
id: showGlow
|
||||
text: i18n("Show glow around windows points")
|
||||
|
||||
|
||||
|
||||
onCheckedChanged: {
|
||||
plasmoid.configuration.showGlow = checked;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user