Skip to content

Commit 282f584

Browse files
lichaofan2008deepin-bot[bot]
authored andcommitted
fix: Modify the parameters in the setDocName() function.
按照DDE的要求,setDocName()函数中传入的字符串不能是绝对路径也不带扩展名。 Revert b85b9d2. Bug: https://pms.uniontech.com/bug-view-329561.html https://pms.uniontech.com/bug-view-329547.html
1 parent 4b877b6 commit 282f584

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/widgets/window.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,13 +1968,18 @@ void Window::popupPrintDialog()
19681968
m_pPreview = new DPrintPreviewDialog(this);
19691969
m_pPreview->setAttribute(Qt::WA_DeleteOnClose);
19701970

1971-
// 设置 QPrinter 的文档名称,保留绝对路径和文件后缀(在cups的page_log中保留完整的job-name)
1972-
// 注意和文件的输出文件路径进行区分
19731971
if (fileDir == m_blankFileDir) {
1974-
m_pPreview->setDocName(filePath);
1972+
QString name = m_tabbar->currentName();
1973+
QRegularExpression reg("[^*](.+)");
1974+
QRegularExpressionMatch match = reg.match(name);
1975+
QString docName = match.captured(0);
1976+
qInfo() << __func__ << "print blank file, docName:" << docName;
1977+
m_pPreview->setDocName(docName);
19751978
} else {
19761979
QString path = currentWrapper()->textEditor()->getTruePath();
1977-
m_pPreview->setDocName(path);
1980+
QString docName = QFileInfo(path).baseName();
1981+
qInfo() << __func__ << "print normal file, docName:" << docName;
1982+
m_pPreview->setDocName(docName);
19781983
}
19791984

19801985
// 后续布局计算后再更新打印页数

0 commit comments

Comments
 (0)