Skip to content
Snippets Groups Projects
Commit 1bd6916e authored by Jan Möbius's avatar Jan Möbius
Browse files

Added copy function to datacontrol context menu

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@3801 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 800db2c2
No related branches found
No related tags found
No related merge requests found
...@@ -195,6 +195,9 @@ class DataControlPlugin : public QObject, BaseInterface, ToolboxInterface, Globa ...@@ -195,6 +195,9 @@ class DataControlPlugin : public QObject, BaseInterface, ToolboxInterface, Globa
/// Called by the popup menu to group items /// Called by the popup menu to group items
void slotGroup ( ); void slotGroup ( );
/// Called by the popup menu to copy items
void slotCopy();
///Called by the popup menu to rename items ///Called by the popup menu to rename items
void slotRename ( ); void slotRename ( );
......
...@@ -90,6 +90,30 @@ void DataControlPlugin::slotUngroup ( ) { ...@@ -90,6 +90,30 @@ void DataControlPlugin::slotUngroup ( ) {
emit updated_objects(-1); emit updated_objects(-1);
} }
void DataControlPlugin::slotCopy ( ) {
QItemSelectionModel* selection = view_->selectionModel();
if (selection == 0) return;
// Get all selected rows
QModelIndexList indexList = selection->selectedRows();
for ( int i = 0 ; i < indexList.size() ; ++i) {
BaseObject* copyItem = model_->getItem( indexList[i] );
// remove the whole subtree below this item
if ( PluginFunctions::copyObject(copyItem->id()) == -1 ) {
emit log(LOGERR, "Unable to copy object" );
continue;
}
}
emit update_view();
emit updated_objects(-1);
}
void DataControlPlugin::slotGroup ( ) { void DataControlPlugin::slotGroup ( ) {
QItemSelectionModel* selection = view_->selectionModel(); QItemSelectionModel* selection = view_->selectionModel();
...@@ -141,6 +165,9 @@ void DataControlPlugin::slotCustomContextMenuRequested ( const QPoint & _pos ) { ...@@ -141,6 +165,9 @@ void DataControlPlugin::slotCustomContextMenuRequested ( const QPoint & _pos ) {
QAction* action; QAction* action;
QIcon icon; QIcon icon;
if ( selectedRows > 1 ) { if ( selectedRows > 1 ) {
action = menu.addAction("Copy",this,SLOT ( slotCopy() ));
icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"edit-copy.png");
action->setIcon(icon);
menu.addAction("Group",this,SLOT ( slotGroup() )); menu.addAction("Group",this,SLOT ( slotGroup() ));
menu.addSeparator(); menu.addSeparator();
menu.addAction("Remove",this,SLOT ( slotPopupRemove() )); menu.addAction("Remove",this,SLOT ( slotPopupRemove() ));
...@@ -163,6 +190,9 @@ void DataControlPlugin::slotCustomContextMenuRequested ( const QPoint & _pos ) { ...@@ -163,6 +190,9 @@ void DataControlPlugin::slotCustomContextMenuRequested ( const QPoint & _pos ) {
action = menu.addAction("Zoom to object",this,SLOT ( slotZoomTo() )); action = menu.addAction("Zoom to object",this,SLOT ( slotZoomTo() ));
icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"zoom-in.png"); icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"zoom-in.png");
action->setIcon(icon); action->setIcon(icon);
action = menu.addAction("Copy",this,SLOT ( slotCopy() ));
icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"edit-copy.png");
action->setIcon(icon);
action = menu.addAction("Rename",this,SLOT ( slotRename() )); action = menu.addAction("Rename",this,SLOT ( slotRename() ));
icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"edit-rename.png"); icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"edit-rename.png");
action->setIcon(icon); action->setIcon(icon);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment