diff options
Diffstat (limited to 'src/core/function')
-rw-r--r-- | src/core/function/ArchiveFileOperator.cpp | 4 | ||||
-rw-r--r-- | src/core/function/gpg/GpgCommandExecutor.cpp | 2 | ||||
-rw-r--r-- | src/core/function/gpg/GpgContext.cpp | 14 |
3 files changed, 17 insertions, 3 deletions
diff --git a/src/core/function/ArchiveFileOperator.cpp b/src/core/function/ArchiveFileOperator.cpp index 2b76e4ac..475ef434 100644 --- a/src/core/function/ArchiveFileOperator.cpp +++ b/src/core/function/ArchiveFileOperator.cpp @@ -143,7 +143,11 @@ void ArchiveFileOperator::NewArchive2DataExchanger( #endif QFile file(source_path); +#ifdef QT5_BUILD + if (file.open(QIODevice::ReadOnly)) { +#else if (file.open(QIODeviceBase::ReadOnly)) { +#endif // turn absolute path to relative path auto relativ_path_name = base_path.relativeFilePath(source_path); archive_entry_set_pathname(entry, relativ_path_name.toUtf8()); diff --git a/src/core/function/gpg/GpgCommandExecutor.cpp b/src/core/function/gpg/GpgCommandExecutor.cpp index 6d24f9bd..66c18ae1 100644 --- a/src/core/function/gpg/GpgCommandExecutor.cpp +++ b/src/core/function/gpg/GpgCommandExecutor.cpp @@ -41,7 +41,7 @@ auto BuildTaskFromExecCtx(const GpgCommandExecutor::ExecuteContext &context) const auto &interact_function = context.int_func; const auto &cmd_executor_callback = context.cb_func; - const QString joined_argument = QStringList::fromVector(arguments).join(" "); + const QString joined_argument = arguments.join(" "); GF_CORE_LOG_DEBUG("building task: called cmd {} arguments size: {}", cmd, arguments.size()); diff --git a/src/core/function/gpg/GpgContext.cpp b/src/core/function/gpg/GpgContext.cpp index 6523386c..7c84d3c4 100644 --- a/src/core/function/gpg/GpgContext.cpp +++ b/src/core/function/gpg/GpgContext.cpp @@ -93,13 +93,23 @@ class GpgContext::Impl { const char *passphrase_info, int last_was_bad, int fd) -> gpgme_error_t { size_t res; - QString pass = "abcdefg\n"; +#ifdef QT5_BUILD + QString pass_qstr = "abcdefg\n"; + QByteArray pass = pass_qstr.toUtf8(); +#else + QString pass = "abcdefg\n"; +#endif + auto passpahrase_size = pass.size(); - size_t off = 0; do { +#ifdef QT5_BUILD + const char* p_pass = pass.data(); + res = gpgme_io_write(fd, &p_pass[off], passpahrase_size - off); +#else res = gpgme_io_write(fd, &pass[off], passpahrase_size - off); +#endif if (res > 0) off += res; } while (res > 0 && off != passpahrase_size); |