diff --git a/components/mailviewer/qml/TextContent.qml b/components/mailviewer/qml/TextContent.qml index f0f0442d..d935e293 100644 --- a/components/mailviewer/qml/TextContent.qml +++ b/components/mailviewer/qml/TextContent.qml @@ -1,75 +1,61 @@ /* Copyright (C) 2016 Michael Bohlender, This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.7 import QtQuick.Controls 2 -import QtQuick.Templates 2.0 as T import org.kube.framework 1.0 as Kube Item { id: root property string content property bool embedded: true property string type property bool autoLoadImages: false property string searchString property int contentHeight: textEdit.height onSearchStringChanged: { //This is a workaround because otherwise the view will not take the ViewHighlighter changes into account. textEdit.text = root.content } - T.TextArea { + Kube.TextArea { id: textEdit anchors { top: parent.top left: parent.left right: parent.right } - implicitWidth: contentWidth - implicitHeight: contentHeight - selectionColor: Kube.Colors.highlightColor readOnly: true selectByMouse: true text: content.substring(0, 100000) //The TextEdit deals poorly with messages that are too large. - wrapMode: TextEdit.Wrap - textFormat: Text.RichText - - font.family: Kube.Font.fontFamily color: embedded ? Kube.Colors.disabledTextColor : Kube.Colors.textColor - onLinkActivated: Qt.openUrlExternally(link) - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.NoButton // we don't want to eat clicks on the Text - cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor - } Kube.ViewHighlighter { textDocument: textEdit.textDocument searchString: root.searchString } } } diff --git a/framework/qml/TextArea.qml b/framework/qml/TextArea.qml new file mode 100644 index 00000000..2798d5b1 --- /dev/null +++ b/framework/qml/TextArea.qml @@ -0,0 +1,47 @@ +/* + Copyright (C) 2019 Christian Mollekopf, + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +import QtQuick 2.7 +import QtQuick.Controls 2 +import QtQuick.Templates 2.0 as T + +import org.kube.framework 1.0 as Kube + +T.TextArea { + id: root + + implicitWidth: contentWidth + implicitHeight: contentHeight + + selectionColor: Kube.Colors.highlightColor + readOnly: true + selectByMouse: true + + wrapMode: TextEdit.Wrap + textFormat: Text.RichText + + font.family: Kube.Font.fontFamily + color: Kube.Colors.textColor + onLinkActivated: Qt.openUrlExternally(link) + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.NoButton // we don't want to eat clicks on the Text + cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor + } +} diff --git a/framework/qmldir b/framework/qmldir index 0ad4bd92..00615845 100644 --- a/framework/qmldir +++ b/framework/qmldir @@ -1,60 +1,61 @@ module org.kube.framework ConversationView 1.0 ConversationView.qml ConversationListView 1.0 ConversationListView.qml CalendarSelector 1.0 CalendarSelector.qml CalendarComboBox 1.0 CalendarComboBox.qml FolderListView 1.0 FolderListView.qml MailListView 1.0 MailListView.qml MailViewer 1.0 MailViewer.qml InlineAccountSwitcher 1.0 InlineAccountSwitcher.qml NewAccountDialog 1.0 NewAccountDialog.qml EditAccount 1.0 EditAccount.qml LoginAccount 1.0 LoginAccount.qml Outbox 1.0 Outbox.qml HelpPopup 1.0 HelpPopup.qml SearchPopup 1.0 SearchPopup.qml NotificationPopup 1.0 NotificationPopup.qml Icon 1.0 Icon.qml IconButton 1.0 IconButton.qml AbstractButton 1.0 AbstractButton.qml Button 1.0 Button.qml Popup 1.0 Popup.qml ProgressBar 1.0 ProgressBar.qml StatusBar 1.0 StatusBar.qml ComboBox 1.0 ComboBox.qml CheckBox 1.0 CheckBox.qml Switch 1.0 Switch.qml PositiveButton 1.0 PositiveButton.qml TextButton 1.0 TextButton.qml TextField 1.0 TextField.qml +TextArea 1.0 TextArea.qml RequiredTextField 1.0 RequiredTextField.qml PasswordField 1.0 PasswordField.qml TextEditor 1.0 TextEditor.qml HeaderField 1.0 HeaderField.qml ToolTip 1.0 ToolTip.qml Label 1.0 Label.qml ScrollBar 1.0 ScrollBar.qml SelectableLabel 1.0 SelectableLabel.qml SelectableItem 1.0 SelectableItem.qml ContextMenuOverlay 1.0 ContextMenuOverlay.qml Heading 1.0 Heading.qml View 1.0 View.qml AutocompleteLineEdit 1.0 AutocompleteLineEdit.qml AttachmentDelegate 1.0 AttachmentDelegate.qml DelegateBackground 1.0 DelegateBackground.qml ListView 1.0 ListView.qml ListDelegate 1.0 ListDelegate.qml TreeView 1.0 TreeView.qml GridView 1.0 GridView.qml ScrollHelper 1.0 ScrollHelper.qml ModelIndexRetriever 1.0 ModelIndexRetriever.qml ExtensionPoint 1.0 ExtensionPoint.qml singleton Messages 1.0 Messages.qml singleton Notifications 1.0 Notifications.qml singleton Colors 1.0 Colors.qml singleton Icons 1.0 Icons.qml singleton Units 1.0 Units.qml singleton Font 1.0 Font.qml plugin frameworkplugin diff --git a/views/calendar/qml/EventView.qml b/views/calendar/qml/EventView.qml index 6628ab7f..285802d6 100644 --- a/views/calendar/qml/EventView.qml +++ b/views/calendar/qml/EventView.qml @@ -1,128 +1,125 @@ /* * Copyright (C) 2018 Michael Bohlender, * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.4 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.3 import org.kube.framework 1.0 as Kube import "dateutils.js" as DateUtils FocusScope { id: root property var controller width: stackView.width height: stackView.height signal done() StackView { id: stackView anchors.centerIn: parent width: stackView.currentItem.implicitWidth height: stackView.currentItem.implicitHeight initialItem: eventDetails clip: true } Component { id: eventDetails Rectangle { implicitWidth: contentLayout.implicitWidth + 2 * Kube.Units.largeSpacing implicitHeight: contentLayout.implicitHeight + 2 * Kube.Units.largeSpacing color: Kube.Colors.viewBackgroundColor ColumnLayout { id: contentLayout anchors { centerIn: parent } spacing: Kube.Units.smallSpacing Kube.Heading { - width: parent.width + Layout.fillWidth: true text: controller.summary } Kube.SelectableLabel { visible: controller.allDay text: controller.start.toLocaleString(Qt.locale(), "dd. MMMM") + (DateUtils.sameDay(controller.start, controller.end) ? "" : " - " + controller.end.toLocaleString(Qt.locale(), "dd. MMMM")) } Kube.SelectableLabel { visible: !controller.allDay text: controller.start.toLocaleString(Qt.locale(), "dd. MMMM hh:mm") + " - " + (DateUtils.sameDay(controller.start, controller.end) ? controller.end.toLocaleString(Qt.locale(), "hh:mm") : controller.end.toLocaleString(Qt.locale(), "dd. MMMM hh:mm")) } Kube.SelectableLabel { visible: controller.recurring text: qsTr("repeats %1").arg(controller.recurrenceString) } Kube.SelectableLabel { text: "@" + controller.location visible: controller.location } - TextEdit { + Kube.TextArea { + Layout.fillWidth: true text: controller.description - readOnly: true - selectByMouse: true - color: Kube.Colors.textColor - font.family: Kube.Font.fontFamily } Item { width: 1 height: Kube.Units.largeSpacing } RowLayout { Kube.Button { text: qsTr("Remove") onClicked: { root.controller.remove() root.done() } } Item { Layout.fillWidth: true } Kube.Button { text: qsTr("Edit") onClicked: { stackView.push(editor, StackView.Immediate) } } } } } } Component { id: editor EventEditor { controller: root.controller editMode: true onDone: root.done() } } } diff --git a/views/todo/main.qml b/views/todo/main.qml index 94fa0a11..e12efc67 100644 --- a/views/todo/main.qml +++ b/views/todo/main.qml @@ -1,102 +1,104 @@ /* * Copyright (C) 2018 Christian Mollekopf, * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Window 2.0 import org.kube.framework 1.0 as Kube import org.kube.test 1.0 import "qml" ApplicationWindow { id: app height: Screen.desktopAvailableHeight * 0.8 width: Screen.desktopAvailableWidth * 0.8 Component.onCompleted: { var initialState = { accounts: [ { id: "account1", name: "Test Account" }, { id: "account2", name: "Test Account2" }, ], identities: [{ account: "account1", name: "Test Identity", address: "identity@example.org" }], resources: [ { id: "caldavresource", account: "account1", type: "caldav", }, { id: "caldavresource2", account: "account2", type: "caldav", } ], calendars: [{ id: "calendar1", resource: "caldavresource", name: "Test Calendar", color: "#af1a6a", todos: [ { resource: "caldavresource", summary: "Todo start", starts: "2018-04-09T14:03:00", + description: "
Hi Mélanie,\n\nI'm sorry to start this on such late notice, but we'd like to get Foo and boo to woo next week, because the following weeks are unfortunately not possible for us.\n
",
                     },
                     {
                         resource: "caldavresource",
                         summary: "Todo due",
                         due: "2018-04-09T14:03:00",
+                        description: "Hi Mélanie,\n\nI'm sorry to start this on such late notice, but we'd like to get Foo and boo to woo next week, because the following weeks are unfortunately not possible for us.\n",
                     },
                     {
                         resource: "caldavresource",
                         summary: "Todo"
                     },
                 ],
             },
             {
                 id: "calendar16",
                 resource: "caldavresource",
                 name: "Test Calendar16",
                 color: "#f67400"
             },
             {
                 id: "account2calendar",
                 resource: "caldavresource2",
                 name: "Account2Calendar",
                 color: "#f67400"
             }],
         }
         TestStore.setup(initialState)
     }
 
     View {
         anchors.fill: parent
     }
 }
diff --git a/views/todo/qml/TodoView.qml b/views/todo/qml/TodoView.qml
index aabe7bae..3c550650 100644
--- a/views/todo/qml/TodoView.qml
+++ b/views/todo/qml/TodoView.qml
@@ -1,117 +1,115 @@
 /*
  *  Copyright (C) 2018 Michael Bohlender, 
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License along
  *  with this program; if not, write to the Free Software Foundation, Inc.,
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 import QtQuick 2.4
 import QtQuick.Layouts 1.1
 import QtQuick.Controls 2.3
 
 import org.kube.framework 1.0 as Kube
 
 FocusScope {
     id: root
     property var controller: null
 
     signal done()
 
     onControllerChanged: {
         //Wait for a controller to be set before we add a todo-view
         if (controller) {
             stackView.push(eventDetails, StackView.Immediate)
         }
     }
 
     StackView {
         id: stackView
         anchors.fill: parent
         clip: true
         visible: controller
     }
 
     Component {
         id: eventDetails
         Rectangle {
             color: Kube.Colors.paperWhite
 
             ColumnLayout {
                 id: contentLayout
                 anchors {
                     fill: parent
                     margins: Kube.Units.largeSpacing
                 }
 
                 spacing: Kube.Units.smallSpacing
 
                 Kube.Heading {
-                    width: parent.width
+                    Layout.fillWidth: true
                     text: controller.summary
                 }
 
                 Kube.SelectableLabel {
                     visible: !isNaN(controller.due)
                     text: "Due on: " + controller.due.toLocaleString(Qt.locale(), "dd. MMMM")
                 }
 
                 Kube.SelectableLabel {
                     visible: !isNaN(controller.start)
                     text: "Start on: " + controller.start.toLocaleString(Qt.locale(), "dd. MMMM")
                 }
 
-                TextEdit {
+                Kube.TextArea {
+                    Layout.fillWidth: true
                     text: controller.description
-                    readOnly: true
-                    selectByMouse: true
-                    color: Kube.Colors.textColor
-                    font.family: Kube.Font.fontFamily
                 }
 
                 Item {
                     Layout.fillHeight: true
                     width: 1
                 }
 
                 RowLayout {
+                    width: parent.width
                     Kube.Button {
                         text: qsTr("Remove")
                         onClicked: {
                             root.controller.remove()
                         }
                     }
                     Item {
                         Layout.fillWidth: true
                     }
                     Kube.Button {
                         text: qsTr("Edit")
                         onClicked: {
                             stackView.push(editor, StackView.Immediate)
                         }
                     }
 
                 }
             }
         }
     }
 
     Component {
         id: editor
         TodoEditor {
             controller: root.controller
             editMode: true
             onDone: stackView.pop(StackView.Immediate)
         }
     }
 }