forked from qt-creator/qt-creator
Utils::PathChooser: Allow the core plugin to extend the context menu
And then use this to add the "Open in Graphical Shell" and "Open in Terminal" actions. Those actions cannot be implemented in Utils directly since the Core::FileUtils depends on the Options dialog. This affects all PathChoosers, and there's currently no way for a PathChooser to opt out or have a different context menu. That can be added at a later point. Change-Id: I22121c19d66f08785381c7e0bca5317628eb6342 Task-number: QTCREATORBUG-14736 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -140,11 +140,17 @@ public:
|
||||
|
||||
void triggerChanged();
|
||||
|
||||
// global handler for adding context menus to ALL pathchooser
|
||||
// used by the coreplugin to add "Open in Terminal" and "Open in Explorer" context menu actions
|
||||
using AboutToShowContextMenuHandler = std::function<void (Utils::PathChooser *, QMenu *)>;
|
||||
static void setAboutToShowContextMenuHandler(AboutToShowContextMenuHandler handler);
|
||||
|
||||
private:
|
||||
bool validatePath(FancyLineEdit *edit, QString *errorMessage) const;
|
||||
// Returns overridden title or the one from <title>
|
||||
QString makeDialogTitle(const QString &title);
|
||||
void slotBrowse();
|
||||
void contextMenuRequested(const QPoint &pos);
|
||||
|
||||
signals:
|
||||
void validChanged(bool validState);
|
||||
@@ -161,6 +167,7 @@ public slots:
|
||||
|
||||
private:
|
||||
PathChooserPrivate *d;
|
||||
static AboutToShowContextMenuHandler s_aboutToShowContextMenuHandler;
|
||||
};
|
||||
|
||||
} // namespace Utils
|
||||
|
||||
Reference in New Issue
Block a user