File tree Expand file tree Collapse file tree 1 file changed +31
-2
lines changed
Expand file tree Collapse file tree 1 file changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -833,12 +833,41 @@ void mbServerUi::menuSlotWindowDeviceCloseActive()
833833
834834void mbServerUi::slotActionCopy ()
835835{
836-
836+ QList<mbServerAction*> selectedItems = m_actionsUi->selectedItems ();
837+ if (selectedItems.count ())
838+ {
839+ QBuffer buff;
840+ buff.open (QIODevice::ReadWrite);
841+ builder ()->exportActions (&buff, selectedItems);
842+ buff.seek (0 );
843+ QByteArray b = buff.readAll ();
844+ QApplication::clipboard ()->setText (QString::fromUtf8 (b));
845+ }
837846}
838847
839848void mbServerUi::slotActionPaste ()
840849{
841-
850+ if (core ()->isRunning ())
851+ return ;
852+ mbServerProject *project = core ()->project ();
853+ if (project)
854+ {
855+ QString text = QApplication::clipboard ()->text ();
856+ if (text.isEmpty ())
857+ return ;
858+ QByteArray b = text.toUtf8 ();
859+ QBuffer buff (&b);
860+ buff.open (QIODevice::ReadOnly);
861+ QList<mbServerAction*> items = builder ()->importActions (&buff);
862+ if (items.count ())
863+ {
864+ int index = -1 ;
865+ QList<mbServerAction*> selectedItems = m_actionsUi->selectedItems ();
866+ if (selectedItems.count ())
867+ index = project->actionIndex (selectedItems.first ());
868+ project->actionsInsert (items, index);
869+ }
870+ }
842871}
843872
844873void mbServerUi::slotActionSelectAll ()
You can’t perform that action at this time.
0 commit comments