Use "Do x" action texts for drop menu entries

Summary:
Dropping some item onto a containment results in a menu which lists widgets
and wallpaper plugins without explicitly telling what will happen onto
activation.

Changing the menu entries into "Add widget" and "Set wallpaper" makes it
more obvious what they will result in.

Reviewers: #vdg, #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: ngraham, #frameworks

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D12247
This commit is contained in:
Friedrich W. H. Kossebau 2018-04-16 15:12:33 +02:00
parent 931587f937
commit de1fde8298

View File

@ -706,13 +706,11 @@ void ContainmentInterface::mimeTypeRetrieved(KIO::Job *job, const QString &mimet
dropActions << action;
}
foreach (const auto &info, appletList) {
QAction *action;
const QString actionText = i18nc("Add widget", "Add %1", info.name());
QAction *action = new QAction(actionText, nullptr);
if (!info.iconName().isEmpty()) {
action = new QAction(QIcon::fromTheme(info.iconName()), info.name(), nullptr);
} else {
action = new QAction(info.name(), nullptr);
action->setIcon(QIcon::fromTheme(info.iconName()));
}
if (choices) {
choices->addAction(action);
}
@ -725,7 +723,7 @@ void ContainmentInterface::mimeTypeRetrieved(KIO::Job *job, const QString &mimet
});
}
{
QAction *action = new QAction(i18n("Icon"), nullptr);
QAction *action = new QAction(i18nc("Add icon widget", "Add Icon"), nullptr);
if (choices) {
choices->addAction(action);
}
@ -754,11 +752,10 @@ void ContainmentInterface::mimeTypeRetrieved(KIO::Job *job, const QString &mimet
}
foreach (const KPluginMetaData &info, wallpaperList) {
QAction *action;
const QString actionText = i18nc("Set wallpaper", "Set %1", info.name());
QAction *action = new QAction(actionText, nullptr);
if (!info.iconName().isEmpty()) {
action = new QAction(QIcon::fromTheme(info.iconName()), info.name(), nullptr);
} else {
action = new QAction(info.name(), nullptr);
action->setIcon(QIcon::fromTheme(info.iconName()));
}
if (choices) {
@ -785,13 +782,13 @@ void ContainmentInterface::mimeTypeRetrieved(KIO::Job *job, const QString &mimet
QAction *action;
if (choices) {
choices->addSection(i18n("Widgets"));
action = choices->addAction(i18n("Icon"));
action = choices->addAction(i18nc("Add icon widget", "Add Icon"));
} else {
QAction *sep = new QAction(i18n("Widgets"), nullptr);
sep->setSeparator(true);
dropActions << sep;
// we can at least create an icon as a link to the URL
action = new QAction(i18n("Icon"), nullptr);
action = new QAction(i18nc("Add icon widget", "Add Icon"), nullptr);
dropActions << action;
}