File indexing completed on 2024-05-05 05:44:50

0001 /***************************************************************************
0002  *   Copyright (C) 2016 Christian Ehrlicher <ch.ehrlicher@gmx.de>          *
0003  *                                                                         *
0004  *   This program is free software; you can redistribute it and/or modify  *
0005  *   it under the terms of the GNU General Public License as published by  *
0006  *   the Free Software Foundation; either version 2 of the License, or     *
0007  *   (at your option) any later version.                                   *
0008  *                                                                         *
0009  *   This program is distributed in the hope that it will be useful,       *
0010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0012  *   GNU General Public License for more details.                          *
0013  *                                                                         *
0014  *   You should have received a copy of the GNU General Public License     *
0015  *   along with this program; if not, write to the                         *
0016  *   Free Software Foundation, Inc.,                                       *
0017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
0018  ***************************************************************************/
0019 #pragma once
0020 
0021 #include <QDialog>
0022 
0023 class QDialogButtonBox;
0024 class QVBoxLayout;
0025 
0026 class KSvnDialog : public QDialog
0027 {
0028     Q_OBJECT
0029 public:
0030     explicit KSvnDialog(const QString &configGroupName, QWidget *parent = nullptr);
0031     ~KSvnDialog() override;
0032 
0033 protected:
0034     void setDefaultButton(QPushButton *defaultButton);
0035     void showEvent(QShowEvent *e) override;
0036 
0037 private:
0038     QString m_configGroupName;
0039 };
0040 
0041 class KSvnSimpleOkDialog : public KSvnDialog
0042 {
0043     Q_OBJECT
0044 public:
0045     explicit KSvnSimpleOkDialog(const QString &configGroupName, QWidget *parent = nullptr);
0046 
0047     /**
0048      * @brief Add a cancel button to the button box
0049      */
0050     void setWithCancelButton();
0051     /**
0052      * @brief Add a new widget to the VBoxLayout
0053      */
0054     void addWidget(QWidget *widget);
0055     /**
0056      * @brief Add the button box to the vbox layout.
0057      * only needed if exec() is not called
0058      * --> if it is not treated as modal dialog
0059      */
0060     void addButtonBox();
0061     /**
0062      * @brief Set the appropriate help context
0063      */
0064     void setHelp(const QString &context);
0065     int exec() override;
0066 
0067     QDialogButtonBox *buttonBox()
0068     {
0069         return m_bBox;
0070     }
0071 
0072 private Q_SLOTS:
0073     void onHelpRequested();
0074 
0075 private:
0076     QVBoxLayout *m_layout;
0077     QDialogButtonBox *m_bBox;
0078     bool m_bBoxAdded;
0079     QString m_helpContext;
0080 };