File indexing completed on 2024-05-19 04:50:29

0001 /****************************************************************************************
0002  * Copyright (c) 2013 Konrad Zemek <konrad.zemek@gmail.com>                             *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #include "ConfigureProviderDialog.h"
0018 
0019 #include "statsyncing/Provider.h"
0020 
0021 #include <KLocalizedString>
0022 
0023 #include <QVBoxLayout>
0024 #include <QRadioButton>
0025 #include <QDebug>
0026 #include <KConfigGroup>
0027 #include <QPushButton>
0028 
0029 namespace StatSyncing
0030 {
0031 
0032 ConfigureProviderDialog::ConfigureProviderDialog( const QString &providerId,
0033                                                   QWidget *configWidget, QWidget *parent,
0034                                                   Qt::WindowFlags f )
0035     : KPageDialog( parent, f )
0036     , m_providerId( providerId )
0037 {
0038     setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
0039     setWindowTitle( i18n( "Configure Synchronization Target" ) );
0040     setModal( true );
0041     buttonBox()->button(QDialogButtonBox::Help)->setVisible(false);
0042 
0043     mainWidget = configWidget;
0044 
0045     connect( this, &ConfigureProviderDialog::accepted, this, &ConfigureProviderDialog::slotAccepted );
0046 }
0047 
0048 ConfigureProviderDialog::~ConfigureProviderDialog()
0049 {
0050 }
0051 
0052 void
0053 ConfigureProviderDialog::slotAccepted()
0054 {
0055     const ProviderConfigWidget *configWidget = qobject_cast<ProviderConfigWidget*>(mainWidget);
0056 
0057     Q_EMIT providerConfigured( m_providerId, configWidget->config() );
0058 }
0059 
0060 } // namespace StatSyncing