Commit 0d12e9ce authored by Laurent Montel's avatar Laurent Montel 😁

Allow to define default button in dialogbox

parent 4884b036
cmake_minimum_required(VERSION 3.5)
set(PIM_VERSION "5.10.42")
set(PIM_VERSION "5.10.43")
project(Akonadi VERSION ${PIM_VERSION})
set(CMAKE_CXX_STANDARD 14)
......
......@@ -24,6 +24,7 @@
#include <QDBusConnection>
#include <KAboutData>
#include <QDialogButtonBox>
#include <QSize>
namespace Akonadi {
......@@ -108,3 +109,8 @@ void AgentConfigurationBase::saveDialogSize(const QSize &size)
{
Q_UNUSED(size);
}
QDialogButtonBox::StandardButtons AgentConfigurationBase::standardButtons() const
{
return QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel;
}
......@@ -25,6 +25,7 @@
#include <QObject>
#include <KSharedConfig>
#include <QDialogButtonBox>
class KAboutData;
......@@ -136,6 +137,8 @@ public:
*/
virtual void saveDialogSize(const QSize &size);
virtual QDialogButtonBox::StandardButtons standardButtons() const;
protected:
QWidget *parentWidget() const;
......
......@@ -40,6 +40,7 @@
#include <KSharedConfig>
#include <KLocalizedString>
#include <QDialogButtonBox>
#include <memory>
......@@ -165,6 +166,14 @@ void AgentConfigurationWidget::saveDialogSize(const QSize &size)
}
}
QDialogButtonBox::StandardButtons AgentConfigurationWidget::standardButtons() const
{
if (d->plugin) {
return d->plugin->standardButtons();
}
return QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel;
}
void AgentConfigurationWidget::childEvent(QChildEvent *event)
{
if (event->added()) {
......
......@@ -20,6 +20,7 @@
#ifndef AKONADI_AGENTCONFIGURATIOWIDGET_H
#define AKONADI_AGENTCONFIGURATIOWIDGET_H
#include <QDialogButtonBox>
#include <QWidget>
#include "akonadiwidgets_export.h"
......@@ -43,6 +44,7 @@ public:
void save();
QSize restoreDialogSize() const;
void saveDialogSize(const QSize &size);
QDialogButtonBox::StandardButtons standardButtons() const;
protected:
void childEvent(QChildEvent *event) override;
......
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