[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [calligra] active: Add copy action to Text docs
From: Shantanu Tushar <shaan7in () gmail ! com>
Date: 2012-01-29 11:12:21
Message-ID: 20120129111221.7B6D7A60A6 () git ! kde ! org
[Download RAW message or body]
Git commit 7f9270d30159d51df8a3880c6e7e70697fce7566 by Shantanu Tushar.
Committed on 29/01/2012 at 12:00.
Pushed by shantanu into branch 'master'.
Add copy action to Text docs
M +26 -6 active/qml/TextDocumentEditingToolbar.qml
M +10 -0 active/src/CATextDocumentHandler.cpp
M +1 -0 active/src/CATextDocumentHandler.h
http://commits.kde.org/calligra/7f9270d30159d51df8a3880c6e7e70697fce7566
diff --git a/active/qml/TextDocumentEditingToolbar.qml b/active/qml/TextDocumentEditingToolbar.qml
index bb169fa..b9879b8 100644
--- a/active/qml/TextDocumentEditingToolbar.qml
+++ b/active/qml/TextDocumentEditingToolbar.qml
@@ -28,13 +28,33 @@ Item
property QtObject documentController
property Item docRootItem
- PlasmaComponents.ToolButton {
- iconSource: "document-edit"
+ PlasmaComponents.ToolBar {
anchors.centerIn: parent
- height: parent.height
- width: height
- checkable: true
+ anchors.fill: parent
- onClicked: docRootItem.toggleEditing()
+ tools: Row {
+ anchors.centerIn: parent
+ height: parent.height
+ spacing: 10
+
+ PlasmaComponents.ToolButton {
+ id: editButton
+ iconSource: "document-edit"
+ height: parent.height
+ width: height
+ checkable: true
+
+ onClicked: docRootItem.toggleEditing()
+ }
+
+ PlasmaComponents.ToolButton {
+ iconSource: "edit-copy"
+ height: parent.height
+ width: height
+ visible: editButton.checked
+
+ onClicked: documentController.documentHandler().copy()
+ }
+ }
}
}
\ No newline at end of file
diff --git a/active/src/CATextDocumentHandler.cpp b/active/src/CATextDocumentHandler.cpp
index 43c7ef5..01bfeb0 100644
--- a/active/src/CATextDocumentHandler.cpp
+++ b/active/src/CATextDocumentHandler.cpp
@@ -25,6 +25,7 @@
#include <KWDocument.h>
#include <KWCanvasItem.h>
+#include <KoCopyController.h>
#include <KoCanvasController.h>
#include <KoToolManager.h>
@@ -37,6 +38,7 @@
#include <KMimeType>
#include <KMimeTypeTrader>
#include <KDebug>
+#include <KActionCollection>
#include <KoSelection.h>
#include <QTextDocument>
@@ -144,6 +146,9 @@ bool CATextDocumentHandler::openDocument (const QString& uri)
KoFindText::findTextInShapes(kwCanvasItem->shapeManager()->shapes(), texts);
d->findText->addDocuments(texts);
+ KAction *action = doc->actionCollection()->addAction(KStandardAction::Copy, "edit_copy", 0, 0);
+ new KoCopyController(canvas(), action);
+
return true;
}
@@ -222,4 +227,9 @@ QString CATextDocumentHandler::topToolbarSource() const
return "TextDocumentEditingToolbar.qml";
}
+void CATextDocumentHandler::copy()
+{
+ document()->actionCollection()->action("edit_copy")->activate(QAction::Trigger);
+}
+
#include "CATextDocumentHandler.moc"
diff --git a/active/src/CATextDocumentHandler.h b/active/src/CATextDocumentHandler.h
index 38e648f..8f592f3 100644
--- a/active/src/CATextDocumentHandler.h
+++ b/active/src/CATextDocumentHandler.h
@@ -53,6 +53,7 @@ public slots:
void findNext();
void findPrevious();
+ void copy();
signals:
void searchStringChanged();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic