| 48 |
48 |
| 49 // Clear the clipboard first. |
49 // Clear the clipboard first. |
| 50 qApp->clipboard()->clear(); |
50 qApp->clipboard()->clear(); |
| 51 |
51 |
| 52 // Now, copy the contents into the clipboard. |
52 // Now, copy the contents into the clipboard. |
| 53 String data; |
53 QString data; |
| 54 |
54 |
| 55 for (LDObjectPtr obj : objs) |
55 for (LDObjectPtr obj : objs) |
| 56 { |
56 { |
| 57 if (not data.isEmpty()) |
57 if (not data.isEmpty()) |
| 58 data += "\n"; |
58 data += "\n"; |
| 84 |
84 |
| 85 // ============================================================================= |
85 // ============================================================================= |
| 86 // |
86 // |
| 87 DEFINE_ACTION (Paste, CTRL (V)) |
87 DEFINE_ACTION (Paste, CTRL (V)) |
| 88 { |
88 { |
| 89 const String clipboardText = qApp->clipboard()->text(); |
89 const QString clipboardText = qApp->clipboard()->text(); |
| 90 int idx = getInsertionPoint(); |
90 int idx = getInsertionPoint(); |
| 91 getCurrentDocument()->clearSelection(); |
91 getCurrentDocument()->clearSelection(); |
| 92 int num = 0; |
92 int num = 0; |
| 93 |
93 |
| 94 for (String line : clipboardText.split ("\n")) |
94 for (QString line : clipboardText.split ("\n")) |
| 95 { |
95 { |
| 96 LDObjectPtr pasted = parseLine (line); |
96 LDObjectPtr pasted = parseLine (line); |
| 97 getCurrentDocument()->insertObj (idx++, pasted); |
97 getCurrentDocument()->insertObj (idx++, pasted); |
| 98 pasted->select(); |
98 pasted->select(); |
| 99 ++num; |
99 ++num; |
| 130 LDObjectList objs = obj.staticCast<LDSubfile>()->inlineContents (deep, false); |
130 LDObjectList objs = obj.staticCast<LDSubfile>()->inlineContents (deep, false); |
| 131 |
131 |
| 132 // Merge in the inlined objects |
132 // Merge in the inlined objects |
| 133 for (LDObjectPtr inlineobj : objs) |
133 for (LDObjectPtr inlineobj : objs) |
| 134 { |
134 { |
| 135 String line = inlineobj->asText(); |
135 QString line = inlineobj->asText(); |
| 136 inlineobj->destroy(); |
136 inlineobj->destroy(); |
| 137 LDObjectPtr newobj = parseLine (line); |
137 LDObjectPtr newobj = parseLine (line); |
| 138 getCurrentDocument()->insertObj (idx++, newobj); |
138 getCurrentDocument()->insertObj (idx++, newobj); |
| 139 newobj->select(); |
139 newobj->select(); |
| 140 } |
140 } |
| 742 |
742 |
| 743 if (not dlg->exec()) |
743 if (not dlg->exec()) |
| 744 return; |
744 return; |
| 745 |
745 |
| 746 // Create the comment object based on input |
746 // Create the comment object based on input |
| 747 String commentText = format ("!HISTORY %1 [%2] %3", |
747 QString commentText = format ("!HISTORY %1 [%2] %3", |
| 748 ui->m_date->date().toString ("yyyy-MM-dd"), |
748 ui->m_date->date().toString ("yyyy-MM-dd"), |
| 749 ui->m_username->text(), |
749 ui->m_username->text(), |
| 750 ui->m_comment->text()); |
750 ui->m_comment->text()); |
| 751 |
751 |
| 752 LDCommentPtr comm (spawn<LDComment> (commentText)); |
752 LDCommentPtr comm (spawn<LDComment> (commentText)); |