47 |
47 |
48 // Clear the clipboard first. |
48 // Clear the clipboard first. |
49 qApp->clipboard()->clear(); |
49 qApp->clipboard()->clear(); |
50 |
50 |
51 // Now, copy the contents into the clipboard. |
51 // Now, copy the contents into the clipboard. |
52 str data; |
52 QString data; |
53 |
53 |
54 for (LDObject* obj : objs) |
54 for (LDObject* obj : objs) |
55 { |
55 { |
56 if (data.length() > 0) |
56 if (data.length() > 0) |
57 data += "\n"; |
57 data += "\n"; |
83 |
83 |
84 // ============================================================================= |
84 // ============================================================================= |
85 // ----------------------------------------------------------------------------- |
85 // ----------------------------------------------------------------------------- |
86 DEFINE_ACTION (Paste, CTRL (V)) |
86 DEFINE_ACTION (Paste, CTRL (V)) |
87 { |
87 { |
88 const str clipboardText = qApp->clipboard()->text(); |
88 const QString clipboardText = qApp->clipboard()->text(); |
89 int idx = getInsertionPoint(); |
89 int idx = getInsertionPoint(); |
90 getCurrentDocument()->clearSelection(); |
90 getCurrentDocument()->clearSelection(); |
91 int num = 0; |
91 int num = 0; |
92 |
92 |
93 for (str line : clipboardText.split ("\n")) |
93 for (QString line : clipboardText.split ("\n")) |
94 { |
94 { |
95 LDObject* pasted = parseLine (line); |
95 LDObject* pasted = parseLine (line); |
96 getCurrentDocument()->insertObj (idx++, pasted); |
96 getCurrentDocument()->insertObj (idx++, pasted); |
97 pasted->select(); |
97 pasted->select(); |
98 R()->compileObject (pasted); |
98 R()->compileObject (pasted); |
139 continue; |
139 continue; |
140 |
140 |
141 // Merge in the inlined objects |
141 // Merge in the inlined objects |
142 for (LDObject * inlineobj : objs) |
142 for (LDObject * inlineobj : objs) |
143 { |
143 { |
144 str line = inlineobj->raw(); |
144 QString line = inlineobj->raw(); |
145 inlineobj->deleteSelf(); |
145 inlineobj->deleteSelf(); |
146 LDObject* newobj = parseLine (line); |
146 LDObject* newobj = parseLine (line); |
147 getCurrentDocument()->insertObj (idx++, newobj); |
147 getCurrentDocument()->insertObj (idx++, newobj); |
148 newobj->select(); |
148 newobj->select(); |
149 g_win->R()->compileObject (newobj); |
149 g_win->R()->compileObject (newobj); |
794 |
794 |
795 if (!dlg->exec()) |
795 if (!dlg->exec()) |
796 return; |
796 return; |
797 |
797 |
798 // Create the comment object based on input |
798 // Create the comment object based on input |
799 str commentText = fmt ("!HISTORY %1 [%2] %3", |
799 QString commentText = fmt ("!HISTORY %1 [%2] %3", |
800 ui->m_date->date().toString ("yyyy-MM-dd"), |
800 ui->m_date->date().toString ("yyyy-MM-dd"), |
801 ui->m_username->text(), |
801 ui->m_username->text(), |
802 ui->m_comment->text()); |
802 ui->m_comment->text()); |
803 |
803 |
804 LDComment* comm = new LDComment (commentText); |
804 LDComment* comm = new LDComment (commentText); |