OSDN Git Service

ショートカットキーによるコピー(カット)&ペースト操作も操作履歴として取得可能にした
authoryuki <kimaira7@gmail.com>
Thu, 16 Oct 2014 07:55:39 +0000 (16:55 +0900)
committeryuki <kimaira7@gmail.com>
Thu, 16 Oct 2014 07:55:39 +0000 (16:55 +0900)
src/cx/fbn/nevernote/gui/BrowserWindow.java
src/cx/fbn/nevernote/gui/ContentView.java

index 2bed87f..b18d5eb 100644 (file)
@@ -1097,8 +1097,7 @@ public class BrowserWindow extends QWidget {
        }
 
        // Listener for when cut is clicked
-       @SuppressWarnings("unused")
-       private void cutClicked() {
+       public void cutClicked() {
                cbObserver.setCopySourceGuid(currentNote.getGuid(), browser.page().selectedText());
                
                browser.page().triggerAction(WebAction.Cut);
@@ -1106,8 +1105,7 @@ public class BrowserWindow extends QWidget {
        }
 
        // Listener when COPY is clicked
-       @SuppressWarnings("unused")
-       private void copyClicked() {
+       public void copyClicked() {
                cbObserver.setCopySourceGuid(currentNote.getGuid(), browser.page().selectedText());
                
                browser.page().triggerAction(WebAction.Copy);
index 6e0f337..3655adf 100644 (file)
@@ -330,6 +330,21 @@ public class ContentView extends QWebView {
                        e.accept();\r
                        return;\r
                }\r
+               \r
+               // This is done to capture the operation of cutting by shortcut keys\r
+               if (e.matches(StandardKey.Cut)) {\r
+                       parent.cutClicked();\r
+                       e.accept();\r
+                       return;\r
+               }\r
+               \r
+               // This is done to capture the operation of copying by shortcut keys\r
+               if (e.matches(StandardKey.Copy)) {\r
+                       parent.copyClicked();\r
+                       e.accept();\r
+                       return;\r
+               }\r
+               \r
                super.keyPressEvent(e);\r
        }\r
 \r