Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 02ed12c9 authored by Nathaniel Graham's avatar Nathaniel Graham

Update move/copy/link dialog window's title to reflect selected files

Summary:
When a single image has been selected, the window title now says, "Move/Copy/Link <filename>

When multiple image have been selected, the window title now says, "Move/Copy/Link <number of images selected> images"

Test Plan:
Tested in KDE Neon. Works fine.

Single image selection:
{F5442086}

Multiple image selection:
{F5442087}

Reviewers: rkflx, broulik, #kde_applications, ilic

Reviewed By: rkflx, ilic

Subscribers: ilic

Differential Revision: https://phabricator.kde.org/D8409
parent 1069882e
......@@ -50,30 +50,45 @@ namespace FileOperations
static void copyMoveOrLink(Operation operation, const QList<QUrl>& urlList, QWidget* parent, ContextManager* contextManager)
{
Q_ASSERT(!urlList.isEmpty());
const int numberOfImages = urlList.count();
QFileDialog dialog(parent->nativeParentWidget(), QString());
dialog.setAcceptMode(QFileDialog::AcceptSave);
// Figure out what the window title and buttons should say,
// depending on the operation and how many images are selected
switch (operation) {
case COPY:
dialog.setWindowTitle(i18nc("@title:window", "Copy To"));
if (numberOfImages == 1) {
dialog.setWindowTitle(i18nc("@title:window %1 file name", "Copy %1", urlList.constFirst().fileName()));
} else {
dialog.setWindowTitle(i18ncp("@title:window %1 number of images", "Copy %1 image", "Copy %1 images", numberOfImages));
}
dialog.setLabelText(QFileDialog::DialogLabel::Accept, i18nc("@action:button", "Copy"));
break;
case MOVE:
dialog.setWindowTitle(i18nc("@title:window", "Move To"));
if (numberOfImages == 1) {
dialog.setWindowTitle(i18nc("@title:window %1 file name", "Move %1", urlList.constFirst().fileName()));
} else {
dialog.setWindowTitle(i18ncp("@title:window %1 number of images", "Move %1 image", "Move %1 images", numberOfImages));
}
dialog.setLabelText(QFileDialog::DialogLabel::Accept, i18nc("@action:button", "Move"));
break;
case LINK:
dialog.setWindowTitle(i18nc("@title:window", "Link To"));
if (numberOfImages == 1) {
dialog.setWindowTitle(i18nc("@title:window %1 file name", "Link %1", urlList.constFirst().fileName()));
} else {
dialog.setWindowTitle(i18ncp("@title:window %1 number of images", "Link %1 image", "Link %1 images", numberOfImages));
}
dialog.setLabelText(QFileDialog::DialogLabel::Accept, i18nc("@action:button", "Link"));
break;
default:
Q_ASSERT(0);
}
if (urlList.count() == 1) {
if (numberOfImages == 1) {
dialog.setFileMode(QFileDialog::AnyFile);
dialog.selectUrl(urlList.first());
dialog.selectUrl(urlList.constFirst());
} else {
dialog.setFileMode(QFileDialog::Directory);
dialog.setOption(QFileDialog::ShowDirsOnly, true);
......
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