Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions reader/widgets/SaveDialog.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
// Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd.
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// Copyright (C) 2019 - 2026 Uniontech Software Technology Co.,Ltd.
// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#include "SaveDialog.h"
#include "ddlog.h"

Check warning on line 7 in reader/widgets/SaveDialog.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "ddlog.h" not found.

Check warning on line 7 in reader/widgets/SaveDialog.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: "ddlog.h" not found.
#include <QDebug>

Check warning on line 8 in reader/widgets/SaveDialog.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDebug> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 8 in reader/widgets/SaveDialog.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QDebug> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QFontMetrics>

Check warning on line 9 in reader/widgets/SaveDialog.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QFontMetrics> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 9 in reader/widgets/SaveDialog.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QFontMetrics> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QGuiApplication>

Check warning on line 10 in reader/widgets/SaveDialog.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QGuiApplication> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 10 in reader/widgets/SaveDialog.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QGuiApplication> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include <DDialog>

Check warning on line 12 in reader/widgets/SaveDialog.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <DDialog> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 12 in reader/widgets/SaveDialog.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <DDialog> not found. Please note: Cppcheck does not need standard library headers to get proper results.

DWIDGET_USE_NAMESPACE

namespace {
constexpr int kMaxFileNameWidth = 400;
}

SaveDialog::SaveDialog(QObject *parent)
: QObject(parent)
{
Expand All @@ -20,7 +26,9 @@
int SaveDialog::showExitDialog(QString fileName, QWidget *parent)
{
qCDebug(appLog) << "Showing save dialog for file:" << fileName << ", parent:" << parent;
DDialog dlg(tr("Save the changes to \"%1\"?").arg(fileName), "", parent);
QFontMetrics fm(QGuiApplication::font());
QString showName = fm.elidedText(fileName, Qt::ElideMiddle, kMaxFileNameWidth);
DDialog dlg(tr("Save the changes to \"%1\"?").arg(showName), "", parent);
dlg.setIcon(QIcon::fromTheme("deepin-reader"));
dlg.addButtons(QStringList() << tr("Cancel", "button") << tr("Discard", "button"));
dlg.addButton(tr("Save", "button"), true, DDialog::ButtonRecommend);
Expand Down
Loading