File indexing completed on 2024-04-28 16:54:24

0001 /*
0002     SPDX-FileCopyrightText: 2022 Jonathan Marten <jjm@keelhaul.me.uk>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #pragma once
0007 
0008 #include <qdialog.h>
0009 
0010 #include "urlgrabber.h"
0011 
0012 class QLineEdit;
0013 class QRadioButton;
0014 class KIconButton;
0015 
0016 class EditCommandDialog : public QDialog
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     explicit EditCommandDialog(const ClipCommand &command, QWidget *parent);
0022     ~EditCommandDialog() override = default;
0023 
0024     /**
0025      * Retrieves the updated command
0026      */
0027     const ClipCommand &command() const
0028     {
0029         return (m_command);
0030     }
0031 
0032 private Q_SLOTS:
0033     void slotAccepted();
0034     void slotUpdateButtons();
0035 
0036 private:
0037     /**
0038      * Updates dialog's widgets according to values in m_command
0039      */
0040     void updateWidgets();
0041 
0042     /**
0043      * Saves values from widgets to m_command
0044      */
0045     void saveCommand();
0046 
0047 private:
0048     ClipCommand m_command;
0049 
0050     QLineEdit *m_commandEdit;
0051     QLineEdit *m_descriptionEdit;
0052 
0053     QRadioButton *m_ignoreRadio;
0054     QRadioButton *m_appendRadio;
0055     QRadioButton *m_replaceRadio;
0056     KIconButton *m_iconButton;
0057 
0058     QPushButton *m_okButton;
0059 };