sieveeditorcentralwidget.cpp 2.02 KB
Newer Older
Laurent Montel's avatar
Laurent Montel committed
1
/*
2
   Copyright (C) 2014-2017 Montel Laurent <montel@kde.org>
Laurent Montel's avatar
Laurent Montel committed
3

Laurent Montel's avatar
Laurent Montel committed
4 5 6 7
   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.
Laurent Montel's avatar
Laurent Montel committed
8

Laurent Montel's avatar
Laurent Montel committed
9 10 11 12
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.
Laurent Montel's avatar
Laurent Montel committed
13

Laurent Montel's avatar
Laurent Montel committed
14 15 16 17
   You should have received a copy of the GNU General Public License
   along with this program; see the file COPYING.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
Laurent Montel's avatar
Laurent Montel committed
18 19 20
*/

#include "sieveeditorcentralwidget.h"
Laurent Montel's avatar
Laurent Montel committed
21 22
#include "sieveeditormainwidget.h"
#include "sieveeditorconfigureserverpage.h"
Laurent Montel's avatar
Laurent Montel committed
23

24
SieveEditorCentralWidget::SieveEditorCentralWidget(QWidget *parent, KActionCollection *ac)
Laurent Montel's avatar
Laurent Montel committed
25
    : QStackedWidget(parent)
Laurent Montel's avatar
Laurent Montel committed
26
{
Laurent Montel's avatar
Laurent Montel committed
27
    mConfigureWidget = new SieveEditorConfigureServerPage;
Laurent Montel's avatar
Laurent Montel committed
28
    connect(mConfigureWidget, &SieveEditorConfigureServerPage::configureClicked, this, &SieveEditorCentralWidget::configureClicked);
29
    connect(mConfigureWidget, &SieveEditorConfigureServerPage::importSieveSettings, this, &SieveEditorCentralWidget::importSieveSettings);
Laurent Montel's avatar
Laurent Montel committed
30
    addWidget(mConfigureWidget);
31
    mSieveEditorMainWidget = new SieveEditorMainWidget(ac);
32
    connect(mSieveEditorMainWidget, &SieveEditorMainWidget::serverSieveFound, this, &SieveEditorCentralWidget::slotServerSieveFound);
Laurent Montel's avatar
Laurent Montel committed
33 34
    addWidget(mSieveEditorMainWidget);
    setCurrentWidget(mConfigureWidget);
Laurent Montel's avatar
Laurent Montel committed
35 36 37 38 39
}

SieveEditorCentralWidget::~SieveEditorCentralWidget()
{
}
Laurent Montel's avatar
Laurent Montel committed
40 41 42

void SieveEditorCentralWidget::slotServerSieveFound(bool hasServer)
{
Laurent Montel's avatar
Laurent Montel committed
43
    if (hasServer) {
Laurent Montel's avatar
Laurent Montel committed
44
        setCurrentWidget(mSieveEditorMainWidget);
Laurent Montel's avatar
Laurent Montel committed
45
    } else {
Laurent Montel's avatar
Laurent Montel committed
46
        setCurrentWidget(mConfigureWidget);
Laurent Montel's avatar
Laurent Montel committed
47
    }
Laurent Montel's avatar
Laurent Montel committed
48 49 50 51 52 53
}

SieveEditorMainWidget *SieveEditorCentralWidget::sieveEditorMainWidget() const
{
    return mSieveEditorMainWidget;
}