diff --git a/htmltopdf/main.cpp b/htmltopdf/main.cpp
index 8e6bba0e..a5ae99bc 100644
--- a/htmltopdf/main.cpp
+++ b/htmltopdf/main.cpp
@@ -49,11 +49,11 @@ int main(int argc, char *argv[])
parser.process(QCoreApplication::arguments());
const QStringList requiredArguments = parser.positionalArguments();
- qInfo() << "Input file:" << requiredArguments.at(0) << "Output PDF:" << requiredArguments.at(1);
if (requiredArguments.size() != 2) {
qCritical() << "Invalid number of arguments, expected 2 but got" << requiredArguments.size();
parser.showHelp(1);
}
+ qInfo() << "Input file:" << requiredArguments.at(0) << "Output PDF:" << requiredArguments.at(1);
qInfo() << "Creating PDF converter instance";
HtmltoPdfConverter converter(requiredArguments.at(0), requiredArguments.at(1));
diff --git a/reader/document/Model.cpp b/reader/document/Model.cpp
index f8401564..de20bf40 100755
--- a/reader/document/Model.cpp
+++ b/reader/document/Model.cpp
@@ -107,13 +107,10 @@ deepin_reader::Document *deepin_reader::DocumentFactory::getDocument(const int &
*pprocess = &decompressor;
decompressor.setWorkingDirectory(convertedFileDir);
qCInfo(appLog) << "Unzipping DOCX document:" << targetDoc;
- QString unzipCommand = "unzip " + targetDoc;
- qCDebug(appLog) << "执行命令: " << unzipCommand;
-#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
- decompressor.start(unzipCommand);
-#else
- decompressor.startCommand(unzipCommand);
-#endif
+ QStringList unzipArgs;
+ unzipArgs << targetDoc;
+ qCDebug(appLog) << "执行命令: unzip" << unzipArgs;
+ decompressor.start("unzip", unzipArgs);
if (!decompressor.waitForStarted()) {
qCritical() << "Failed to start unzip process for file:" << targetDoc;
error = deepin_reader::Document::ConvertFailed;
@@ -151,14 +148,10 @@ deepin_reader::Document *deepin_reader::DocumentFactory::getDocument(const int &
// qCDebug(appLog) << "文档" << targetDocFile.fileName() << "不存在!";
// }
QString pandocDataDir = prefix + "/share/pandoc/data";
- QString pandocCommand = QString("pandoc %1 --data-dir=%2 -o %3").arg(targetDoc).arg(pandocDataDir).arg(tmpHtmlFilePath);
-
- qCDebug(appLog) << "执行命令: " << pandocCommand;
-#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
- converter.start(pandocCommand);
-#else
- converter.startCommand(pandocCommand);
-#endif
+ QStringList pandocArgs;
+ pandocArgs << targetDoc << "--data-dir=" + pandocDataDir << "-o" << tmpHtmlFilePath;
+ qCDebug(appLog) << "执行命令: pandoc" << pandocArgs;
+ converter.start("pandoc", pandocArgs);
if (!converter.waitForStarted()) {
qCritical() << "Failed to start pandoc conversion process";
error = deepin_reader::Document::ConvertFailed;
@@ -189,13 +182,10 @@ deepin_reader::Document *deepin_reader::DocumentFactory::getDocument(const int &
converter2.setWorkingDirectory(convertedFileDir + "/word");
qCInfo(appLog) << "Converting HTML to PDF:" << realFilePath;
- QString htmltopdfCommand = getHtmlToPdfPath() + " " + tmpHtmlFilePath + " " + realFilePath;
- qCDebug(appLog) << "执行命令: " << htmltopdfCommand;
-#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
- converter2.start(htmltopdfCommand);
-#else
- converter2.startCommand(htmltopdfCommand);
-#endif
+ QStringList htmltopdfArgs;
+ htmltopdfArgs << tmpHtmlFilePath << realFilePath;
+ qCDebug(appLog) << "执行命令:" << getHtmlToPdfPath() << htmltopdfArgs;
+ converter2.start(getHtmlToPdfPath(), htmltopdfArgs);
if (!converter2.waitForStarted()) {
qCritical() << "Failed to start htmltopdf conversion process";
error = deepin_reader::Document::ConvertFailed;
diff --git a/reader/uiframe/DocTabBar.cpp b/reader/uiframe/DocTabBar.cpp
index d4ee8855..9733347a 100644
--- a/reader/uiframe/DocTabBar.cpp
+++ b/reader/uiframe/DocTabBar.cpp
@@ -74,11 +74,11 @@ int DocTabBar::indexOfFilePath(const QString &filePath)
void DocTabBar::insertSheet(DocSheet *sheet, int index)
{
- qCDebug(appLog) << "DocTabBar::insertSheet start - inserting sheet:" << sheet->filePath();
if (sheet == nullptr) {
qCWarning(appLog) << "Cannot insert null sheet";
return;
}
+ qCDebug(appLog) << "DocTabBar::insertSheet start - inserting sheet:" << sheet->filePath();
QString fileName = QFileInfo(sheet->filePath()).fileName();
diff --git a/reader/widgets/FindWidget.cpp b/reader/widgets/FindWidget.cpp
index 7246828c..6fd31d0d 100644
--- a/reader/widgets/FindWidget.cpp
+++ b/reader/widgets/FindWidget.cpp
@@ -81,7 +81,9 @@ void FindWidget::onSearchStart()
qCDebug(appLog) << "searchText != \"\" && m_lastSearchText != searchText";
m_lastSearchText = searchText;
setEditAlert(0);
- m_docSheet->startSearch(searchText);
+ if (m_docSheet) {
+ m_docSheet->startSearch(searchText);
+ }
m_findPrevButton->setDisabled(false);
m_findNextButton->setDisabled(false);
}