summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/kube/contents/ui/LogView.qml10
-rw-r--r--framework/qml/Icons.qml1
-rw-r--r--framework/qml/SelectableLabel.qml45
-rw-r--r--framework/qmldir1
-rw-r--r--framework/src/CMakeLists.txt1
-rw-r--r--framework/src/clipboardproxy.cpp52
-rw-r--r--framework/src/clipboardproxy.h39
-rw-r--r--framework/src/frameworkplugin.cpp2
-rwxr-xr-xicons/copybreeze.sh3
9 files changed, 148 insertions, 6 deletions
diff --git a/components/kube/contents/ui/LogView.qml b/components/kube/contents/ui/LogView.qml
index f655b977..299c8e67 100644
--- a/components/kube/contents/ui/LogView.qml
+++ b/components/kube/contents/ui/LogView.qml
@@ -131,7 +131,7 @@ Controls.SplitView {
131 text: qsTr("Account:") 131 text: qsTr("Account:")
132 visible: details.accountName 132 visible: details.accountName
133 } 133 }
134 Kube.Label { 134 Kube.SelectableLabel {
135 text: details.accountName 135 text: details.accountName
136 visible: details.accountName 136 visible: details.accountName
137 } 137 }
@@ -139,7 +139,7 @@ Controls.SplitView {
139 text: qsTr("Account Id:") 139 text: qsTr("Account Id:")
140 visible: details.accountId 140 visible: details.accountId
141 } 141 }
142 Kube.Label { 142 Kube.SelectableLabel {
143 text: details.accountId 143 text: details.accountId
144 visible: details.accountId 144 visible: details.accountId
145 } 145 }
@@ -147,20 +147,20 @@ Controls.SplitView {
147 text: qsTr("Resource Id:") 147 text: qsTr("Resource Id:")
148 visible: details.resourceId 148 visible: details.resourceId
149 } 149 }
150 Kube.Label { 150 Kube.SelectableLabel {
151 text: details.resourceId 151 text: details.resourceId
152 visible: details.resourceId 152 visible: details.resourceId
153 } 153 }
154 Kube.Label { 154 Kube.Label {
155 text: qsTr("Timestamp:") 155 text: qsTr("Timestamp:")
156 } 156 }
157 Kube.Label { 157 Kube.SelectableLabel {
158 text: Qt.formatDateTime(details.timestamp, " hh:mm:ss dd MMM yyyy") 158 text: Qt.formatDateTime(details.timestamp, " hh:mm:ss dd MMM yyyy")
159 } 159 }
160 Kube.Label { 160 Kube.Label {
161 text: qsTr("Message:") 161 text: qsTr("Message:")
162 } 162 }
163 Kube.Label { 163 Kube.SelectableLabel {
164 text: details.message 164 text: details.message
165 wrapMode: Text.Wrap 165 wrapMode: Text.Wrap
166 Layout.fillWidth: true 166 Layout.fillWidth: true
diff --git a/framework/qml/Icons.qml b/framework/qml/Icons.qml
index 3126c797..d9612013 100644
--- a/framework/qml/Icons.qml
+++ b/framework/qml/Icons.qml
@@ -42,6 +42,7 @@ Item {
42 property string replyToSender: "mail-reply-sender" 42 property string replyToSender: "mail-reply-sender"
43 property string outbox: "mail-folder-outbox" 43 property string outbox: "mail-folder-outbox"
44 property string outbox_inverted: "mail-folder-outbox-inverted" 44 property string outbox_inverted: "mail-folder-outbox-inverted"
45 property string copy: "edit-copy"
45 46
46 property string menu_inverted: "application-menu-inverted" 47 property string menu_inverted: "application-menu-inverted"
47 property string user: "im-user" 48 property string user: "im-user"
diff --git a/framework/qml/SelectableLabel.qml b/framework/qml/SelectableLabel.qml
new file mode 100644
index 00000000..920f5c7a
--- /dev/null
+++ b/framework/qml/SelectableLabel.qml
@@ -0,0 +1,45 @@
1/*
2 * Copyright (C) 2017 Michael Bohlender, <bohlender@kolabsys.com>
3 * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20import QtQuick 2.7
21import QtQuick.Templates 2.0 as T
22import org.kube.framework 1.0 as Kube
23
24Kube.Label {
25 id: root
26 MouseArea {
27 id: mouseArea
28 anchors.fill: parent
29 hoverEnabled: true
30 z: 1
31 }
32 Kube.IconButton {
33 anchors {
34 left: parent.right
35 verticalCenter: parent.verticalCenter
36 }
37 iconName: Kube.Icons.copy
38 visible: mouseArea.containsMouse || hovered
39 color: Kube.Colors.backgroundColor
40 onClicked: clipboard.text = root.text
41 Kube.Clipboard {
42 id: clipboard
43 }
44 }
45}
diff --git a/framework/qmldir b/framework/qmldir
index c8e0ae58..d4ec9619 100644
--- a/framework/qmldir
+++ b/framework/qmldir
@@ -27,6 +27,7 @@ TextArea 1.0 TextArea.qml
27TextEditor 1.0 TextEditor.qml 27TextEditor 1.0 TextEditor.qml
28ToolTip 1.0 ToolTip.qml 28ToolTip 1.0 ToolTip.qml
29Label 1.0 Label.qml 29Label 1.0 Label.qml
30SelectableLabel 1.0 SelectableLabel.qml
30Heading 1.0 Heading.qml 31Heading 1.0 Heading.qml
31View 1.0 View.qml 32View 1.0 View.qml
32AutocompleteLineEdit 1.0 AutocompleteLineEdit.qml 33AutocompleteLineEdit 1.0 AutocompleteLineEdit.qml
diff --git a/framework/src/CMakeLists.txt b/framework/src/CMakeLists.txt
index 034feba9..85ad8344 100644
--- a/framework/src/CMakeLists.txt
+++ b/framework/src/CMakeLists.txt
@@ -40,6 +40,7 @@ set(SRCS
40 fabric.cpp 40 fabric.cpp
41 sinkfabric.cpp 41 sinkfabric.cpp
42 kubeimage.cpp 42 kubeimage.cpp
43 clipboardproxy.cpp
43) 44)
44 45
45add_library(frameworkplugin SHARED ${SRCS}) 46add_library(frameworkplugin SHARED ${SRCS})
diff --git a/framework/src/clipboardproxy.cpp b/framework/src/clipboardproxy.cpp
new file mode 100644
index 00000000..aaa5052b
--- /dev/null
+++ b/framework/src/clipboardproxy.cpp
@@ -0,0 +1,52 @@
1/*
2 Copyright (c) 2016 Christian Mollekofp <mollekopf@kolabsys.com>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19#include "clipboardproxy.h"
20
21#include <QClipboard>
22#include <QApplication>
23
24ClipboardProxy::ClipboardProxy(QObject *parent)
25 : QObject(parent)
26{
27 QClipboard *clipboard = QApplication::clipboard();
28 QObject::connect(clipboard, &QClipboard::dataChanged,
29 this, &ClipboardProxy::dataChanged);
30 QObject::connect(clipboard, &QClipboard::selectionChanged,
31 this, &ClipboardProxy::selectionChanged);
32}
33
34void ClipboardProxy::setDataText(const QString &text)
35{
36 QApplication::clipboard()->setText(text, QClipboard::Clipboard);
37}
38
39QString ClipboardProxy::dataText() const
40{
41 return QGuiApplication::clipboard()->text(QClipboard::Clipboard);
42}
43
44void ClipboardProxy::setSelectionText(const QString &text)
45{
46 QApplication::clipboard()->setText(text, QClipboard::Selection);
47}
48
49QString ClipboardProxy::selectionText() const
50{
51 return QApplication::clipboard()->text(QClipboard::Selection);
52}
diff --git a/framework/src/clipboardproxy.h b/framework/src/clipboardproxy.h
new file mode 100644
index 00000000..9a965004
--- /dev/null
+++ b/framework/src/clipboardproxy.h
@@ -0,0 +1,39 @@
1/*
2 Copyright (c) 2016 Christian Mollekofp <mollekopf@kolabsys.com>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19#pragma once
20
21#include <QObject>
22class ClipboardProxy : public QObject
23{
24 Q_OBJECT
25 Q_PROPERTY(QString text READ dataText WRITE setDataText NOTIFY dataChanged)
26 Q_PROPERTY(QString selectionText READ selectionText WRITE setSelectionText NOTIFY selectionChanged)
27public:
28 explicit ClipboardProxy(QObject *parent = 0);
29
30 void setDataText(const QString &text);
31 QString dataText() const;
32
33 void setSelectionText(const QString &text);
34 QString selectionText() const;
35
36signals:
37 void dataChanged();
38 void selectionChanged();
39};
diff --git a/framework/src/frameworkplugin.cpp b/framework/src/frameworkplugin.cpp
index 9c79f515..33bc8cbc 100644
--- a/framework/src/frameworkplugin.cpp
+++ b/framework/src/frameworkplugin.cpp
@@ -34,6 +34,7 @@
34#include "settings/settings.h" 34#include "settings/settings.h"
35#include "fabric.h" 35#include "fabric.h"
36#include "kubeimage.h" 36#include "kubeimage.h"
37#include "clipboardproxy.h"
37 38
38#include <QtQml> 39#include <QtQml>
39 40
@@ -65,4 +66,5 @@ void FrameworkPlugin::registerTypes (const char *uri)
65 qmlRegisterSingletonType<Kube::Fabric::Fabric>(uri, 1, 0, "Fabric", fabric_singletontype_provider); 66 qmlRegisterSingletonType<Kube::Fabric::Fabric>(uri, 1, 0, "Fabric", fabric_singletontype_provider);
66 67
67 qmlRegisterType<KubeImage>(uri, 1, 0, "KubeImage"); 68 qmlRegisterType<KubeImage>(uri, 1, 0, "KubeImage");
69 qmlRegisterType<ClipboardProxy>(uri, 1, 0, "Clipboard");
68} 70}
diff --git a/icons/copybreeze.sh b/icons/copybreeze.sh
index da2f1df7..6a245178 100755
--- a/icons/copybreeze.sh
+++ b/icons/copybreeze.sh
@@ -32,7 +32,8 @@ wantedIcons = [
32 "mail-message.svg", 32 "mail-message.svg",
33 "list-add.svg", 33 "list-add.svg",
34 "list-remove.svg", 34 "list-remove.svg",
35 "checkbox.svg" 35 "checkbox.svg",
36 "edit-copy.svg"
36] 37]
37 38
38def ensure_dir(file_path): 39def ensure_dir(file_path):