Commit fa957a5e authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Don't regenerate all actions each time that we add new url

parent 02c72181
Pipeline #51995 passed with stage
in 42 minutes and 50 seconds
...@@ -18,8 +18,8 @@ RemoteContentMenu::RemoteContentMenu(QWidget *parent) ...@@ -18,8 +18,8 @@ RemoteContentMenu::RemoteContentMenu(QWidget *parent)
: QMenu(parent) : QMenu(parent)
{ {
setTitle(i18n("Remote Content")); setTitle(i18n("Remote Content"));
connect(this, &QMenu::aboutToShow, this, &RemoteContentMenu::updateMenu);
initialize(); initialize();
updateMenu();
} }
RemoteContentMenu::~RemoteContentMenu() RemoteContentMenu::~RemoteContentMenu()
...@@ -29,12 +29,10 @@ RemoteContentMenu::~RemoteContentMenu() ...@@ -29,12 +29,10 @@ RemoteContentMenu::~RemoteContentMenu()
void RemoteContentMenu::initialize() void RemoteContentMenu::initialize()
{ {
mConfigureRemoteContentAction = new QAction(i18n("Configure"), this); mConfigureRemoteContentAction = new QAction(i18n("Configure"), this);
connect(mConfigureRemoteContentAction, &QAction::triggered, this, &RemoteContentMenu::slotConfigure);
} }
void RemoteContentMenu::slotConfigure() void RemoteContentMenu::slotConfigure()
{ {
qDebug() << " void RemoteContentMenu::slotConfigure()";
QPointer<MessageViewer::RemoteContentConfigureDialog> remoteContentDialog = new MessageViewer::RemoteContentConfigureDialog(this); QPointer<MessageViewer::RemoteContentConfigureDialog> remoteContentDialog = new MessageViewer::RemoteContentConfigureDialog(this);
remoteContentDialog->exec(); remoteContentDialog->exec();
delete remoteContentDialog; delete remoteContentDialog;
...@@ -64,6 +62,7 @@ void RemoteContentMenu::updateMenu() ...@@ -64,6 +62,7 @@ void RemoteContentMenu::updateMenu()
} }
addSeparator(); addSeparator();
addAction(mConfigureRemoteContentAction); addAction(mConfigureRemoteContentAction);
connect(mConfigureRemoteContentAction, &QAction::triggered, this, &RemoteContentMenu::slotConfigure);
} }
void RemoteContentMenu::authorize(const QString &url) void RemoteContentMenu::authorize(const QString &url)
...@@ -84,5 +83,4 @@ void RemoteContentMenu::appendUrl(const QString &url) ...@@ -84,5 +83,4 @@ void RemoteContentMenu::appendUrl(const QString &url)
if (!mUrls.contains(url)) { if (!mUrls.contains(url)) {
mUrls.append(url); mUrls.append(url);
} }
updateMenu();
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment