Commit e25f3da8 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

continue to implement remotecontentconfiguredialog

parent afae82ce
Pipeline #45873 passed with stage
in 46 minutes and 3 seconds
......@@ -5,13 +5,48 @@
*/
#include "remotecontentconfiguredialog.h"
#include <KLocalizedString>
#include <QVBoxLayout>
#include <QDialogButtonBox>
#include <KConfigGroup>
#include <KSharedConfig>
namespace {
static const char myRemoteContentConfigureConfigGroupName[] = "RemoteContentConfigureDialog";
}
using namespace MessageViewer;
RemoteContentConfigureDialog::RemoteContentConfigureDialog(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(i18nc("@title:window", "Details"));
setAttribute(Qt::WA_DeleteOnClose);
auto mainLayout = new QVBoxLayout(this);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
connect(buttonBox, &QDialogButtonBox::accepted, this, &RemoteContentConfigureDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &RemoteContentConfigureDialog::reject);
mainLayout->addWidget(buttonBox);
readConfig();
}
RemoteContentConfigureDialog::~RemoteContentConfigureDialog()
{
writeConfig();
}
void RemoteContentConfigureDialog::readConfig()
{
KConfigGroup group(KSharedConfig::openConfig(), "myRemoteContentConfigureConfigGroupName");
const QSize size = group.readEntry("Size", QSize(600, 400));
if (size.isValid()) {
resize(size);
}
}
void RemoteContentConfigureDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openConfig(), "myRemoteContentConfigureConfigGroupName");
group.writeEntry("Size", size());
group.sync();
}
......@@ -16,6 +16,10 @@ class MESSAGEVIEWER_TESTS_EXPORT RemoteContentConfigureDialog : public QDialog
public:
explicit RemoteContentConfigureDialog(QWidget *parent = nullptr);
~RemoteContentConfigureDialog() override;
private:
void readConfig();
void writeConfig();
};
}
......
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