|
|
|
|
@ -41,7 +41,7 @@ auto BaseExportJob::checkOverwriteBackgroundPDF(fs::path const& file) const -> b |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
auto BaseExportJob::getFilterName() -> string { |
|
|
|
|
auto BaseExportJob::getFilterName() const -> string { |
|
|
|
|
GtkFileFilter* filter = gtk_file_chooser_get_filter(GTK_FILE_CHOOSER(dialog)); |
|
|
|
|
return gtk_file_filter_get_name(filter); |
|
|
|
|
} |
|
|
|
|
@ -68,10 +68,10 @@ auto BaseExportJob::showFilechooser() -> bool { |
|
|
|
|
gtk_widget_destroy(dialog); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
this->filepath = Util::fromGFilename(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog))); |
|
|
|
|
Util::clearExtensions(this->filepath); |
|
|
|
|
auto file = Util::fromGFilename(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog))); |
|
|
|
|
Util::clearExtensions(file); |
|
|
|
|
// Since we add the extension after the OK button, we have to check manually on existing files
|
|
|
|
|
if (control->askToReplace(filepath)) { |
|
|
|
|
if (testAndSetFilepath(std::move(file)) && control->askToReplace(this->filepath)) { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -83,14 +83,17 @@ auto BaseExportJob::showFilechooser() -> bool { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
auto BaseExportJob::isUriValid(string& uri) -> bool { |
|
|
|
|
if (!StringUtils::startsWith(uri, "file://")) { |
|
|
|
|
string msg = FS(_F("Only local files are supported\nPath: {1}") % uri); |
|
|
|
|
auto BaseExportJob::testAndSetFilepath(fs::path file) -> bool { |
|
|
|
|
try { |
|
|
|
|
if(fs::is_directory(file.parent_path())){ |
|
|
|
|
this->filepath = std::move(file); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} catch (fs::filesystem_error const& e) { |
|
|
|
|
string msg = FS(_F("Failed to resolve path with the following error:\n{1}") % e.what()); |
|
|
|
|
XojMsgBox::showErrorToUser(control->getGtkWindow(), msg); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void BaseExportJob::afterRun() { |
|
|
|
|
|