Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion htmltopdf/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
34 changes: 12 additions & 22 deletions reader/document/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion reader/uiframe/DocTabBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 3 additions & 1 deletion reader/widgets/FindWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down