Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Factor out wait dialog from keycacheoverlay

The label + progressbar centered from the keycacheoverlay
is useful for other dialogs, too. So factor it out.
parent a43080fb
......@@ -102,6 +102,7 @@ set(_kleopatra_SRCS
view/nullpinwidget.cpp
view/tabwidget.cpp
view/keycacheoverlay.cpp
view/waitwidget.cpp
view/welcomewidget.cpp
dialogs/certificateselectiondialog.cpp
......
......@@ -35,10 +35,9 @@
#include <Libkleo/KeyCache>
#include "kleopatra_debug.h"
#include "waitwidget.h"
#include <QVBoxLayout>
#include <QProgressBar>
#include <QLabel>
#include <QEvent>
#include <KLocalizedString>
......@@ -55,30 +54,15 @@ KeyCacheOverlay::KeyCacheOverlay(QWidget *baseWidget, QWidget *parent)
return;
}
auto vLay = new QVBoxLayout(this);
auto bar = new QProgressBar;
auto label = new QLabel;
label->setText(QStringLiteral("<h3>%1</h3>").arg(i18n("Loading certificate cache...")));
bar->setRange(0, 0);
vLay->addStretch(1);
auto vLay = new QVBoxLayout;
auto subLay1 = new QVBoxLayout;
auto subLay3 = new QHBoxLayout;
subLay3->addStretch(1);
subLay3->addWidget(label);
subLay3->addStretch(1);
subLay1->addLayout(subLay3);
subLay1->addWidget(bar);
auto waitWidget = new WaitWidget(this);
auto subLay2 = new QHBoxLayout;
subLay2->addStretch(0.15);
subLay2->addLayout(subLay1, 0.7);
subLay2->addStretch(0.15);
waitWidget->setText(i18n("Loading certificate cache..."));
vLay->addLayout(subLay2);
vLay->addStretch(1);
vLay->addWidget(waitWidget);
setLayout(vLay);
mBaseWidget->installEventFilter(this);
mBaseWidget->setEnabled(false);
......
/* Copyright (c) 2017 Intevation GmbH
Kleopatra 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.
Kleopatra 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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "waitwidget.h"
#include <QProgressBar>
#include <QLabel>
#include <QHBoxLayout>
using namespace Kleo;
WaitWidget::WaitWidget(QWidget *parent)
: QWidget(parent)
{
auto vLay = new QVBoxLayout(this);
auto bar = new QProgressBar;
mLabel = new QLabel;
bar->setRange(0, 0);
vLay->addStretch(1);
auto subLay1 = new QVBoxLayout;
auto subLay3 = new QHBoxLayout;
subLay3->addStretch(1);
subLay3->addWidget(mLabel);
subLay3->addStretch(1);
subLay1->addLayout(subLay3);
subLay1->addWidget(bar);
auto subLay2 = new QHBoxLayout;
subLay2->addStretch(0.15);
subLay2->addLayout(subLay1, 0.7);
subLay2->addStretch(0.15);
vLay->addLayout(subLay2);
vLay->addStretch(1);
setLayout(vLay);
}
void WaitWidget::setText(const QString &text)
{
mLabel->setText(QStringLiteral("<h3>%1</h3>").arg(text));
}
WaitWidget::~WaitWidget()
{
}
/* Copyright (c) 2017 Intevation GmbH
Kleopatra 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.
Kleopatra 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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef KLEO_WAITWIDGET_H
#define KLEO_WAITWIDGET_H
#include <QWidget>
class QLabel;
namespace Kleo
{
class WaitWidget: public QWidget
{
Q_OBJECT
public:
explicit WaitWidget(QWidget *parent = nullptr);
~WaitWidget();
void setText(const QString &text);
private:
QLabel *mLabel;
};
} // namespace Kleo
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment