1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-23 13:33:50 +03:00

support sticker for configuration window

This commit is contained in:
Michail Vourlakos 2017-01-04 01:35:22 +02:00
parent a45d9691dc
commit 63739ac77b
5 changed files with 55 additions and 6 deletions

View File

@ -36,7 +36,10 @@
namespace Latte { namespace Latte {
DockConfigView::DockConfigView(Plasma::Containment *containment, DockView *dockView, QWindow *parent) 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.setSingleShot(true);
m_deleterTimer.setInterval(10 * 1000); m_deleterTimer.setInterval(10 * 1000);
@ -80,6 +83,7 @@ void DockConfigView::init()
setDefaultAlphaBuffer(true); setDefaultAlphaBuffer(true);
setColor(Qt::transparent); setColor(Qt::transparent);
rootContext()->setContextProperty(QStringLiteral("dock"), m_dockView); rootContext()->setContextProperty(QStringLiteral("dock"), m_dockView);
rootContext()->setContextProperty(QStringLiteral("dockConfig"), this);
engine()->rootContext()->setContextObject(new KLocalizedContext(this)); engine()->rootContext()->setContextObject(new KLocalizedContext(this));
auto source = QUrl::fromLocalFile(m_containment->corona()->kPackage().filePath("lattedockconfigurationui")); auto source = QUrl::fromLocalFile(m_containment->corona()->kPackage().filePath("lattedockconfigurationui"));
setSource(source); setSource(source);
@ -220,7 +224,9 @@ void DockConfigView::focusOutEvent(QFocusEvent *ev)
if (focusWindow && focusWindow->flags().testFlag(Qt::Popup)) if (focusWindow && focusWindow->flags().testFlag(Qt::Popup))
return; return;
hide(); if (!m_blockFocusLost) {
hide();
}
} }
void DockConfigView::configurationShown(PlasmaQuick::ConfigView *configView) 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; // kate: indent-mode cstyle; indent-width 4; replace-tabs on;

View File

@ -49,6 +49,9 @@ public:
void init() override; void init() override;
Qt::WindowFlags wFlags() const; Qt::WindowFlags wFlags() const;
public slots:
Q_INVOKABLE void setSticker(bool blockFocusLost);
protected: protected:
void showEvent(QShowEvent *ev) override; void showEvent(QShowEvent *ev) override;
void hideEvent(QHideEvent *ev) override; void hideEvent(QHideEvent *ev) override;
@ -62,11 +65,12 @@ private slots:
void configurationShown(PlasmaQuick::ConfigView *configView); void configurationShown(PlasmaQuick::ConfigView *configView);
private: private:
bool m_blockFocusLost;
Plasma::Containment *m_containment{nullptr}; Plasma::Containment *m_containment{nullptr};
QPointer<DockView> m_dockView; QPointer<DockView> m_dockView;
QTimer m_deleterTimer; QTimer m_deleterTimer;
QTimer m_screenSyncTimer; QTimer m_screenSyncTimer;
}; };
} }

View File

@ -52,7 +52,10 @@
</choices> </choices>
<default>1</default> <default>1</default>
</entry> </entry>
<!-- Config properties -->
<entry name="configurationSticker" type="Bool">
<default>false</default>
</entry>
<!-- Tasks properties --> <!-- Tasks properties -->
<entry name="showGlow" type="Bool"> <entry name="showGlow" type="Bool">
<default>true</default> <default>true</default>

View File

@ -47,6 +47,33 @@ PlasmaCore.FrameSvgItem {
FontLoader { id: tangerineFont; name: "Tangerine"; source: "../fonts/tangerine.ttf" } 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{ ColumnLayout{
width: parent.width - 2*windowSpace width: parent.width - 2*windowSpace
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
@ -85,6 +112,7 @@ PlasmaCore.FrameSvgItem {
font.bold: true font.bold: true
opacity: 0.4 opacity: 0.4
Layout.topMargin: 1.4 * units.iconSizes.small
Layout.alignment: Qt.AlignRight | Qt.AlignTop Layout.alignment: Qt.AlignRight | Qt.AlignTop
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
Layout.fillWidth: true Layout.fillWidth: true

View File

@ -59,8 +59,6 @@ PlasmaComponents.Page{
id: showGlow id: showGlow
text: i18n("Show glow around windows points") text: i18n("Show glow around windows points")
onCheckedChanged: { onCheckedChanged: {
plasmoid.configuration.showGlow = checked; plasmoid.configuration.showGlow = checked;
} }