mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-12-01 06:12:52 -08:00
Fix various issues with KeeShare
* Fix #3790, shares now use the standard FileWatcher class to detect remote file changes using checksums and file system triggers.
* Fix #3895, macOS file selection no longer hangs the app.
* Restore saving of KeeShare settings accidentally removed by 596d2cf
This commit is contained in:
1 parent
ce7b34e96b
commit
dcff507e02
10 files changed
+104
-372
No files matched your search
+18
-30
@@ -21,6 +21,20 @@
|
||||
|
||||
#include <QDir>
|
||||
|
||||
namespace
|
||||
{
|
||||
QString modFilter(const QString& filter)
|
||||
{
|
||||
#ifdef Q_OS_MACOS
|
||||
// Fix macOS bug that causes the file dialog to freeze when a dot is included in the filters
|
||||
// See https://github.com/keepassxreboot/keepassxc/issues/3895#issuecomment-586724167
|
||||
auto mod = filter;
|
||||
return mod.replace("*.", "*");
|
||||
#endif
|
||||
return filter;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
FileDialog* FileDialog::m_instance(nullptr);
|
||||
|
||||
QString FileDialog::getOpenFileName(QWidget* parent,
|
||||
@@ -37,7 +51,7 @@ QString FileDialog::getOpenFileName(QWidget* parent,
|
||||
} else {
|
||||
const auto& workingDir = dir.isEmpty() ? config()->get(Config::LastDir).toString() : dir;
|
||||
const auto result = QDir::toNativeSeparators(
|
||||
QFileDialog::getOpenFileName(parent, caption, workingDir, filter, selectedFilter, options));
|
||||
QFileDialog::getOpenFileName(parent, caption, workingDir, modFilter(filter), selectedFilter, options));
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
// on Mac OS X the focus is lost after closing the native dialog
|
||||
@@ -63,7 +77,8 @@ QStringList FileDialog::getOpenFileNames(QWidget* parent,
|
||||
return results;
|
||||
} else {
|
||||
const auto& workingDir = dir.isEmpty() ? config()->get(Config::LastDir).toString() : dir;
|
||||
auto results = QFileDialog::getOpenFileNames(parent, caption, workingDir, filter, selectedFilter, options);
|
||||
auto results =
|
||||
QFileDialog::getOpenFileNames(parent, caption, workingDir, modFilter(filter), selectedFilter, options);
|
||||
|
||||
for (auto& path : results) {
|
||||
path = QDir::toNativeSeparators(path);
|
||||
@@ -82,33 +97,6 @@ QStringList FileDialog::getOpenFileNames(QWidget* parent,
|
||||
}
|
||||
}
|
||||
|
||||
QString FileDialog::getFileName(QWidget* parent,
|
||||
const QString& caption,
|
||||
const QString& dir,
|
||||
const QString& filter,
|
||||
QString* selectedFilter,
|
||||
const QFileDialog::Options options)
|
||||
{
|
||||
if (!m_nextFileName.isEmpty()) {
|
||||
const QString result = m_nextFileName;
|
||||
m_nextFileName.clear();
|
||||
return result;
|
||||
} else {
|
||||
const auto& workingDir = dir.isEmpty() ? config()->get(Config::LastDir).toString() : dir;
|
||||
const auto result = QDir::toNativeSeparators(
|
||||
QFileDialog::getSaveFileName(parent, caption, workingDir, filter, selectedFilter, options));
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
// on Mac OS X the focus is lost after closing the native dialog
|
||||
if (parent) {
|
||||
parent->activateWindow();
|
||||
}
|
||||
#endif
|
||||
saveLastDir(result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
QString FileDialog::getSaveFileName(QWidget* parent,
|
||||
const QString& caption,
|
||||
const QString& dir,
|
||||
@@ -123,7 +111,7 @@ QString FileDialog::getSaveFileName(QWidget* parent,
|
||||
} else {
|
||||
const auto& workingDir = dir.isEmpty() ? config()->get(Config::LastDir).toString() : dir;
|
||||
const auto result = QDir::toNativeSeparators(
|
||||
QFileDialog::getSaveFileName(parent, caption, workingDir, filter, selectedFilter, options));
|
||||
QFileDialog::getSaveFileName(parent, caption, workingDir, modFilter(filter), selectedFilter, options));
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
// on Mac OS X the focus is lost after closing the native dialog
|
||||
|
||||
Reference in new issue
Block a user