Merge lp:~costales/uwriter/convergence into lp:uwriter

Proposed by costales
Status: Merged
Merged at revision: 55
Proposed branch: lp:~costales/uwriter/convergence
Merge into: lp:uwriter
Prerequisite: lp:~costales/uwriter/0.19-deprecated
Diff against target: 2380 lines (+1227/-1042)
5 files modified
qml/About.qml (+38/-3)
qml/LoadFile.qml (+58/-59)
qml/Main.qml (+273/-236)
qml/Menu.qml (+777/-667)
qml/SaveAs.qml (+81/-77)
To merge this branch: bzr merge lp:~costales/uwriter/convergence
Reviewer Review Type Date Requested Status
costales Pending
Review via email: mp+310116@code.launchpad.net

Description of the change

Convergence

To post a comment you must log in.
lp:~costales/uwriter/convergence updated
62. By costales

Redone menu order

63. By costales

x in Insert table

64. By costales

Min window size

65. By costales

Sam to Credtis

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/About.qml'
2--- qml/About.qml 2016-11-07 18:43:00 +0000
3+++ qml/About.qml 2016-11-07 18:43:00 +0000
4@@ -25,7 +25,10 @@
5 iconName: "back"
6 text: i18n.tr("Back")
7 onTriggered: {
8- onClicked: mainPageStack.pop(aboutPage)
9+ onClicked: {
10+ pageMain.pageStack.addPageToNextColumn(pageMain, Qt.resolvedUrl("Menu.qml"));
11+ mainPageStack.removePages(aboutPage);
12+ }
13 }
14 }
15 ]
16@@ -36,7 +39,7 @@
17 id: flickable
18 anchors.fill: parent
19 anchors.topMargin: units.gu(5)
20- contentHeight: appColumn.height + launchpadColumn.height + devColumn.height + localeColumn.height + poweredByColumn.height + units.gu(16)
21+ contentHeight: appColumn.height + launchpadColumn.height + devColumn.height + designColumn.height + localeColumn.height + poweredByColumn.height + units.gu(18)
22
23 Column {
24 id: appColumn
25@@ -131,8 +134,40 @@
26
27
28 Column {
29+ id: designColumn
30+ anchors.top: devColumn.bottom
31+ anchors.topMargin: units.gu(2)
32+ width: parent.width
33+ ListItem.Header {
34+ id: designHeader
35+ text: i18n.tr("Logo")
36+ }
37+
38+ Repeater {
39+ id: designListView
40+
41+ model: designModel
42+ delegate: ListItem.Standard {
43+ progression: true
44+ showDivider: false
45+ text: model.name
46+ onClicked: Qt.openUrlExternally(model.link)
47+ }
48+ }
49+
50+ ListModel {
51+ id: designModel
52+ Component.onCompleted: initialize()
53+ function initialize() {
54+ designModel.append({ name: "Sam Hewitt", link: "http://samuelhewitt.com/" })
55+ }
56+ }
57+ }
58+
59+
60+ Column {
61 id: localeColumn
62- anchors.top: devColumn.bottom
63+ anchors.top: designColumn.bottom
64 anchors.topMargin: units.gu(2)
65 width: parent.width
66
67
68=== modified file 'qml/LoadFile.qml'
69--- qml/LoadFile.qml 2016-10-28 15:16:54 +0000
70+++ qml/LoadFile.qml 2016-11-07 18:43:00 +0000
71@@ -21,68 +21,67 @@
72 import "js/utils.js" as QmlJs
73
74
75-MainView {
76- id: menuLoadFiles
77- anchors.fill: parent
78-
79- Page {
80- id: pageLoadFiles
81-
82- header: PageHeader {
83- id: pageHeader
84- title: i18n.tr("Files")
85- StyleHints {
86- foregroundColor: '#ffffff'
87- backgroundColor: '#ffb84f'
88- dividerColor: UbuntuColors.slate
89- }
90-
91- leadingActionBar {
92- numberOfSlots: 1
93- actions: [
94- Action {
95- id: actionSettings
96- iconName: "back"
97- text: i18n.tr("Back")
98- onTriggered: {
99- onClicked: mainPageStack.pop(pageLoadFiles)
100+Page {
101+ id: pageLoadFiles
102+
103+ header: PageHeader {
104+ id: pageHeader
105+ title: i18n.tr("Files")
106+ StyleHints {
107+ foregroundColor: '#ffffff'
108+ backgroundColor: '#ffb84f'
109+ dividerColor: UbuntuColors.slate
110+ }
111+
112+ leadingActionBar {
113+ numberOfSlots: 1
114+ actions: [
115+ Action {
116+ id: actionSettings
117+ iconName: "back"
118+ text: i18n.tr("Back")
119+ onTriggered: {
120+ onClicked: {
121+ mainPageStack.childPageOpened = false;
122+ mainPageStack.removePages(pageLoadFiles);
123 }
124 }
125- ]
126- }
127- }
128-
129- Label {
130- id: lblNnoFiles
131- width: parent.width - units.gu(4)
132- anchors.centerIn: parent
133- visible: folderModel.count === 0
134- horizontalAlignment: Text.AlignHCenter
135- wrapMode: Text.WordWrap
136- text: i18n.tr("No files yet")
137- }
138-
139- FolderListModel {
140- id: folderModel
141- folder: "/home/phablet/.local/share/uwp.costales"
142- nameFilters: [ "*.html" ]
143- showDirs: false
144- }
145-
146- ListView {
147- id: listView
148- anchors.top: pageHeader.bottom
149- anchors.bottom: parent.bottom
150- anchors.left: parent.left
151- anchors.right: parent.right
152- model: folderModel
153- delegate: ListItem.Standard {
154- text: model.fileName
155- onClicked: {
156- mainPageStack.filename = model.fileName.replace(/.html$/,'');
157- QmlJs.openFile(model.fileName);
158- mainPageStack.pop(pageLoadFiles);
159 }
160+ ]
161+ }
162+ }
163+
164+ Label {
165+ id: lblNnoFiles
166+ width: parent.width - units.gu(4)
167+ anchors.centerIn: parent
168+ visible: folderModel.count === 0
169+ horizontalAlignment: Text.AlignHCenter
170+ wrapMode: Text.WordWrap
171+ text: i18n.tr("No files yet")
172+ }
173+
174+ FolderListModel {
175+ id: folderModel
176+ folder: "/home/phablet/.local/share/uwp.costales"
177+ nameFilters: [ "*.html" ]
178+ showDirs: false
179+ }
180+
181+ ListView {
182+ id: listView
183+ anchors.top: pageHeader.bottom
184+ anchors.bottom: parent.bottom
185+ anchors.left: parent.left
186+ anchors.right: parent.right
187+ model: folderModel
188+ delegate: ListItem.Standard {
189+ text: model.fileName
190+ onClicked: {
191+ mainPageStack.filename = model.fileName.replace(/.html$/,'');
192+ QmlJs.openFile(model.fileName);
193+ mainPageStack.childPageOpened = false;
194+ mainPageStack.removePages(pageLoadFiles);
195 }
196 }
197 }
198
199=== modified file 'qml/Main.qml'
200--- qml/Main.qml 2016-11-07 18:43:00 +0000
201+++ qml/Main.qml 2016-11-07 18:43:00 +0000
202@@ -20,247 +20,284 @@
203 import com.canonical.Oxide 1.0 as Oxide
204 import Qt.labs.settings 1.0
205 import "js/utils.js" as QmlJs
206-
207-
208-MainView {
209- objectName: "mainView"
210-
211- applicationName: "uwp.costales"
212-
213- width: units.gu(100)
214+import QtQuick.Window 2.2
215+
216+Window {
217+ id: uwriterWindow
218+
219+ title: "uWriter"
220+ width: units.gu(90)
221 height: units.gu(70)
222- anchorToKeyboard: true
223-
224- PageStack {
225- id: mainPageStack
226- anchors.fill: parent
227- width: parent.width
228-
229- property string filename: ''
230- property string saveAsOperation: ''
231-
232+ minimumWidth: units.gu(45)
233+ minimumHeight: units.gu(40)
234+
235+ MainView {
236+ objectName: "mainView"
237+
238+ applicationName: "uwp.costales"
239+
240+ width: uwriterWindow.width
241+ height: uwriterWindow.height
242+ anchorToKeyboard: true
243+
244 Component.onCompleted: {
245- mainPageStack.push(pageMain);
246 i18n.domain = "uwriter";
247 i18n.bindtextdomain("uwriter", "i18n/mo");
248 }
249-
250- function executeJavaScript(code) {
251- var req = webview.rootFrame.sendMessage("messaging://", "EXECUTE", {code: code});
252- req.onerror = function (code, explanation) {
253- console.log("Error " + code + ": " + explanation)
254- }
255- }
256-
257-
258-
259- Page {
260- id: pageMain
261-
262- onVisibleChanged: {
263- if (visible)
264- webview.forceActiveFocus();
265- }
266-
267- property bool btnsEnabled: false
268-
269- header: PageHeader {
270- id: pageHeader
271- title: "uWriter"
272- StyleHints {
273- foregroundColor: '#ffffff'
274- backgroundColor: '#ffb84f'
275- dividerColor: UbuntuColors.slate
276- }
277- leadingActionBar {
278- numberOfSlots: 1
279- actions: [
280- Action {
281- id: actionSettings
282- iconName: "navigation-menu"
283- shortcut: "Ctrl+M"
284- enabled: pageMain.btnsEnabled
285- text: i18n.tr("Menu")
286- onTriggered: {
287- Qt.inputMethod.hide();
288- mainPageStack.push(Qt.resolvedUrl("Menu.qml"))
289- }
290- }
291- ]
292- }
293- trailingActionBar {
294- numberOfSlots: 5
295- actions: [
296- Action {
297- id: actionSaveAs
298- iconName: "save-as"
299- enabled: pageMain.btnsEnabled
300- text: i18n.tr("Save as")
301- onTriggered: {
302- mainPageStack.push(Qt.resolvedUrl("SaveAs.qml"), {"setNewDoc": false, "callLoadDoc": false, "mainFilename": mainPageStack.filename})
303- }
304- },
305- Action {
306- id: actionSave
307- iconName: "save"
308- shortcut: "Ctrl+S"
309- enabled: pageMain.btnsEnabled
310- text: i18n.tr("Save")
311- onTriggered: {
312- if (!mainPageStack.filename) {
313- mainPageStack.push(Qt.resolvedUrl("SaveAs.qml"), {"setNewDoc": false, "callLoadDoc": false, "mainFilename": mainPageStack.filename})
314- }
315- else {
316- mainPageStack.executeJavaScript("qml_save_content(false)");
317- }
318- }
319- },
320- Action {
321- id: actionLoad
322- iconName: "document-open"
323- shortcut: "Ctrl+O"
324- enabled: pageMain.btnsEnabled
325- text: i18n.tr("Load")
326- onTriggered: {
327- mainPageStack.executeJavaScript("qml_query_modified('load')");
328- }
329- },
330- Action {
331- id: actionNew
332- iconName: "note"
333- shortcut: "Ctrl+N"
334- enabled: pageMain.btnsEnabled
335- text: i18n.tr("New")
336- onTriggered: {
337- mainPageStack.executeJavaScript("qml_query_modified('new')");
338- }
339- }
340- ]
341- }
342- }
343-
344- WebContext {
345- id: webcontext
346- userAgent: "Mozilla/5.0 (Linux; Android 5.0; Nexus 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.102 Mobile Safari/537.36"
347- userScripts: [
348- Oxide.UserScript {
349- context: "messaging://"
350- url: Qt.resolvedUrl("js/oxide.js")
351- }
352- ]
353- }
354-
355- WebView {
356- id: webview
357- anchors.top: pageHeader.bottom
358- anchors.bottom: parent.bottom
359- anchors.left: parent.left
360- anchors.right: parent.right
361- //anchors.fill: parent
362- z: -6
363- context: webcontext
364- url: "../uwp/index.html"
365- preferences.allowFileAccessFromFileUrls: true
366- preferences.allowUniversalAccessFromFileUrls: true
367- preferences.appCacheEnabled: true
368- preferences.javascriptCanAccessClipboard: true
369- preferences.javascriptEnabled: true
370-
371- onLoadingStateChanged: {
372- if (!loading && !mainPageStack.onLoadingExecuted)
373- pageMain.btnsEnabled = true;
374- }
375-
376- onNavigationRequested:{
377- var url = request.url.toString();
378-
379- // Save
380- if (QmlJs.url_starts_with(url, 'http://save/')) {
381- var contentHTML = request.url.toString().replace(/^http:\/\/save\//,'');
382- QmlJs.saveFile(mainPageStack.filename, contentHTML);
383- }
384-
385- // Save & New
386- if (QmlJs.url_starts_with(url, 'http://save_and_new/')) {
387- var contentHTML = request.url.toString().replace(/^http:\/\/save_and_new\//,'');
388- QmlJs.saveFile(mainPageStack.filename, contentHTML);
389- mainPageStack.filename = '';
390- }
391-
392- // New
393- if (QmlJs.url_starts_with(url, 'http://modified_new/')) {
394- if (url == 'http://modified_new/false') {
395- mainPageStack.filename = '';
396- mainPageStack.executeJavaScript("qml_file_new()");
397- }
398- else {
399- mainPageStack.saveAsOperation = 'new';
400- PopupUtils.open(ask4save);
401- }
402- }
403-
404- // Load
405- if (QmlJs.url_starts_with(url, 'http://modified_load/')) {
406- if (url == 'http://modified_load/false') {
407- mainPageStack.push(Qt.resolvedUrl("LoadFile.qml"))
408- }
409- else {
410- mainPageStack.saveAsOperation = 'load';
411- PopupUtils.open(ask4save);
412- }
413- }
414-
415- // New
416- if (QmlJs.url_starts_with(url, 'http://new/')) {
417- mainPageStack.filename = '';
418- }
419-
420- request.action = Oxide.NavigationRequest.ActionReject;
421- }
422- }
423- }
424-
425- }
426-
427- Component {
428- id: ask4save
429- Dialog {
430- id: dialogueAsk4Save
431- title: i18n.tr("Save file")
432- text: i18n.tr("Do you want to save the text?")
433- Button {
434- text: i18n.tr("Yes")
435- color: UbuntuColors.green
436- onClicked: {
437- PopupUtils.close(dialogueAsk4Save)
438- if (mainPageStack.filename) {
439- mainPageStack.executeJavaScript("qml_save_content(true)");
440- if (mainPageStack.saveAsOperation != 'new')
441- mainPageStack.push(Qt.resolvedUrl("LoadFile.qml"));
442- }
443- else {
444- if (mainPageStack.saveAsOperation == 'new')
445- mainPageStack.push(Qt.resolvedUrl("SaveAs.qml"), {"setNewDoc": true, "callLoadDoc": false, "mainFilename": mainPageStack.filename});
446- if (mainPageStack.saveAsOperation == 'load')
447- mainPageStack.push(Qt.resolvedUrl("SaveAs.qml"), {"setNewDoc": false, "callLoadDoc": true, "mainFilename": mainPageStack.filename});
448- }
449- }
450- }
451- Button {
452- text: i18n.tr("No")
453- color: UbuntuColors.red
454- onClicked: {
455- PopupUtils.close(dialogueAsk4Save);
456- mainPageStack.filename = '';
457- mainPageStack.executeJavaScript("qml_file_new()");
458- if (mainPageStack.saveAsOperation == 'load')
459- mainPageStack.push(Qt.resolvedUrl("LoadFile.qml"));
460- }
461- }
462- Button {
463- text: i18n.tr("Cancel")
464- onClicked: {
465- PopupUtils.close(dialogueAsk4Save);
466+
467+ AdaptivePageLayout {
468+ id: mainPageStack
469+
470+ property string filename: ''
471+ property string saveAsOperation: ''
472+
473+ property bool childPageOpened: false
474+
475+ anchors.fill: parent
476+ primaryPageSource: pageMain
477+ layouts: PageColumnsLayout {
478+ when: width > units.gu(100) && mainPageStack.childPageOpened
479+ // column #0
480+ PageColumn {
481+ fillWidth: true
482+ }
483+ // column #1
484+ PageColumn {
485+ minimumWidth: units.gu(30)
486+ maximumWidth: units.gu(60)
487+ preferredWidth: units.gu(42)
488+ }
489+ }
490+
491+ function executeJavaScript(code) {
492+ var req = webview.rootFrame.sendMessage("messaging://", "EXECUTE", {code: code});
493+ req.onerror = function (code, explanation) {
494+ console.log("Error " + code + ": " + explanation)
495+ }
496+ }
497+
498+
499+ Page {
500+ id: pageMain
501+
502+ onVisibleChanged: {
503+ if (visible) {
504+ webview.forceActiveFocus();
505+ }
506+ }
507+
508+ property bool btnsEnabled: false
509+
510+ header: PageHeader {
511+ id: pageHeader
512+ title: "uWriter"
513+ StyleHints {
514+ foregroundColor: '#ffffff'
515+ backgroundColor: '#ffb84f'
516+ dividerColor: UbuntuColors.slate
517+ }
518+ leadingActionBar {
519+ numberOfSlots: 1
520+ actions: [
521+ Action {
522+ id: actionSettings
523+ iconName: "navigation-menu"
524+ shortcut: "Ctrl+M"
525+ enabled: pageMain.btnsEnabled && !mainPageStack.childPageOpened
526+ text: i18n.tr("Menu")
527+ onTriggered: {
528+ Qt.inputMethod.hide();
529+ mainPageStack.childPageOpened = true;
530+ pageMain.pageStack.addPageToNextColumn(pageMain, Qt.resolvedUrl("Menu.qml"));
531+ }
532+ }
533+ ]
534+ }
535+ trailingActionBar {
536+ numberOfSlots: 5
537+ actions: [
538+ Action {
539+ id: actionSaveAs
540+ iconName: "save-as"
541+ enabled: pageMain.btnsEnabled
542+ text: i18n.tr("Save as")
543+ onTriggered: {
544+ mainPageStack.childPageOpened = true;
545+ pageMain.pageStack.addPageToNextColumn(pageMain, Qt.resolvedUrl("SaveAs.qml"), {"setNewDoc": false, "callLoadDoc": false, "mainFilename": mainPageStack.filename});
546+ }
547+ },
548+ Action {
549+ id: actionSave
550+ iconName: "save"
551+ shortcut: "Ctrl+S"
552+ enabled: pageMain.btnsEnabled
553+ text: i18n.tr("Save")
554+ onTriggered: {
555+ if (!mainPageStack.filename) {
556+ mainPageStack.childPageOpened = true;
557+ pageMain.pageStack.addPageToNextColumn(pageMain, Qt.resolvedUrl("SaveAs.qml"), {"setNewDoc": false, "callLoadDoc": false, "mainFilename": mainPageStack.filename});
558+ }
559+ else {
560+ mainPageStack.executeJavaScript("qml_save_content(false)");
561+ }
562+ }
563+ },
564+ Action {
565+ id: actionLoad
566+ iconName: "document-open"
567+ shortcut: "Ctrl+O"
568+ enabled: pageMain.btnsEnabled
569+ text: i18n.tr("Load")
570+ onTriggered: {
571+ mainPageStack.executeJavaScript("qml_query_modified('load')");
572+ }
573+ },
574+ Action {
575+ id: actionNew
576+ iconName: "note"
577+ shortcut: "Ctrl+N"
578+ enabled: pageMain.btnsEnabled
579+ text: i18n.tr("New")
580+ onTriggered: {
581+ mainPageStack.executeJavaScript("qml_query_modified('new')");
582+ }
583+ }
584+ ]
585+ }
586+ }
587+
588+ WebContext {
589+ id: webcontext
590+ userAgent: "Mozilla/5.0 (Linux; Android 5.0; Nexus 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.102 Mobile Safari/537.36"
591+ userScripts: [
592+ Oxide.UserScript {
593+ context: "messaging://"
594+ url: Qt.resolvedUrl("js/oxide.js")
595+ }
596+ ]
597+ }
598+
599+ WebView {
600+ id: webview
601+ anchors.top: pageHeader.bottom
602+ anchors.bottom: parent.bottom
603+ anchors.left: parent.left
604+ anchors.right: parent.right
605+ //anchors.fill: parent
606+ z: -6
607+ context: webcontext
608+ url: "../uwp/index.html"
609+ preferences.allowFileAccessFromFileUrls: true
610+ preferences.allowUniversalAccessFromFileUrls: true
611+ preferences.appCacheEnabled: true
612+ preferences.javascriptCanAccessClipboard: true
613+ preferences.javascriptEnabled: true
614+
615+ onLoadingStateChanged: {
616+ if (!loading && !mainPageStack.onLoadingExecuted) {
617+ pageMain.btnsEnabled = true;
618+ }
619+ }
620+
621+ onNavigationRequested:{
622+ var url = request.url.toString();
623+
624+ // Save
625+ if (QmlJs.url_starts_with(url, 'http://save/')) {
626+ var contentHTML = request.url.toString().replace(/^http:\/\/save\//,'');
627+ QmlJs.saveFile(mainPageStack.filename, contentHTML);
628+ }
629+
630+ // Save & New
631+ if (QmlJs.url_starts_with(url, 'http://save_and_new/')) {
632+ var contentHTML = request.url.toString().replace(/^http:\/\/save_and_new\//,'');
633+ QmlJs.saveFile(mainPageStack.filename, contentHTML);
634+ mainPageStack.filename = '';
635+ }
636+
637+ // New
638+ if (QmlJs.url_starts_with(url, 'http://modified_new/')) {
639+ if (url == 'http://modified_new/false') {
640+ mainPageStack.filename = '';
641+ mainPageStack.executeJavaScript("qml_file_new()");
642+ }
643+ else {
644+ mainPageStack.saveAsOperation = 'new';
645+ PopupUtils.open(ask4save);
646+ }
647+ }
648+
649+ // Load
650+ if (QmlJs.url_starts_with(url, 'http://modified_load/')) {
651+ if (url == 'http://modified_load/false') {
652+ mainPageStack.childPageOpened = true;
653+ pageMain.pageStack.addPageToNextColumn(pageMain, Qt.resolvedUrl("LoadFile.qml"));
654+ }
655+ else {
656+ mainPageStack.saveAsOperation = 'load';
657+ PopupUtils.open(ask4save);
658+ }
659+ }
660+
661+ // New
662+ if (QmlJs.url_starts_with(url, 'http://new/')) {
663+ mainPageStack.filename = '';
664+ }
665+
666+ request.action = Oxide.NavigationRequest.ActionReject;
667+ }
668+ }
669+ }
670+ }
671+
672+ Component {
673+ id: ask4save
674+ Dialog {
675+ id: dialogueAsk4Save
676+ title: i18n.tr("Save file")
677+ text: i18n.tr("Do you want to save the text?")
678+ Button {
679+ text: i18n.tr("Yes")
680+ color: UbuntuColors.green
681+ onClicked: {
682+ PopupUtils.close(dialogueAsk4Save)
683+ if (mainPageStack.filename) {
684+ mainPageStack.executeJavaScript("qml_save_content(true)");
685+ if (mainPageStack.saveAsOperation != 'new') {
686+ mainPageStack.childPageOpened = true;
687+ pageMain.pageStack.addPageToNextColumn(pageMain, Qt.resolvedUrl("LoadFile.qml"));
688+ }
689+ }
690+ else {
691+ if (mainPageStack.saveAsOperation == 'new') {
692+ mainPageStack.childPageOpened = true;
693+ pageMain.pageStack.addPageToNextColumn(pageMain, Qt.resolvedUrl("SaveAs.qml"), {"setNewDoc": true, "callLoadDoc": false, "mainFilename": mainPageStack.filename});
694+ }
695+ if (mainPageStack.saveAsOperation == 'load') {
696+ mainPageStack.childPageOpened = true;
697+ pageMain.pageStack.addPageToNextColumn(pageMain, Qt.resolvedUrl("SaveAs.qml"), {"setNewDoc": false, "callLoadDoc": true, "mainFilename": mainPageStack.filename});
698+ }
699+ }
700+ }
701+ }
702+ Button {
703+ text: i18n.tr("No")
704+ color: UbuntuColors.red
705+ onClicked: {
706+ PopupUtils.close(dialogueAsk4Save);
707+ mainPageStack.filename = '';
708+ mainPageStack.executeJavaScript("qml_file_new()");
709+ if (mainPageStack.saveAsOperation == 'load') {
710+ mainPageStack.childPageOpened = true;
711+ pageMain.pageStack.addPageToNextColumn(pageMain, Qt.resolvedUrl("LoadFile.qml"));
712+ }
713+ }
714+ }
715+ Button {
716+ text: i18n.tr("Cancel")
717+ onClicked: {
718+ PopupUtils.close(dialogueAsk4Save);
719+ }
720 }
721 }
722 }
723
724=== modified file 'qml/Menu.qml'
725--- qml/Menu.qml 2016-10-31 09:56:38 +0000
726+++ qml/Menu.qml 2016-11-07 18:43:00 +0000
727@@ -18,672 +18,782 @@
728 import Ubuntu.Components.ListItems 1.3 as ListItem
729 import Ubuntu.Components.Popups 1.3
730
731-MainView {
732- id: menuView
733- anchors.fill: parent
734- anchorToKeyboard: true
735-
736- Page {
737- id: pageMenu
738-
739- property bool expandLink: false
740- property bool expandImg: false
741- property bool expandTableCreate: false
742- property bool expandFind: false
743- property bool expandReplace: false
744-
745- header: PageHeader {
746- id: pageHeader
747- title: i18n.tr("Menu")
748- StyleHints {
749- foregroundColor: '#ffffff'
750- backgroundColor: '#ffb84f'
751- dividerColor: UbuntuColors.slate
752- }
753-
754- leadingActionBar {
755- numberOfSlots: 1
756- actions: [
757- Action {
758- id: actionSettings
759- iconName: "back"
760- text: i18n.tr("Back")
761- onTriggered: {
762- onClicked: mainPageStack.pop(pageMenu)
763- }
764- }
765- ]
766- }
767- trailingActionBar {
768- numberOfSlots: 1
769- actions: [
770- Action {
771- id: actionAbout
772- iconName: "info"
773- text: i18n.tr("About")
774- onTriggered: {
775- mainPageStack.push(Qt.resolvedUrl("About.qml"))
776- }
777- }
778- ]
779- }
780- }
781-
782- Flickable {
783- id: flickable
784- anchors.fill: parent
785- anchors.topMargin: units.gu(6)
786- contentHeight: expandingItem2.height + expandingItem3.height + expandingItem4.height + expandingItem5.height + expandingItem6.height + expandingItem7.height
787-
788- Column {
789- anchors { top:pageHeader.bottom; left: parent.left; right: parent.right }
790- clip: true
791-
792- ListItem.Expandable {
793- id: expandingItem4
794- expandedHeight: contentCol4.height + units.gu(1)
795- onClicked: {
796- expanded = !expanded;
797- }
798- Column {
799- id: contentCol4
800- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
801- Item {
802- anchors { left: parent.left; right: parent.right}
803- height: expandingItem4.collapsedHeight
804- Label {
805- anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter}
806- text: i18n.tr("Text")
807- }
808- }
809-
810- Label {
811- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
812- height: units.gu(4)
813- text: i18n.tr("Bold")
814- color: "#2a2a2a"
815- MouseArea {
816- anchors.fill: parent
817- onClicked: {
818- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('Bold')");
819- mainPageStack.pop(pageMenu);
820- }
821- }
822- }
823- Label {
824- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
825- height: units.gu(4)
826- text: i18n.tr("Italic")
827- color: "#2a2a2a"
828- MouseArea {
829- anchors.fill: parent
830- onClicked: {
831- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('Italic')");
832- mainPageStack.pop(pageMenu);
833- }
834- }
835- }
836- Label {
837- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
838- height: units.gu(4)
839- text: i18n.tr("Underline")
840- color: "#2a2a2a"
841- MouseArea {
842- anchors.fill: parent
843- onClicked: {
844- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('Underline')");
845- mainPageStack.pop(pageMenu);
846- }
847- }
848- }
849- Label {
850- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
851- height: units.gu(4)
852- text: i18n.tr("Strikethrough")
853- color: "#2a2a2a"
854- MouseArea {
855- anchors.fill: parent
856- onClicked: {
857- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('Strikethrough')");
858- mainPageStack.pop(pageMenu);
859- }
860- }
861- }
862- Label {
863- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
864- height: units.gu(4)
865- text: i18n.tr("Superscript")
866- color: "#2a2a2a"
867- MouseArea {
868- anchors.fill: parent
869- onClicked: {
870- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('Superscript')");
871- mainPageStack.pop(pageMenu);
872- }
873- }
874- }
875- Label {
876- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
877- height: units.gu(4)
878- text: i18n.tr("Subscript")
879- color: "#2a2a2a"
880- MouseArea {
881- anchors.fill: parent
882- onClicked: {
883- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('Subscript')");
884- mainPageStack.pop(pageMenu);
885- }
886- }
887- }
888- }
889- }
890-
891-
892- ListItem.Expandable {
893- id: expandingItem5
894- expandedHeight: contentCol5.height + units.gu(1)
895- onClicked: {
896- expanded = !expanded;
897- }
898- Column {
899- id: contentCol5
900- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
901- Item {
902- anchors { left: parent.left; right: parent.right}
903- height: expandingItem5.collapsedHeight
904- Label {
905- anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter}
906- text: i18n.tr("Alignment")
907- }
908- }
909-
910- Label {
911- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
912- height: units.gu(4)
913- text: i18n.tr("Left")
914- color: "#2a2a2a"
915- MouseArea {
916- anchors.fill: parent
917- onClicked: {
918- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('JustifyLeft')");
919- mainPageStack.pop(pageMenu);
920- }
921- }
922- }
923- Label {
924- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
925- height: units.gu(4)
926- text: i18n.tr("Center")
927- color: "#2a2a2a"
928- MouseArea {
929- anchors.fill: parent
930- onClicked: {
931- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('JustifyCenter')");
932- mainPageStack.pop(pageMenu);
933- }
934- }
935- }
936- Label {
937- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
938- height: units.gu(4)
939- text: i18n.tr("Right")
940- color: "#2a2a2a"
941- MouseArea {
942- anchors.fill: parent
943- onClicked: {
944- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('JustifyRight')");
945- mainPageStack.pop(pageMenu);
946- }
947- }
948- }
949- Label {
950- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
951- height: units.gu(4)
952- text: i18n.tr("Justify")
953- color: "#2a2a2a"
954- MouseArea {
955- anchors.fill: parent
956- onClicked: {
957- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('JustifyFull')");
958- mainPageStack.pop(pageMenu);
959- }
960- }
961- }
962- }
963- }
964-
965-
966-
967- ListItem.Expandable {
968- id: expandingItem6
969- expandedHeight: contentCol6.height + units.gu(1)
970- onClicked: {
971- expanded = !expanded;
972- }
973- Column {
974- id: contentCol6
975- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
976- Item {
977- anchors { left: parent.left; right: parent.right}
978- height: expandingItem6.collapsedHeight
979- Label {
980- anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter}
981- text: i18n.tr("Heading")
982- }
983- }
984-
985- Label {
986- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
987- height: units.gu(4)
988- text: i18n.tr("Heading 1")
989- color: "#2a2a2a"
990- MouseArea {
991- anchors.fill: parent
992- onClicked: {
993- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('FormatBlock', false, 'h1')");
994- mainPageStack.pop(pageMenu);
995- }
996- }
997- }
998- Label {
999- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1000- height: units.gu(4)
1001- text: i18n.tr("Heading 2")
1002- color: "#2a2a2a"
1003- MouseArea {
1004- anchors.fill: parent
1005- onClicked: {
1006- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('FormatBlock', false, 'h2')");
1007- mainPageStack.pop(pageMenu);
1008- }
1009- }
1010- }
1011- Label {
1012- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1013- height: units.gu(4)
1014- text: i18n.tr("Heading 3")
1015- color: "#2a2a2a"
1016- MouseArea {
1017- anchors.fill: parent
1018- onClicked: {
1019- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('FormatBlock', false, 'h3')");
1020- mainPageStack.pop(pageMenu);
1021- }
1022- }
1023- }
1024- Label {
1025- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1026- height: units.gu(4)
1027- text: i18n.tr("Heading 4")
1028- color: "#2a2a2a"
1029- MouseArea {
1030- anchors.fill: parent
1031- onClicked: {
1032- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('FormatBlock', false, 'h4')");
1033- mainPageStack.pop(pageMenu);
1034- }
1035- }
1036- }
1037- Label {
1038- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1039- height: units.gu(4)
1040- text: i18n.tr("Heading 5")
1041- color: "#2a2a2a"
1042- MouseArea {
1043- anchors.fill: parent
1044- onClicked: {
1045- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('FormatBlock', false, 'h5')");
1046- mainPageStack.pop(pageMenu);
1047- }
1048- }
1049- }
1050- Label {
1051- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1052- height: units.gu(4)
1053- text: i18n.tr("Heading 6")
1054- color: "#2a2a2a"
1055- MouseArea {
1056- anchors.fill: parent
1057- onClicked: {
1058- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('FormatBlock', false, 'h6')");
1059- mainPageStack.pop(pageMenu);
1060- }
1061- }
1062- }
1063- }
1064- }
1065-
1066- ListItem.Expandable {
1067- id: expandingItem2
1068- expandedHeight: contentCol2.height + units.gu(1)
1069- onClicked: {
1070- expanded = !expanded;
1071- }
1072- Column {
1073- id: contentCol2
1074- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1075- Item {
1076- anchors { left: parent.left; right: parent.right}
1077- height: expandingItem2.collapsedHeight
1078- Label {
1079- anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter}
1080- text: i18n.tr("Edit")
1081- }
1082- }
1083-
1084- Label {
1085- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1086- height: units.gu(4)
1087- text: i18n.tr("Cut")
1088- color: "#2a2a2a"
1089- MouseArea {
1090- anchors.fill: parent
1091- onClicked: {
1092- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('Cut')");
1093- mainPageStack.pop(pageMenu);
1094- }
1095- }
1096- }
1097- Label {
1098- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1099- height: units.gu(4)
1100- text: i18n.tr("Copy")
1101- color: "#2a2a2a"
1102- MouseArea {
1103- anchors.fill: parent
1104- onClicked: {
1105- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('Copy')");
1106- mainPageStack.pop(pageMenu);
1107- }
1108- }
1109- }
1110- Label {
1111- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1112- height: units.gu(4)
1113- text: i18n.tr("Select all")
1114- color: "#2a2a2a"
1115- MouseArea {
1116- anchors.fill: parent
1117- onClicked: {
1118- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('selectAll')");
1119- mainPageStack.pop(pageMenu);
1120- }
1121- }
1122- }
1123- Label {
1124- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1125- height: units.gu(4)
1126- text: i18n.tr("Replace…")
1127- color: "#2a2a2a"
1128- MouseArea {
1129- anchors.fill: parent
1130- onClicked: {
1131- pageMenu.expandReplace = !pageMenu.expandReplace;
1132- }
1133- }
1134- }
1135- Row {
1136- spacing: units.gu(1)
1137- anchors { left: parent.left; leftMargin: units.gu(3);}
1138- visible: pageMenu.expandReplace
1139- height: units.gu(6)
1140- TextField {
1141- id: fieldFind2Replace
1142- width: (contentCol2.width - btn1ContentCol2.width)/2 - units.gu(5)
1143- hasClearButton: true
1144- placeholderText: i18n.tr("Search")
1145- }
1146- TextField {
1147- id: fieldReplace
1148- width: (contentCol2.width - btn1ContentCol2.width)/2 - units.gu(5)
1149- hasClearButton: true
1150- placeholderText: i18n.tr("Replace")
1151- }
1152- Button {
1153- id: btn1ContentCol2
1154- anchors { left: fieldReplace.right + units.gu(1); }
1155- text: i18n.tr("Replace")
1156- enabled: fieldFind2Replace.text && fieldReplace.text
1157- color: UbuntuColors.green
1158- onClicked: {
1159- mainPageStack.executeJavaScript("tinyMCE.get('wp').setContent(tinyMCE.get('wp').getContent().replace(/" + fieldFind2Replace.text + "/g, \"" + fieldReplace.text + "\"))");
1160- mainPageStack.pop(pageMenu);
1161- }
1162- }
1163- }
1164- }
1165- }
1166-
1167- ListItem.Expandable {
1168- id: expandingItem3
1169- expandedHeight: contentCol3.height + units.gu(1)
1170- onClicked: {
1171- expanded = !expanded;
1172- }
1173- Column {
1174- id: contentCol3
1175- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1176- Item {
1177- anchors { left: parent.left; right: parent.right}
1178- height: expandingItem3.collapsedHeight
1179- Label {
1180- anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter}
1181- text: i18n.tr("Insert")
1182- }
1183- }
1184-
1185- Label {
1186- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1187- height: units.gu(4)
1188- text: i18n.tr("Horizontal line")
1189- color: "#2a2a2a"
1190- MouseArea {
1191- anchors.fill: parent
1192- onClicked: {
1193- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<hr>')");
1194- mainPageStack.pop(pageMenu);
1195- }
1196- }
1197- }
1198- Label {
1199- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1200- height: units.gu(4)
1201- text: i18n.tr("Current date")
1202- color: "#2a2a2a"
1203- MouseArea {
1204- anchors.fill: parent
1205- onClicked: {
1206- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('mceInsertDate')");
1207- mainPageStack.pop(pageMenu);
1208- }
1209- }
1210- }
1211- Label {
1212- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1213- height: units.gu(4)
1214- text: i18n.tr("Current time")
1215- color: "#2a2a2a"
1216- MouseArea {
1217- anchors.fill: parent
1218- onClicked: {
1219- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('mceInsertTime')");
1220- mainPageStack.pop(pageMenu);
1221- }
1222- }
1223- }
1224- Label {
1225- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1226- height: units.gu(4)
1227- text: i18n.tr("Image…")
1228- color: "#2a2a2a"
1229- MouseArea {
1230- anchors.fill: parent
1231- onClicked: {
1232- pageMenu.expandImg = !pageMenu.expandImg
1233- }
1234- }
1235- }
1236- Row {
1237- spacing: units.gu(1)
1238- anchors { left: parent.left; leftMargin: units.gu(3);right: parent.right}
1239- visible: pageMenu.expandImg
1240- height: units.gu(6)
1241- TextField {
1242- id: fieldImg
1243- width: contentCol3.width - btn1ContentCol3.width - units.gu(5)
1244- hasClearButton: true
1245- placeholderText: i18n.tr("Image link")
1246- }
1247- Button {
1248- id: btn1ContentCol3
1249- anchors { left: fieldImg.right + units.gu(1); }
1250- text: i18n.tr("Load")
1251- enabled: fieldImg.text.trim()
1252- color: UbuntuColors.green
1253- onClicked: {
1254- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<img src=\"" + fieldImg.text.trim() + "\">')");
1255- mainPageStack.pop(pageMenu);
1256- }
1257- }
1258- }
1259- Label {
1260- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1261- height: units.gu(4)
1262- text: i18n.tr("Link…")
1263- color: "#2a2a2a"
1264- MouseArea {
1265- anchors.fill: parent
1266- onClicked: {
1267- pageMenu.expandLink = !pageMenu.expandLink;
1268- }
1269- }
1270- }
1271- Row {
1272- spacing: units.gu(1)
1273- anchors { left: parent.left; leftMargin: units.gu(3); }
1274- visible: pageMenu.expandLink
1275- height: units.gu(6)
1276- TextField {
1277- id: fieldLink
1278- width: contentCol3.width - btn2ContentCol3.width - units.gu(5)
1279- hasClearButton: true
1280- placeholderText: i18n.tr("URL (empty = remove)")
1281- }
1282- Button {
1283- id: btn2ContentCol3
1284- anchors.leftMargin: units.gu(0.2)
1285- text: i18n.tr("Set")
1286- color: UbuntuColors.green
1287- onClicked: {
1288- if (!fieldLink.text.trim()) {
1289- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('Unlink')");
1290- }
1291- else {
1292- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('mceInsertLink', false, '" + fieldLink.text.trim() + "')");
1293- }
1294- mainPageStack.pop(pageMenu);
1295- }
1296- }
1297- }
1298- }
1299- }
1300-
1301- ListItem.Expandable {
1302- id: expandingItem7
1303- expandedHeight: contentCol7.height + units.gu(1)
1304- onClicked: {
1305- expanded = !expanded;
1306- }
1307- Column {
1308- id: contentCol7
1309- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1310- Item {
1311- anchors { left: parent.left; right: parent.right}
1312- height: expandingItem7.collapsedHeight
1313- Label {
1314- anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter}
1315- text: i18n.tr("Table")
1316- }
1317- }
1318-
1319- Label {
1320- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1321- height: units.gu(4)
1322- text: i18n.tr("Insert…")
1323- color: "#2a2a2a"
1324- MouseArea {
1325- anchors.fill: parent
1326- onClicked: {
1327- pageMenu.expandTableCreate = !pageMenu.expandTableCreate
1328- }
1329- }
1330- }
1331- Row {
1332- spacing: units.gu(1)
1333- anchors { left: parent.left; leftMargin: units.gu(3);}
1334- visible: pageMenu.expandTableCreate
1335- height: units.gu(6)
1336- TextField {
1337- id: fieldRows
1338- validator: IntValidator{bottom: 1; top: 50;}
1339- inputMethodHints: Qt.ImhDialableCharactersOnly
1340- hasClearButton: false
1341- width: units.gu(7)
1342- placeholderText: i18n.tr("Rows")
1343- }
1344- Label {
1345- text: " x "
1346- }
1347- TextField {
1348- id: fieldCols
1349- validator: IntValidator{bottom: 1; top: 10;}
1350- inputMethodHints: Qt.ImhDialableCharactersOnly
1351- hasClearButton: false
1352- width: units.gu(7)
1353- placeholderText: i18n.tr("Cols")
1354- }
1355- Button {
1356- anchors { left: fieldImg.right + units.gu(1); }
1357- text: i18n.tr("Create")
1358- enabled: (fieldRows.text && fieldCols.text)
1359- color: UbuntuColors.green
1360- onClicked: {
1361- var grid_table = "";
1362- var r = 1;
1363- var c = 1;
1364- while (r <= parseInt(fieldRows.text)) {
1365- c = 1;
1366- grid_table = grid_table + "<tr>";
1367- while (c <= parseInt(fieldCols.text)) {
1368- grid_table = grid_table + "<td>&nbsp;</td>";
1369- c++;
1370- }
1371- grid_table = grid_table + "</tr>";
1372- r++;
1373- }
1374- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<table width=\"100%\"><tbody>" + grid_table + "</tbody></table>')");
1375- mainPageStack.pop(pageMenu);
1376- }
1377- }
1378- }
1379- Label {
1380- anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1381- height: units.gu(4)
1382- text: i18n.tr("Delete")
1383- color: "#2a2a2a"
1384- MouseArea {
1385- anchors.fill: parent
1386- onClicked: {
1387- mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('mceTableDelete')");
1388- mainPageStack.pop(pageMenu);
1389- }
1390- }
1391- }
1392- }
1393- }
1394-
1395- }
1396- }
1397-
1398+Page {
1399+ id: pageMenu
1400+
1401+ property bool expandLink: false
1402+ property bool expandImg: false
1403+ property bool expandTableCreate: false
1404+ property bool expandFind: false
1405+ property bool expandReplace: false
1406+
1407+ header: PageHeader {
1408+ id: pageHeader
1409+ title: i18n.tr("Menu")
1410+ StyleHints {
1411+ foregroundColor: '#ffffff'
1412+ backgroundColor: '#ffb84f'
1413+ dividerColor: UbuntuColors.slate
1414+ }
1415+
1416+ leadingActionBar {
1417+ numberOfSlots: 1
1418+ actions: [
1419+ Action {
1420+ id: actionSettings
1421+ iconName: "back"
1422+ text: i18n.tr("Back")
1423+ onTriggered: {
1424+ onClicked: {
1425+ mainPageStack.childPageOpened = false;
1426+ mainPageStack.removePages(pageMenu);
1427+ }
1428+ }
1429+ }
1430+ ]
1431+ }
1432+ trailingActionBar {
1433+ numberOfSlots: 1
1434+ actions: [
1435+ Action {
1436+ id: actionAbout
1437+ iconName: "info"
1438+ text: i18n.tr("About")
1439+ onTriggered: {
1440+ pageMain.pageStack.addPageToNextColumn(pageMain, Qt.resolvedUrl("About.qml"));
1441+ mainPageStack.removePages(pageMenu);
1442+ }
1443+ }
1444+ ]
1445+ }
1446+ }
1447+
1448+ Flickable {
1449+ id: flickable
1450+ anchors.fill: parent
1451+ anchors.topMargin: units.gu(6)
1452+ contentHeight: expandingItem2.height + expandingItem3.height + expandingItem4.height + expandingItem5.height + expandingItem6.height + expandingItem7.height
1453+
1454+ Column {
1455+ anchors { top:pageHeader.bottom; left: parent.left; right: parent.right }
1456+ clip: true
1457+
1458+ ListItem.Expandable {
1459+ id: expandingItem2
1460+ expandedHeight: contentCol2.height + units.gu(1)
1461+ onClicked: {
1462+ expanded = !expanded;
1463+ }
1464+ Column {
1465+ id: contentCol2
1466+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1467+ Item {
1468+ anchors { left: parent.left; right: parent.right}
1469+ height: expandingItem2.collapsedHeight
1470+ Label {
1471+ anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter}
1472+ text: i18n.tr("Edit")
1473+ }
1474+ }
1475+
1476+ Label {
1477+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1478+ height: units.gu(4)
1479+ text: i18n.tr("Cut")
1480+ color: "#2a2a2a"
1481+ MouseArea {
1482+ anchors.fill: parent
1483+ onClicked: {
1484+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('Cut')");
1485+ if (mainPageStack.columns === 1) {
1486+ mainPageStack.childPageOpened = false;
1487+ mainPageStack.removePages(pageMenu);
1488+ }
1489+
1490+ }
1491+ }
1492+ }
1493+ Label {
1494+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1495+ height: units.gu(4)
1496+ text: i18n.tr("Copy")
1497+ color: "#2a2a2a"
1498+ MouseArea {
1499+ anchors.fill: parent
1500+ onClicked: {
1501+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('Copy')");
1502+ if (mainPageStack.columns === 1) {
1503+ mainPageStack.childPageOpened = false;
1504+ mainPageStack.removePages(pageMenu);
1505+ }
1506+
1507+ }
1508+ }
1509+ }
1510+ Label {
1511+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1512+ height: units.gu(4)
1513+ text: i18n.tr("Select all")
1514+ color: "#2a2a2a"
1515+ MouseArea {
1516+ anchors.fill: parent
1517+ onClicked: {
1518+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('selectAll')");
1519+ if (mainPageStack.columns === 1) {
1520+ mainPageStack.childPageOpened = false;
1521+ mainPageStack.removePages(pageMenu);
1522+ }
1523+
1524+ }
1525+ }
1526+ }
1527+ Label {
1528+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1529+ height: units.gu(4)
1530+ text: i18n.tr("Replace…")
1531+ color: "#2a2a2a"
1532+ MouseArea {
1533+ anchors.fill: parent
1534+ onClicked: {
1535+ pageMenu.expandReplace = !pageMenu.expandReplace;
1536+ }
1537+ }
1538+ }
1539+ Row {
1540+ spacing: units.gu(1)
1541+ anchors { left: parent.left; leftMargin: units.gu(3);}
1542+ visible: pageMenu.expandReplace
1543+ height: units.gu(6)
1544+ TextField {
1545+ id: fieldFind2Replace
1546+ width: (contentCol2.width - btn1ContentCol2.width)/2 - units.gu(5)
1547+ hasClearButton: true
1548+ placeholderText: i18n.tr("Search")
1549+ }
1550+ TextField {
1551+ id: fieldReplace
1552+ width: (contentCol2.width - btn1ContentCol2.width)/2 - units.gu(5)
1553+ hasClearButton: true
1554+ placeholderText: i18n.tr("Replace")
1555+ }
1556+ Button {
1557+ id: btn1ContentCol2
1558+ anchors { left: fieldReplace.right + units.gu(1); }
1559+ text: i18n.tr("Replace")
1560+ enabled: fieldFind2Replace.text && fieldReplace.text
1561+ color: UbuntuColors.green
1562+ onClicked: {
1563+ mainPageStack.executeJavaScript("tinyMCE.get('wp').setContent(tinyMCE.get('wp').getContent().replace(/" + fieldFind2Replace.text + "/g, \"" + fieldReplace.text + "\"))");
1564+ if (mainPageStack.columns === 1) {
1565+ mainPageStack.childPageOpened = false;
1566+ mainPageStack.removePages(pageMenu);
1567+ }
1568+
1569+ }
1570+ }
1571+ }
1572+ }
1573+ }
1574+
1575+ ListItem.Expandable {
1576+ id: expandingItem3
1577+ expandedHeight: contentCol3.height + units.gu(1)
1578+ onClicked: {
1579+ expanded = !expanded;
1580+ }
1581+ Column {
1582+ id: contentCol3
1583+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1584+ Item {
1585+ anchors { left: parent.left; right: parent.right}
1586+ height: expandingItem3.collapsedHeight
1587+ Label {
1588+ anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter}
1589+ text: i18n.tr("Insert")
1590+ }
1591+ }
1592+
1593+ Label {
1594+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1595+ height: units.gu(4)
1596+ text: i18n.tr("Horizontal line")
1597+ color: "#2a2a2a"
1598+ MouseArea {
1599+ anchors.fill: parent
1600+ onClicked: {
1601+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<hr>')");
1602+ if (mainPageStack.columns === 1) {
1603+ mainPageStack.childPageOpened = false;
1604+ mainPageStack.removePages(pageMenu);
1605+ }
1606+
1607+ }
1608+ }
1609+ }
1610+ Label {
1611+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1612+ height: units.gu(4)
1613+ text: i18n.tr("Current date")
1614+ color: "#2a2a2a"
1615+ MouseArea {
1616+ anchors.fill: parent
1617+ onClicked: {
1618+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('mceInsertDate')");
1619+ if (mainPageStack.columns === 1) {
1620+ mainPageStack.childPageOpened = false;
1621+ mainPageStack.removePages(pageMenu);
1622+ }
1623+
1624+ }
1625+ }
1626+ }
1627+ Label {
1628+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1629+ height: units.gu(4)
1630+ text: i18n.tr("Current time")
1631+ color: "#2a2a2a"
1632+ MouseArea {
1633+ anchors.fill: parent
1634+ onClicked: {
1635+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('mceInsertTime')");
1636+ if (mainPageStack.columns === 1) {
1637+ mainPageStack.childPageOpened = false;
1638+ mainPageStack.removePages(pageMenu);
1639+ }
1640+
1641+ }
1642+ }
1643+ }
1644+ Label {
1645+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1646+ height: units.gu(4)
1647+ text: i18n.tr("Image…")
1648+ color: "#2a2a2a"
1649+ MouseArea {
1650+ anchors.fill: parent
1651+ onClicked: {
1652+ pageMenu.expandImg = !pageMenu.expandImg
1653+ }
1654+ }
1655+ }
1656+ Row {
1657+ spacing: units.gu(1)
1658+ anchors { left: parent.left; leftMargin: units.gu(3);right: parent.right}
1659+ visible: pageMenu.expandImg
1660+ height: units.gu(6)
1661+ TextField {
1662+ id: fieldImg
1663+ width: contentCol3.width - btn1ContentCol3.width - units.gu(5)
1664+ hasClearButton: true
1665+ placeholderText: i18n.tr("Image link")
1666+ }
1667+ Button {
1668+ id: btn1ContentCol3
1669+ anchors { left: fieldImg.right + units.gu(1); }
1670+ text: i18n.tr("Load")
1671+ enabled: fieldImg.text.trim()
1672+ color: UbuntuColors.green
1673+ onClicked: {
1674+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<img src=\"" + fieldImg.text.trim() + "\">')");
1675+ if (mainPageStack.columns === 1) {
1676+ mainPageStack.childPageOpened = false;
1677+ mainPageStack.removePages(pageMenu);
1678+ }
1679+
1680+ }
1681+ }
1682+ }
1683+ Label {
1684+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1685+ height: units.gu(4)
1686+ text: i18n.tr("Link…")
1687+ color: "#2a2a2a"
1688+ MouseArea {
1689+ anchors.fill: parent
1690+ onClicked: {
1691+ pageMenu.expandLink = !pageMenu.expandLink;
1692+ }
1693+ }
1694+ }
1695+ Row {
1696+ spacing: units.gu(1)
1697+ anchors { left: parent.left; leftMargin: units.gu(3); }
1698+ visible: pageMenu.expandLink
1699+ height: units.gu(6)
1700+ TextField {
1701+ id: fieldLink
1702+ width: contentCol3.width - btn2ContentCol3.width - units.gu(5)
1703+ hasClearButton: true
1704+ placeholderText: i18n.tr("URL (empty = remove)")
1705+ }
1706+ Button {
1707+ id: btn2ContentCol3
1708+ anchors.leftMargin: units.gu(0.2)
1709+ text: i18n.tr("Set")
1710+ color: UbuntuColors.green
1711+ onClicked: {
1712+ if (!fieldLink.text.trim()) {
1713+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('Unlink')");
1714+ }
1715+ else {
1716+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('mceInsertLink', false, '" + fieldLink.text.trim() + "')");
1717+ }
1718+ if (mainPageStack.columns === 1) {
1719+ mainPageStack.childPageOpened = false;
1720+ mainPageStack.removePages(pageMenu);
1721+ }
1722+
1723+ }
1724+ }
1725+ }
1726+ }
1727+ }
1728+
1729+ ListItem.Expandable {
1730+ id: expandingItem7
1731+ expandedHeight: contentCol7.height + units.gu(1)
1732+ onClicked: {
1733+ expanded = !expanded;
1734+ }
1735+ Column {
1736+ id: contentCol7
1737+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1738+ Item {
1739+ anchors { left: parent.left; right: parent.right}
1740+ height: expandingItem7.collapsedHeight
1741+ Label {
1742+ anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter}
1743+ text: i18n.tr("Table")
1744+ }
1745+ }
1746+
1747+ Label {
1748+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1749+ height: units.gu(4)
1750+ text: i18n.tr("Insert…")
1751+ color: "#2a2a2a"
1752+ MouseArea {
1753+ anchors.fill: parent
1754+ onClicked: {
1755+ pageMenu.expandTableCreate = !pageMenu.expandTableCreate
1756+ }
1757+ }
1758+ }
1759+ Row {
1760+ spacing: units.gu(1)
1761+ anchors { left: parent.left; leftMargin: units.gu(3);}
1762+ visible: pageMenu.expandTableCreate
1763+ height: units.gu(6)
1764+ TextField {
1765+ id: fieldRows
1766+ validator: IntValidator{bottom: 1; top: 50;}
1767+ inputMethodHints: Qt.ImhDialableCharactersOnly
1768+ hasClearButton: false
1769+ width: units.gu(7)
1770+ placeholderText: i18n.tr("Rows")
1771+ }
1772+ Label {
1773+ text: "x"
1774+ height: units.gu(4)
1775+ verticalAlignment: Text.AlignVCenter
1776+ }
1777+ TextField {
1778+ id: fieldCols
1779+ validator: IntValidator{bottom: 1; top: 10;}
1780+ inputMethodHints: Qt.ImhDialableCharactersOnly
1781+ hasClearButton: false
1782+ width: units.gu(7)
1783+ placeholderText: i18n.tr("Cols")
1784+ }
1785+ Button {
1786+ anchors { left: fieldImg.right + units.gu(1); }
1787+ text: i18n.tr("Create")
1788+ enabled: (fieldRows.text && fieldCols.text)
1789+ color: UbuntuColors.green
1790+ onClicked: {
1791+ var grid_table = "";
1792+ var r = 1;
1793+ var c = 1;
1794+ while (r <= parseInt(fieldRows.text)) {
1795+ c = 1;
1796+ grid_table = grid_table + "<tr>";
1797+ while (c <= parseInt(fieldCols.text)) {
1798+ grid_table = grid_table + "<td>&nbsp;</td>";
1799+ c++;
1800+ }
1801+ grid_table = grid_table + "</tr>";
1802+ r++;
1803+ }
1804+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<table width=\"100%\"><tbody>" + grid_table + "</tbody></table>')");
1805+ if (mainPageStack.columns === 1) {
1806+ mainPageStack.childPageOpened = false;
1807+ mainPageStack.removePages(pageMenu);
1808+ }
1809+
1810+ }
1811+ }
1812+ }
1813+ Label {
1814+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1815+ height: units.gu(4)
1816+ text: i18n.tr("Delete")
1817+ color: "#2a2a2a"
1818+ MouseArea {
1819+ anchors.fill: parent
1820+ onClicked: {
1821+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('mceTableDelete')");
1822+ if (mainPageStack.columns === 1) {
1823+ mainPageStack.childPageOpened = false;
1824+ mainPageStack.removePages(pageMenu);
1825+ }
1826+
1827+ }
1828+ }
1829+ }
1830+ }
1831+ }
1832+
1833+ ListItem.Expandable {
1834+ id: expandingItem4
1835+ expandedHeight: contentCol4.height + units.gu(1)
1836+ onClicked: {
1837+ expanded = !expanded;
1838+ }
1839+ Column {
1840+ id: contentCol4
1841+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1842+ Item {
1843+ anchors { left: parent.left; right: parent.right}
1844+ height: expandingItem4.collapsedHeight
1845+ Label {
1846+ anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter}
1847+ text: i18n.tr("Text")
1848+ }
1849+ }
1850+
1851+ Label {
1852+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1853+ height: units.gu(4)
1854+ text: i18n.tr("Bold")
1855+ color: "#2a2a2a"
1856+ MouseArea {
1857+ anchors.fill: parent
1858+ onClicked: {
1859+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('Bold')");
1860+ if (mainPageStack.columns === 1) {
1861+ mainPageStack.childPageOpened = false;
1862+ if (mainPageStack.columns === 1) {
1863+ mainPageStack.childPageOpened = false;
1864+ mainPageStack.removePages(pageMenu);
1865+ }
1866+
1867+ }
1868+ }
1869+ }
1870+ }
1871+ Label {
1872+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1873+ height: units.gu(4)
1874+ text: i18n.tr("Italic")
1875+ color: "#2a2a2a"
1876+ MouseArea {
1877+ anchors.fill: parent
1878+ onClicked: {
1879+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('Italic')");
1880+ if (mainPageStack.columns === 1) {
1881+ mainPageStack.childPageOpened = false;
1882+ mainPageStack.removePages(pageMenu);
1883+ }
1884+
1885+ }
1886+ }
1887+ }
1888+ Label {
1889+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1890+ height: units.gu(4)
1891+ text: i18n.tr("Underline")
1892+ color: "#2a2a2a"
1893+ MouseArea {
1894+ anchors.fill: parent
1895+ onClicked: {
1896+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('Underline')");
1897+ if (mainPageStack.columns === 1) {
1898+ mainPageStack.childPageOpened = false;
1899+ mainPageStack.removePages(pageMenu);
1900+ }
1901+
1902+ }
1903+ }
1904+ }
1905+ Label {
1906+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1907+ height: units.gu(4)
1908+ text: i18n.tr("Strikethrough")
1909+ color: "#2a2a2a"
1910+ MouseArea {
1911+ anchors.fill: parent
1912+ onClicked: {
1913+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('Strikethrough')");
1914+ if (mainPageStack.columns === 1) {
1915+ mainPageStack.childPageOpened = false;
1916+ mainPageStack.removePages(pageMenu);
1917+ }
1918+
1919+ }
1920+ }
1921+ }
1922+ Label {
1923+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1924+ height: units.gu(4)
1925+ text: i18n.tr("Superscript")
1926+ color: "#2a2a2a"
1927+ MouseArea {
1928+ anchors.fill: parent
1929+ onClicked: {
1930+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('Superscript')");
1931+ if (mainPageStack.columns === 1) {
1932+ mainPageStack.childPageOpened = false;
1933+ mainPageStack.removePages(pageMenu);
1934+ }
1935+
1936+ }
1937+ }
1938+ }
1939+ Label {
1940+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1941+ height: units.gu(4)
1942+ text: i18n.tr("Subscript")
1943+ color: "#2a2a2a"
1944+ MouseArea {
1945+ anchors.fill: parent
1946+ onClicked: {
1947+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('Subscript')");
1948+ if (mainPageStack.columns === 1) {
1949+ mainPageStack.childPageOpened = false;
1950+ mainPageStack.removePages(pageMenu);
1951+ }
1952+
1953+ }
1954+ }
1955+ }
1956+ }
1957+ }
1958+
1959+
1960+ ListItem.Expandable {
1961+ id: expandingItem5
1962+ expandedHeight: contentCol5.height + units.gu(1)
1963+ onClicked: {
1964+ expanded = !expanded;
1965+ }
1966+ Column {
1967+ id: contentCol5
1968+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1969+ Item {
1970+ anchors { left: parent.left; right: parent.right}
1971+ height: expandingItem5.collapsedHeight
1972+ Label {
1973+ anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter}
1974+ text: i18n.tr("Alignment")
1975+ }
1976+ }
1977+
1978+ Label {
1979+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1980+ height: units.gu(4)
1981+ text: i18n.tr("Left")
1982+ color: "#2a2a2a"
1983+ MouseArea {
1984+ anchors.fill: parent
1985+ onClicked: {
1986+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('JustifyLeft')");
1987+ if (mainPageStack.columns === 1) {
1988+ mainPageStack.childPageOpened = false;
1989+ mainPageStack.removePages(pageMenu);
1990+ }
1991+
1992+ }
1993+ }
1994+ }
1995+ Label {
1996+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
1997+ height: units.gu(4)
1998+ text: i18n.tr("Center")
1999+ color: "#2a2a2a"
2000+ MouseArea {
2001+ anchors.fill: parent
2002+ onClicked: {
2003+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('JustifyCenter')");
2004+ if (mainPageStack.columns === 1) {
2005+ mainPageStack.childPageOpened = false;
2006+ mainPageStack.removePages(pageMenu);
2007+ }
2008+
2009+ }
2010+ }
2011+ }
2012+ Label {
2013+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
2014+ height: units.gu(4)
2015+ text: i18n.tr("Right")
2016+ color: "#2a2a2a"
2017+ MouseArea {
2018+ anchors.fill: parent
2019+ onClicked: {
2020+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('JustifyRight')");
2021+ if (mainPageStack.columns === 1) {
2022+ mainPageStack.childPageOpened = false;
2023+ mainPageStack.removePages(pageMenu);
2024+ }
2025+
2026+ }
2027+ }
2028+ }
2029+ Label {
2030+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
2031+ height: units.gu(4)
2032+ text: i18n.tr("Justify")
2033+ color: "#2a2a2a"
2034+ MouseArea {
2035+ anchors.fill: parent
2036+ onClicked: {
2037+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('JustifyFull')");
2038+ if (mainPageStack.columns === 1) {
2039+ mainPageStack.childPageOpened = false;
2040+ mainPageStack.removePages(pageMenu);
2041+ }
2042+
2043+ }
2044+ }
2045+ }
2046+ }
2047+ }
2048+
2049+
2050+
2051+ ListItem.Expandable {
2052+ id: expandingItem6
2053+ expandedHeight: contentCol6.height + units.gu(1)
2054+ onClicked: {
2055+ expanded = !expanded;
2056+ }
2057+ Column {
2058+ id: contentCol6
2059+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
2060+ Item {
2061+ anchors { left: parent.left; right: parent.right}
2062+ height: expandingItem6.collapsedHeight
2063+ Label {
2064+ anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter}
2065+ text: i18n.tr("Heading")
2066+ }
2067+ }
2068+
2069+ Label {
2070+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
2071+ height: units.gu(4)
2072+ text: i18n.tr("Heading 1")
2073+ color: "#2a2a2a"
2074+ MouseArea {
2075+ anchors.fill: parent
2076+ onClicked: {
2077+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('FormatBlock', false, 'h1')");
2078+ if (mainPageStack.columns === 1) {
2079+ mainPageStack.childPageOpened = false;
2080+ mainPageStack.removePages(pageMenu);
2081+ }
2082+
2083+ }
2084+ }
2085+ }
2086+ Label {
2087+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
2088+ height: units.gu(4)
2089+ text: i18n.tr("Heading 2")
2090+ color: "#2a2a2a"
2091+ MouseArea {
2092+ anchors.fill: parent
2093+ onClicked: {
2094+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('FormatBlock', false, 'h2')");
2095+ if (mainPageStack.columns === 1) {
2096+ mainPageStack.childPageOpened = false;
2097+ mainPageStack.removePages(pageMenu);
2098+ }
2099+
2100+ }
2101+ }
2102+ }
2103+ Label {
2104+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
2105+ height: units.gu(4)
2106+ text: i18n.tr("Heading 3")
2107+ color: "#2a2a2a"
2108+ MouseArea {
2109+ anchors.fill: parent
2110+ onClicked: {
2111+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('FormatBlock', false, 'h3')");
2112+ if (mainPageStack.columns === 1) {
2113+ mainPageStack.childPageOpened = false;
2114+ mainPageStack.removePages(pageMenu);
2115+ }
2116+
2117+ }
2118+ }
2119+ }
2120+ Label {
2121+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
2122+ height: units.gu(4)
2123+ text: i18n.tr("Heading 4")
2124+ color: "#2a2a2a"
2125+ MouseArea {
2126+ anchors.fill: parent
2127+ onClicked: {
2128+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('FormatBlock', false, 'h4')");
2129+ if (mainPageStack.columns === 1) {
2130+ mainPageStack.childPageOpened = false;
2131+ mainPageStack.removePages(pageMenu);
2132+ }
2133+
2134+ }
2135+ }
2136+ }
2137+ Label {
2138+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
2139+ height: units.gu(4)
2140+ text: i18n.tr("Heading 5")
2141+ color: "#2a2a2a"
2142+ MouseArea {
2143+ anchors.fill: parent
2144+ onClicked: {
2145+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('FormatBlock', false, 'h5')");
2146+ if (mainPageStack.columns === 1) {
2147+ mainPageStack.childPageOpened = false;
2148+ mainPageStack.removePages(pageMenu);
2149+ }
2150+
2151+ }
2152+ }
2153+ }
2154+ Label {
2155+ anchors { left: parent.left; right: parent.right; leftMargin: units.gu(1); }
2156+ height: units.gu(4)
2157+ text: i18n.tr("Heading 6")
2158+ color: "#2a2a2a"
2159+ MouseArea {
2160+ anchors.fill: parent
2161+ onClicked: {
2162+ mainPageStack.executeJavaScript("tinyMCE.activeEditor.execCommand('FormatBlock', false, 'h6')");
2163+ if (mainPageStack.columns === 1) {
2164+ mainPageStack.childPageOpened = false;
2165+ mainPageStack.removePages(pageMenu);
2166+ }
2167+
2168+ }
2169+ }
2170+ }
2171+ }
2172+ }
2173+
2174+ }
2175 }
2176 }
2177
2178=== modified file 'qml/SaveAs.qml'
2179--- qml/SaveAs.qml 2016-10-31 09:29:17 +0000
2180+++ qml/SaveAs.qml 2016-11-07 18:43:00 +0000
2181@@ -22,86 +22,83 @@
2182 import "js/utils.js" as QmlJs
2183
2184
2185-MainView {
2186- id: menuLoadFiles
2187- anchors.fill: parent
2188-
2189+Page {
2190+ id: pageSaveAsFile
2191+
2192+ Component.onCompleted: {
2193+ PopupUtils.open(saveAs);
2194+ }
2195+
2196 property bool setNewDoc
2197 property bool callLoadDoc
2198 property string mainFilename
2199
2200- Component.onCompleted: {
2201- PopupUtils.open(saveAs);
2202- }
2203-
2204- Page {
2205- id: pageSaveAsFile
2206-
2207- property bool overwriteFileName: false
2208- property string fileName: menuLoadFiles.mainFilename
2209-
2210- header: PageHeader {
2211- id: pageHeader
2212- title: i18n.tr("Files")
2213- StyleHints {
2214- foregroundColor: '#ffffff'
2215- backgroundColor: '#ffb84f'
2216- dividerColor: UbuntuColors.slate
2217- }
2218-
2219- leadingActionBar {
2220- numberOfSlots: 1
2221- actions: [
2222- Action {
2223- id: actionSettings
2224- iconName: "back"
2225- text: i18n.tr("Back")
2226- onTriggered: {
2227- onClicked: mainPageStack.pop(pageSaveAsFile)
2228- }
2229+ property bool overwriteFileName: false
2230+ property string fileName: pageSaveAsFile.mainFilename
2231+
2232+ header: PageHeader {
2233+ id: pageHeader
2234+ title: i18n.tr("Files")
2235+ StyleHints {
2236+ foregroundColor: '#ffffff'
2237+ backgroundColor: '#ffb84f'
2238+ dividerColor: UbuntuColors.slate
2239+ }
2240+
2241+ leadingActionBar {
2242+ numberOfSlots: 1
2243+ actions: [
2244+ Action {
2245+ id: actionSettings
2246+ iconName: "back"
2247+ text: i18n.tr("Back")
2248+ onTriggered: {
2249+ mainPageStack.childPageOpened = false;
2250+ mainPageStack.removePages(pageSaveAsFile);
2251 }
2252- ]
2253- }
2254- }
2255-
2256- Label {
2257- id: lblNnoFiles
2258- width: parent.width - units.gu(4)
2259- anchors.centerIn: parent
2260- visible: folderModel.count === 0
2261- horizontalAlignment: Text.AlignHCenter
2262- wrapMode: Text.WordWrap
2263- text: i18n.tr("No files yet")
2264- }
2265-
2266- FolderListModel {
2267- id: folderModel
2268- folder: "/home/phablet/.local/share/uwp.costales"
2269- nameFilters: [ "*.html" ]
2270- showDirs: false
2271- }
2272-
2273- ListView {
2274- id: listView
2275- anchors.top: pageHeader.bottom
2276- anchors.bottom: parent.bottom
2277- anchors.left: parent.left
2278- anchors.right: parent.right
2279- model: folderModel
2280- delegate: ListItem.Standard {
2281- text: model.fileName
2282- onClicked: {
2283- mainPageStack.filename = model.fileName.replace(/.html$/,'');
2284- QmlJs.openFile(model.fileName);
2285- mainPageStack.pop(pageSaveAsFile);
2286 }
2287+ ]
2288+ }
2289+ }
2290+
2291+ Label {
2292+ id: lblNnoFiles
2293+ width: parent.width - units.gu(4)
2294+ anchors.centerIn: parent
2295+ visible: folderModel.count === 0
2296+ horizontalAlignment: Text.AlignHCenter
2297+ wrapMode: Text.WordWrap
2298+ text: i18n.tr("No files yet")
2299+ }
2300+
2301+ FolderListModel {
2302+ id: folderModel
2303+ folder: "/home/phablet/.local/share/uwp.costales"
2304+ nameFilters: [ "*.html" ]
2305+ showDirs: false
2306+ }
2307+
2308+ ListView {
2309+ id: listView
2310+ anchors.top: pageHeader.bottom
2311+ anchors.bottom: parent.bottom
2312+ anchors.left: parent.left
2313+ anchors.right: parent.right
2314+ model: folderModel
2315+ delegate: ListItem.Standard {
2316+ text: model.fileName
2317+ onClicked: {
2318+ mainPageStack.filename = model.fileName.replace(/.html$/,'');
2319+ QmlJs.openFile(model.fileName);
2320+ mainPageStack.childPageOpened = false;
2321+ mainPageStack.removePages(pageSaveAsFile);
2322 }
2323 }
2324 }
2325-
2326-
2327+
2328+
2329 Component {
2330- id: saveAs
2331+ id: saveAs
2332 Dialog {
2333 id: dialogueSaveAs
2334 title: i18n.tr("Save document")
2335@@ -140,9 +137,11 @@
2336 else {
2337 PopupUtils.close(dialogueSaveAs);
2338 mainPageStack.filename = pageSaveAsFile.fileName;
2339- mainPageStack.executeJavaScript("qml_save_content(" + menuLoadFiles.setNewDoc + ")");
2340- if (!menuLoadFiles.callLoadDoc)
2341- mainPageStack.pop(pageSaveAsFile);
2342+ mainPageStack.executeJavaScript("qml_save_content(" + pageSaveAsFile.setNewDoc + ")");
2343+ if (!pageSaveAsFile.callLoadDoc) {
2344+ mainPageStack.childPageOpened = false;
2345+ mainPageStack.removePages(pageSaveAsFile);
2346+ }
2347 }
2348 }
2349 }
2350@@ -150,7 +149,8 @@
2351 text: i18n.tr("Cancel")
2352 onClicked: {
2353 PopupUtils.close(dialogueSaveAs)
2354- mainPageStack.pop(pageSaveAsFile);
2355+ mainPageStack.childPageOpened = false;
2356+ mainPageStack.removePages(pageSaveAsFile);
2357 }
2358 }
2359 }
2360@@ -168,9 +168,11 @@
2361 onClicked: {
2362 PopupUtils.close(dialogueOverwrite)
2363 mainPageStack.filename = pageSaveAsFile.fileName;
2364- mainPageStack.executeJavaScript("qml_save_content(" + menuLoadFiles.setNewDoc + ")");
2365- if (!menuLoadFiles.callLoadDoc)
2366- mainPageStack.pop(pageSaveAsFile);
2367+ mainPageStack.executeJavaScript("qml_save_content(" + pageSaveAsFile.setNewDoc + ")");
2368+ if (!pageSaveAsFile.callLoadDoc) {
2369+ mainPageStack.childPageOpened = false;
2370+ mainPageStack.removePages(pageSaveAsFile);
2371+ }
2372 }
2373 }
2374 Button {
2375@@ -184,3 +186,5 @@
2376 }
2377
2378 }
2379+
2380+

Subscribers

People subscribed via source and target branches

to all changes: