Changeset View
Changeset View
Standalone View
Standalone View
language/codegen/basicrefactoring.cpp
Show First 20 Lines • Show All 88 Lines • ▼ Show 20 Line(s) | |||||
89 | //BEGIN: BasicRefactoring | 89 | //BEGIN: BasicRefactoring | ||
90 | 90 | | |||
91 | BasicRefactoring::BasicRefactoring(QObject *parent) | 91 | BasicRefactoring::BasicRefactoring(QObject *parent) | ||
92 | : QObject(parent) | 92 | : QObject(parent) | ||
93 | { | 93 | { | ||
94 | /* There's nothing to do here. */ | 94 | /* There's nothing to do here. */ | ||
95 | } | 95 | } | ||
96 | 96 | | |||
97 | void BasicRefactoring::fillContextMenu(ContextMenuExtension &extension, Context *context) | 97 | void BasicRefactoring::fillContextMenu(ContextMenuExtension &extension, Context *context, QWidget* parent) | ||
98 | { | 98 | { | ||
99 | DeclarationContext *declContext = dynamic_cast<DeclarationContext *>(context); | 99 | DeclarationContext *declContext = dynamic_cast<DeclarationContext *>(context); | ||
100 | if (!declContext) | 100 | if (!declContext) | ||
101 | return; | 101 | return; | ||
102 | 102 | | |||
103 | DUChainReadLocker lock; | 103 | DUChainReadLocker lock; | ||
104 | Declaration *declaration = declContext->declaration().data(); | 104 | Declaration *declaration = declContext->declaration().data(); | ||
105 | if (declaration && acceptForContextMenu(declaration)) { | 105 | if (declaration && acceptForContextMenu(declaration)) { | ||
106 | QFileInfo finfo(declaration->topContext()->url().str()); | 106 | QFileInfo finfo(declaration->topContext()->url().str()); | ||
107 | if (finfo.isWritable()) { | 107 | if (finfo.isWritable()) { | ||
108 | QAction *action = new QAction(i18n("Rename \"%1\"...", declaration->qualifiedIdentifier().toString()), nullptr); | 108 | QAction *action = new QAction(i18n("Rename \"%1\"...", declaration->qualifiedIdentifier().toString()), parent); | ||
109 | action->setData(QVariant::fromValue(IndexedDeclaration(declaration))); | 109 | action->setData(QVariant::fromValue(IndexedDeclaration(declaration))); | ||
110 | action->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename"))); | 110 | action->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename"))); | ||
111 | connect(action, &QAction::triggered, this, &BasicRefactoring::executeRenameAction); | 111 | connect(action, &QAction::triggered, this, &BasicRefactoring::executeRenameAction); | ||
112 | extension.addAction(ContextMenuExtension::RefactorGroup, action); | 112 | extension.addAction(ContextMenuExtension::RefactorGroup, action); | ||
113 | } | 113 | } | ||
114 | } | 114 | } | ||
115 | } | 115 | } | ||
116 | 116 | | |||
▲ Show 20 Lines • Show All 247 Lines • Show Last 20 Lines |