-
Notifications
You must be signed in to change notification settings - Fork 15
/
DayComment.qml
120 lines (99 loc) · 2.93 KB
/
DayComment.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import QtQuick 1.1
import "Storage.js" as Storage
Rectangle {
id: daycomment
property alias textedit: text_edit1
property alias subheader: subheadertext
property alias save_note_button: saveb
color: "#FBEA76"
width: parent.width
Text {
id: headertext
color: "#222"
anchors {
top: parent.top
topMargin: 5
horizontalCenter: parent.horizontalCenter
}
text: qsTr("Daily Note")
font.pixelSize: 16
}
Text {
id: subheadertext
color: "#4c4c4c"
anchors {
top: headertext.bottom
topMargin: 1
horizontalCenter: parent.horizontalCenter
}
text: ""
font.pixelSize: 16
}
Flickable {
id: flick
contentY: text_edit1.height - height
contentHeight: text_edit1.height
contentWidth: text_edit1.width
anchors {
top: subheadertext.bottom
topMargin: 5
left: parent.left
leftMargin: 5
right: parent.right
rightMargin: 5
bottom: cancelb.top
bottomMargin: 5
}
clip: true
TextEdit {
id: text_edit1
color: "#222"
width: daycomment.width - 10
anchors.top: parent.top
text: ""
cursorVisible: true
textFormat: TextEdit.PlainText
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
font.pixelSize: 16
selectByMouse: true
focus: true
}
}
Button {
id: cancelb
anchors {
left: parent.left
leftMargin: 5
bottom: parent.bottom
bottomMargin: 5
}
buttontext: "Cancel"
button_ma.onClicked: {
daycomment.height = 0
daycomment.opacity = 0
}
}
Button {
id: saveb
visible: text_edit1.text !==""
buttoncolor: "#2ecc71"
anchors {
right: parent.right
rightMargin: 5
bottom: parent.bottom
bottomMargin: 5
}
buttontext: "Save"
button_ma.onClicked: {
daycomment.height = 0
daycomment.opacity = 0
day_note_text.text = text_edit1.text
var textofnote = daycomment.textedit.text
var thismonth = calendar_view.month_name_header.monthNumber;
var thisyear = calendar_view.year_header.text;
var thisday = subheadertext.text.charAt(1) == " " ? subheadertext.text.charAt(0) : subheadertext.text.charAt(0) + subheadertext.text.charAt(1);
day_note_view.visible || work_view_text.day_stats.visible ? Storage.updateNote(thismonth, thisday, thisyear, textofnote) : Storage.saveNote(thismonth, thisday, thisyear, textofnote);
day_note_view.visible = true
}
}
}