Changeset View
Changeset View
Standalone View
Standalone View
shell/runcontroller.cpp
Show First 20 Lines • Show All 959 Lines • ▼ Show 20 Line(s) | 924 | { | |||
---|---|---|---|---|---|
960 | return l; | 960 | return l; | ||
961 | } | 961 | } | ||
962 | 962 | | |||
963 | QItemDelegate * KDevelop::RunController::delegate() const | 963 | QItemDelegate * KDevelop::RunController::delegate() const | ||
964 | { | 964 | { | ||
965 | return d->delegate; | 965 | return d->delegate; | ||
966 | } | 966 | } | ||
967 | 967 | | |||
968 | ContextMenuExtension RunController::contextMenuExtension ( Context* ctx ) | 968 | ContextMenuExtension RunController::contextMenuExtension(Context* ctx, QWidget* parent) | ||
969 | { | 969 | { | ||
970 | delete d->launchAsMapper; | 970 | delete d->launchAsMapper; | ||
971 | d->launchAsMapper = new QSignalMapper( this ); | 971 | d->launchAsMapper = new QSignalMapper( this ); | ||
972 | connect( d->launchAsMapper, static_cast<void(QSignalMapper::*)(int)>(&QSignalMapper::mapped), this, [&] (int id) { d->launchAs(id); } ); | 972 | connect( d->launchAsMapper, static_cast<void(QSignalMapper::*)(int)>(&QSignalMapper::mapped), this, [&] (int id) { d->launchAs(id); } ); | ||
973 | d->launchAsInfo.clear(); | 973 | d->launchAsInfo.clear(); | ||
974 | d->contextItem = nullptr; | 974 | d->contextItem = nullptr; | ||
975 | ContextMenuExtension ext; | 975 | ContextMenuExtension ext; | ||
976 | if( ctx->type() == Context::ProjectItemContext ) { | 976 | if( ctx->type() == Context::ProjectItemContext ) { | ||
977 | KDevelop::ProjectItemContext* prjctx = static_cast<KDevelop::ProjectItemContext*>(ctx); | 977 | KDevelop::ProjectItemContext* prjctx = static_cast<KDevelop::ProjectItemContext*>(ctx); | ||
978 | if( prjctx->items().count() == 1 ) | 978 | if( prjctx->items().count() == 1 ) | ||
979 | { | 979 | { | ||
980 | ProjectBaseItem* itm = prjctx->items().at( 0 ); | 980 | ProjectBaseItem* itm = prjctx->items().at( 0 ); | ||
981 | int i = 0; | 981 | int i = 0; | ||
982 | foreach( ILaunchMode* mode, d->launchModes ) | 982 | foreach( ILaunchMode* mode, d->launchModes ) | ||
983 | { | 983 | { | ||
984 | KActionMenu* menu = new KActionMenu( i18n("%1 As...", mode->name() ), this ); | 984 | KActionMenu* menu = new KActionMenu(i18n("%1 As...", mode->name() ), parent); | ||
985 | foreach( LaunchConfigurationType* type, launchConfigurationTypes() ) | 985 | foreach( LaunchConfigurationType* type, launchConfigurationTypes() ) | ||
986 | { | 986 | { | ||
987 | bool hasLauncher = false; | 987 | bool hasLauncher = false; | ||
988 | foreach( ILauncher* launcher, type->launchers() ) | 988 | foreach( ILauncher* launcher, type->launchers() ) | ||
989 | { | 989 | { | ||
990 | if( launcher->supportedModes().contains( mode->id() ) ) | 990 | if( launcher->supportedModes().contains( mode->id() ) ) | ||
991 | { | 991 | { | ||
992 | hasLauncher = true; | 992 | hasLauncher = true; | ||
Show All 9 Lines | 996 | { | |||
1002 | connect( act, &QAction::triggered, d->launchAsMapper, static_cast<void(QSignalMapper::*)()>(&QSignalMapper::map) ); | 1002 | connect( act, &QAction::triggered, d->launchAsMapper, static_cast<void(QSignalMapper::*)()>(&QSignalMapper::map) ); | ||
1003 | menu->addAction(act); | 1003 | menu->addAction(act); | ||
1004 | i++; | 1004 | i++; | ||
1005 | } | 1005 | } | ||
1006 | } | 1006 | } | ||
1007 | if( menu->menu()->actions().count() > 0 ) | 1007 | if( menu->menu()->actions().count() > 0 ) | ||
1008 | { | 1008 | { | ||
1009 | ext.addAction( ContextMenuExtension::RunGroup, menu); | 1009 | ext.addAction( ContextMenuExtension::RunGroup, menu); | ||
1010 | } else { | ||||
1011 | delete menu; | ||||
1010 | } | 1012 | } | ||
1011 | } | 1013 | } | ||
1012 | if( ext.actions( ContextMenuExtension::RunGroup ).count() > 0 ) | 1014 | if( ext.actions( ContextMenuExtension::RunGroup ).count() > 0 ) | ||
1013 | { | 1015 | { | ||
1014 | d->contextItem = itm; | 1016 | d->contextItem = itm; | ||
1015 | } | 1017 | } | ||
1016 | } | 1018 | } | ||
1017 | } | 1019 | } | ||
Show All 30 Lines |