File indexing completed on 2025-02-16 04:50:10
0001 /* 0002 SPDX-FileCopyrightText: 2015-2017 Krzysztof Nowicki <krissn@op.pl> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "ewsprogressdialog.h" 0008 0009 #include <KLocalizedString> 0010 0011 #include <QHBoxLayout> 0012 #include <QLabel> 0013 #include <QProgressBar> 0014 #include <QPushButton> 0015 #include <QVBoxLayout> 0016 0017 EwsProgressDialog::EwsProgressDialog(QWidget *parent, Type type) 0018 : QDialog(parent) 0019 { 0020 setModal(true); 0021 auto statusLabel = new QLabel(this); 0022 0023 auto progress = new QProgressBar(this); 0024 progress->setMaximum(0); 0025 0026 auto vLayout = new QVBoxLayout(this); 0027 0028 vLayout->setContentsMargins({}); 0029 0030 vLayout->addWidget(statusLabel); 0031 vLayout->addWidget(progress); 0032 0033 auto cancelButton = new QPushButton(this); 0034 cancelButton->setText(i18n("Cancel")); 0035 0036 auto progressContainer = new QWidget(this); 0037 progressContainer->setLayout(vLayout); 0038 0039 auto hLayout = new QHBoxLayout(this); 0040 0041 hLayout->addWidget(progressContainer); 0042 hLayout->addWidget(cancelButton); 0043 0044 hLayout->setSizeConstraint(QLayout::SetFixedSize); 0045 0046 switch (type) { 0047 case AutoDiscovery: 0048 setWindowTitle(i18nc("@title:window", "Exchange server autodiscovery")); 0049 statusLabel->setText(i18n("Performing Microsoft Exchange server autodiscovery...")); 0050 break; 0051 case TryConnect: 0052 setWindowTitle(i18nc("@title:window", "Connecting to Exchange")); 0053 statusLabel->setText(i18n("Connecting to Microsoft Exchange server...")); 0054 break; 0055 } 0056 0057 connect(cancelButton, &QPushButton::clicked, this, &QDialog::reject); 0058 } 0059 0060 EwsProgressDialog::~EwsProgressDialog() = default; 0061 0062 #include "moc_ewsprogressdialog.cpp"