Skip to content

Commit

Permalink
Prepend drives to places for custom filedialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
sithlord48 committed Jun 26, 2022
1 parent fb79b55 commit c8e26d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/bcsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ void BCSettings::initSettings()
#endif //STATIC
if (settings->value(SETTINGS::SIDEBARURLS).isNull()) {
QStringList defaultBarUrls;
defaultBarUrls.append(QDir::rootPath());
defaultBarUrls.append(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
if (!settings->value(SETTINGS::LOADPATH).toString().isEmpty())
defaultBarUrls.append(settings->value(SETTINGS::LOADPATH).toString());
Expand Down
4 changes: 3 additions & 1 deletion src/dialogs/bcdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ void BCDialog::editSideBarPaths(QWidget *parent)
dialog.reject();
else if (button == btnBox.button(QDialogButtonBox::RestoreDefaults)) {
listWidget.clear();
listWidget.addItem(QDir::rootPath());
listWidget.addItem(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
if(!BCSettings::instance()->value(SETTINGS::LOADPATH).toString().isEmpty())
listWidget.addItem(BCSettings::instance()->value(SETTINGS::LOADPATH).toString());
Expand Down Expand Up @@ -288,6 +287,9 @@ QFileDialog* BCDialog::getFileDialog(QWidget *parent, const QString &title, cons
dialog->setLabelText(QFileDialog::LookIn, QObject::tr("Places"));

QList<QUrl> sideBarUrls;
const QFileInfoList drives = QDir::drives();
for (const QFileInfo &drive : drives)
sideBarUrls.append(QUrl::fromLocalFile(drive.path()));
const QStringList SideBarUrls = BCSettings::instance()->value(SETTINGS::SIDEBARURLS).toStringList();
for(const QString &url : SideBarUrls)
sideBarUrls.append(QUrl::fromLocalFile(url));
Expand Down

0 comments on commit c8e26d0

Please sign in to comment.