Skip to content

Commit

Permalink
Also provide remote path folder wizard page with correct warn colour
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Sep 14, 2023
1 parent e717d2e commit f5db6d2
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
27 changes: 27 additions & 0 deletions src/gui/folderwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ FolderWizardRemotePath::FolderWizardRemotePath(const AccountPtr &account)
_ui.folderTreeWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
// Make sure that there will be a scrollbar when the contents is too wide
_ui.folderTreeWidget->header()->setStretchLastSection(false);

changeStyle();
}

void FolderWizardRemotePath::slotAddRemoteFolder()
Expand Down Expand Up @@ -524,6 +526,31 @@ void FolderWizardRemotePath::showWarn(const QString &msg) const
}
}

void FolderWizardRemotePath::changeEvent(QEvent *e)
{
switch (e->type()) {
case QEvent::StyleChange:
case QEvent::PaletteChange:
case QEvent::ThemeChange:
// Notify the other widgets (Dark-/Light-Mode switching)
changeStyle();
break;
default:
break;
}

FormatWarningsWizardPage::changeEvent(e);
}

void FolderWizardRemotePath::changeStyle()
{
const auto warnYellow = Theme::instance()->darkMode() ? QColor(63, 63, 0) : QColor(255, 255, 192);
auto modifiedPalette = _ui.warnLabel->palette();
modifiedPalette.setColor(QPalette::Window, warnYellow);
modifiedPalette.setColor(QPalette::Base, warnYellow);
_ui.warnLabel->setPalette(modifiedPalette);
}

// ====================================================================================

FolderWizardSelectiveSync::FolderWizardSelectiveSync(const AccountPtr &account)
Expand Down
7 changes: 6 additions & 1 deletion src/gui/folderwizard.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ class FolderWizardRemotePath : public FormatWarningsWizardPage
void cleanupPage() override;

protected slots:

void showWarn(const QString & = QString()) const;
void slotAddRemoteFolder();
void slotCreateRemoteFolder(const QString &);
Expand All @@ -110,6 +109,12 @@ protected slots:
void slotLsColFolderEntry();
void slotTypedPathFound(const QStringList &subpaths);

protected:
void changeEvent(QEvent *) override;

private slots:
void changeStyle();

private:
LsColJob *runLsColJob(const QString &path);
void recursiveInsert(QTreeWidgetItem *parent, QStringList pathTrail, QString path);
Expand Down

0 comments on commit f5db6d2

Please sign in to comment.