// For license of this file, see <project-root-folder>/LICENSE.md.

#ifndef SETTINGSBROWSERMAIL_H
#define SETTINGSBROWSERMAIL_H

#include "gui/settings/settingspanel.h"
#include "miscellaneous/externaltool.h"

#include "ui_settingsbrowsermail.h"

class SettingsBrowserMail : public SettingsPanel {
    Q_OBJECT

  public:
    explicit SettingsBrowserMail(Settings* settings, QWidget* parent = nullptr);
    virtual ~SettingsBrowserMail();

    virtual QIcon icon() const;
    virtual QString title() const;
    virtual void loadSettings();
    virtual void saveSettings();
    virtual void loadUi();

  private slots:
    void addExternalTool();
    void editSelectedExternalTool();
    void deleteSelectedExternalTool();
    void changeDefaultBrowserArguments(int index);
    void selectBrowserExecutable();
    void changeDefaultEmailArguments(int index);
    void selectEmailExecutable();

  private:
    QString askForExecutable(const QString& old_exec) const;

  private:
    QVector<ExternalTool> externalTools() const;
    void setExternalTools(const QList<ExternalTool>& list);

    Ui::SettingsBrowserMail* m_ui;
};

inline QString SettingsBrowserMail::title() const {
  return tr("External apps & tools");
}

#endif // SETTINGSBROWSERMAIL_H
