ViewTitleDelegate.qml 1.3 KB
Newer Older
1
2
3
4
5
6
7
// SPDX-FileCopyrightText: 2021 Felipe Kinoshita <kinofhek@gmail.com>
// SPDX-License-Identifier: LGPL-2.0-or-later

import QtQuick 2.15
import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15
import org.kde.kirigami 2.15 as Kirigami
8
import org.kde.kalendar 1.0
9
10
11
12
13

RowLayout {
    property alias titleDateButton: titleDataButton

    spacing: 0
14
15
16
17

    // REMINDER: The collapse button used in the tasks view has its own implementation!!
    // You can find it in its instantiating component in main.qml

18
19
20
    QQC2.ToolButton {
        visible: !Kirigami.Settings.isMobile
        icon.name: sidebar.collapsed ? "sidebar-expand" : "sidebar-collapse"
21
22
23
24
25
26
27
28
29
        onClicked: {
            if(sidebar.collapsed && !wideScreen) { // Collapsed due to narrow window
                // We don't want to write to config as when narrow the button will only open the modal drawer
                sidebar.collapsed = !sidebar.collapsed;
            } else {
                Config.forceCollapsedSidebar = !Config.forceCollapsedSidebar;
                Config.save()
            }
        }
30
31
32
33
34
35
36
37
38

        QQC2.ToolTip.text: sidebar.collapsed ? i18n("Expand Sidebar") : i18n("Collapse Sidebar")
        QQC2.ToolTip.visible: hovered
        QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
    }
    TitleDateButton {
        id: titleDataButton
    }
}