1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-02-02 09:55:55 +00:00

Open correct directory when clicked on Browse button

PR #16252.
This commit is contained in:
Vladimir Golovnev 2022-01-27 07:41:30 +03:00 committed by GitHub
parent ca9e5e8531
commit 9818c7b6a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View File

@ -111,8 +111,12 @@ FileSystemPathEdit::FileSystemPathEditPrivate::FileSystemPathEditPrivate(
void FileSystemPathEdit::FileSystemPathEditPrivate::browseActionTriggered()
{
Q_Q(FileSystemPathEdit);
const QFileInfo fileInfo {q->selectedPath()};
const QString directory = (m_mode == FileSystemPathEdit::Mode::DirectoryOpen) || (m_mode == FileSystemPathEdit::Mode::DirectorySave)
? fileInfo.absoluteFilePath()
: fileInfo.absolutePath();
QString filter = q->fileNameFilter();
QString directory = q->currentDirectory().isEmpty() ? QDir::homePath() : q->currentDirectory();
QString selectedPath;
switch (m_mode)
@ -308,11 +312,6 @@ void FileSystemPathEdit::setDialogCaption(const QString &caption)
d->m_dialogCaption = caption;
}
QString FileSystemPathEdit::currentDirectory() const
{
return QFileInfo(selectedPath()).absoluteDir().absolutePath();
}
QWidget *FileSystemPathEdit::editWidgetImpl() const
{
Q_D(const FileSystemPathEdit);

View File

@ -64,7 +64,6 @@ public:
Mode mode() const;
void setMode(Mode mode);
QString currentDirectory() const;
QString selectedPath() const;
void setSelectedPath(const QString &val);