Commit f8ea2f6c authored by Laurent Montel's avatar Laurent Montel 😁

Add parent directly

parent 4bd0d450
......@@ -37,16 +37,15 @@ AutoCreateScriptDialog::AutoCreateScriptDialog(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(i18n("Create sieve filter"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::accepted, this, &AutoCreateScriptDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &AutoCreateScriptDialog::reject);
okButton->setFocus();
mEditor = new SieveEditorGraphicalModeWidget;
mEditor = new SieveEditorGraphicalModeWidget(this);
mainLayout->addWidget(mEditor);
mainLayout->addWidget(buttonBox);
readConfig();
......
......@@ -35,9 +35,8 @@ SelectFileIntoDialog::SelectFileIntoDialog(QWidget *parent)
setWindowTitle(i18n("Select folder"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
......
......@@ -34,10 +34,9 @@ SelectFlagsListDialog::SelectFlagsListDialog(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(i18n("Flags"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mListWidget = new SelectFlagsListWidget;
QVBoxLayout *mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
mListWidget = new SelectFlagsListWidget(this);
mainLayout->addWidget(mListWidget);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
......
......@@ -42,7 +42,7 @@ QStringList SieveEditorGraphicalModeWidget::sCapabilities = QStringList();
SieveEditorGraphicalModeWidget::SieveEditorGraphicalModeWidget(QWidget *parent)
: SieveEditorAbstractWidget(parent)
{
QVBoxLayout *vlay = new QVBoxLayout;
QVBoxLayout *vlay = new QVBoxLayout(this);
vlay->setMargin(0);
mSplitter = new QSplitter;
......@@ -63,7 +63,6 @@ SieveEditorGraphicalModeWidget::SieveEditorGraphicalModeWidget(QWidget *parent)
connect(mSieveParsingWarning, &SieveEditorParsingMissingFeatureWarning::switchToTextMode, this, &SieveEditorGraphicalModeWidget::slotSwitchToTextMode);
vlay->addWidget(mSieveParsingWarning);
setLayout(vlay);
readConfig();
}
......
......@@ -39,7 +39,7 @@ namespace KSieveUi
SieveForEveryPartWidget::SieveForEveryPartWidget(QWidget *parent)
: SieveWidgetPageAbstract(parent)
{
QVBoxLayout *topLayout = new QVBoxLayout;
QVBoxLayout *topLayout = new QVBoxLayout(this);
QWidget *w = new QWidget;
QHBoxLayout *lay = new QHBoxLayout;
......@@ -66,7 +66,6 @@ SieveForEveryPartWidget::SieveForEveryPartWidget(QWidget *parent)
connect(mForLoop, &QCheckBox::clicked, mName, &QLineEdit::setEnabled);
setPageType(KSieveUi::SieveScriptBlockWidget::ForEveryPart);
setLayout(topLayout);
}
SieveForEveryPartWidget::~SieveForEveryPartWidget()
......
......@@ -158,16 +158,15 @@ void SieveGlobalVariableActionWidget::updateAddRemoveButton(bool addButtonEnable
SieveGlobalVariableWidget::SieveGlobalVariableWidget(QWidget *parent)
: SieveWidgetPageAbstract(parent)
{
QVBoxLayout *lay = new QVBoxLayout;
mHelpButton = new SieveHelpButton;
QVBoxLayout *lay = new QVBoxLayout(this);
mHelpButton = new SieveHelpButton(this);
lay->addWidget(mHelpButton);
connect(mHelpButton, &SieveHelpButton::clicked, this, &SieveGlobalVariableWidget::slotHelp);
mIncludeLister = new SieveGlobalVariableLister;
mIncludeLister = new SieveGlobalVariableLister(this);
connect(mIncludeLister, &SieveGlobalVariableLister::valueChanged, this, &SieveGlobalVariableWidget::valueChanged);
lay->addWidget(mIncludeLister, 0, Qt::AlignTop);
setPageType(KSieveUi::SieveScriptBlockWidget::GlobalVariable);
setLayout(lay);
}
SieveGlobalVariableWidget::~SieveGlobalVariableWidget()
......
......@@ -40,7 +40,7 @@ SieveScriptBlockWidget::SieveScriptBlockWidget(QWidget *parent)
: SieveWidgetPageAbstract(parent),
mMatchCondition(AndCondition)
{
QVBoxLayout *topLayout = new QVBoxLayout;
QVBoxLayout *topLayout = new QVBoxLayout(this);
topLayout->setMargin(0);
mConditions = new QGroupBox(i18n("Conditions"));
......@@ -94,8 +94,6 @@ SieveScriptBlockWidget::SieveScriptBlockWidget(QWidget *parent)
connect(mAddBlockType, &QPushButton::clicked, this, &SieveScriptBlockWidget::slotAddBlock);
topLayout->addLayout(newBlockLayout);
setLayout(topLayout);
}
SieveScriptBlockWidget::~SieveScriptBlockWidget()
......
......@@ -33,15 +33,16 @@ SieveScriptDescriptionDialog::SieveScriptDescriptionDialog(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(i18n("Description"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mEdit = new KPIMTextEdit::PlainTextEditorWidget(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::accepted, this, &SieveScriptDescriptionDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &SieveScriptDescriptionDialog::reject);
mEdit = new KPIMTextEdit::PlainTextEditorWidget;
mainLayout->addWidget(mEdit);
mainLayout->addWidget(buttonBox);
......
......@@ -96,8 +96,8 @@ SieveScriptListBox::SieveScriptListBox(const QString &title, QWidget *parent)
: QGroupBox(title, parent),
mScriptNumber(0)
{
QVBoxLayout *layout = new QVBoxLayout();
mSieveListScript = new QListWidget;
QVBoxLayout *layout = new QVBoxLayout(this);
mSieveListScript = new QListWidget(this);
layout->addWidget(mSieveListScript);
//----------- the first row of buttons
......@@ -166,7 +166,6 @@ SieveScriptListBox::SieveScriptListBox(const QString &title, QWidget *parent)
hbHBoxLayout->addWidget(mBtnDescription);
layout->addWidget(hb);
setLayout(layout);
connect(mBtnNew, &QPushButton::clicked, this, &SieveScriptListBox::slotNew);
connect(mBtnDelete, &QPushButton::clicked, this, &SieveScriptListBox::slotDelete);
......
......@@ -41,23 +41,23 @@ SieveScriptPage::SieveScriptPage(QWidget *parent)
mGlobalVariableWidget(Q_NULLPTR),
mBlockIfWidget(Q_NULLPTR)
{
QVBoxLayout *topLayout = new QVBoxLayout;
QVBoxLayout *topLayout = new QVBoxLayout(this);
topLayout->setMargin(0);
mTabWidget = new SieveScriptTabWidget;
mTabWidget = new SieveScriptTabWidget(this);
connect(mTabWidget, &SieveScriptTabWidget::tabCloseRequested, this, &SieveScriptPage::slotCloseTab);
if (SieveEditorGraphicalModeWidget::sieveCapabilities().contains(QStringLiteral("include"))) {
mIncludeWidget = new SieveIncludeWidget;
mIncludeWidget = new SieveIncludeWidget(this);
connect(mIncludeWidget, &SieveIncludeWidget::valueChanged, this, &SieveScriptPage::valueChanged);
mTabWidget->addTab(mIncludeWidget, i18n("Includes"));
mGlobalVariableWidget = new SieveGlobalVariableWidget;
mGlobalVariableWidget = new SieveGlobalVariableWidget(this);
connect(mGlobalVariableWidget, &SieveGlobalVariableWidget::valueChanged, this, &SieveScriptPage::valueChanged);
mTabWidget->addTab(mGlobalVariableWidget, i18n("Global Variable"));
}
if (SieveEditorGraphicalModeWidget::sieveCapabilities().contains(QStringLiteral("foreverypart"))) {
mForEveryPartWidget = new SieveForEveryPartWidget;
mForEveryPartWidget = new SieveForEveryPartWidget(this);
connect(mForEveryPartWidget, &SieveForEveryPartWidget::valueChanged, this, &SieveScriptPage::valueChanged);
mTabWidget->addTab(mForEveryPartWidget, i18n("ForEveryPart"));
}
......@@ -66,7 +66,6 @@ SieveScriptPage::SieveScriptPage(QWidget *parent)
mTabWidget->addTab(mBlockIfWidget, blockName(KSieveUi::SieveScriptBlockWidget::BlockIf));
topLayout->addWidget(mTabWidget);
mTabWidget->setCurrentWidget(mBlockIfWidget);
setLayout(topLayout);
}
SieveScriptPage::~SieveScriptPage()
......
......@@ -34,17 +34,16 @@ SieveScriptParsingErrorDialog::SieveScriptParsingErrorDialog(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(i18n("Sieve Parsing Error"));
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mTextEdit = new KPIMTextEdit::RichTextEditorWidget(this);
mTextEdit->setReadOnly(true);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
QPushButton *user1Button = new QPushButton;
buttonBox->addButton(user1Button, QDialogButtonBox::ActionRole);
connect(buttonBox, &QDialogButtonBox::rejected, this, &SieveScriptParsingErrorDialog::reject);
user1Button->setText(i18n("Save As..."));
mTextEdit = new KPIMTextEdit::RichTextEditorWidget(this);
mTextEdit->setReadOnly(true);
readConfig();
connect(user1Button, &QPushButton::clicked, this, &SieveScriptParsingErrorDialog::slotSaveAs);
mainLayout->addWidget(mTextEdit);
......
......@@ -36,10 +36,7 @@ SieveDebugDialog::SieveDebugDialog(QWidget *parent)
mShutDownJob(Q_NULLPTR)
{
setWindowTitle(i18n("Sieve Diagnostics"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
connect(buttonBox, &QDialogButtonBox::rejected, this, &SieveDebugDialog::reject);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
// Collect all accounts
const Akonadi::AgentInstance::List lst = KSieveUi::Util::imapAgentInstances();
......@@ -50,6 +47,9 @@ SieveDebugDialog::SieveDebugDialog(QWidget *parent)
mEdit = new KPIMTextEdit::PlainTextEditorWidget(this);
mEdit->setReadOnly(true);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this);
connect(buttonBox, &QDialogButtonBox::rejected, this, &SieveDebugDialog::reject);
mainLayout->addWidget(mEdit);
mainLayout->addWidget(buttonBox);
......
......@@ -48,9 +48,9 @@ SieveEditor::SieveEditor(QWidget *parent)
d(new KSieveUi::SieveEditorPrivate)
{
setWindowTitle(i18n("Edit Sieve Script"));
QVBoxLayout *mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
d->mOkButton = buttonBox->button(QDialogButtonBox::Ok);
d->mOkButton->setDefault(true);
d->mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return);
......
......@@ -59,9 +59,8 @@ SieveTextEditWidget::~SieveTextEditWidget()
void SieveTextEditWidget::initialize(KSieveUi::SieveTextEdit *custom)
{
QVBoxLayout *mainLayout = new QVBoxLayout;
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setMargin(0);
setLayout(mainLayout);
if (custom) {
d->mTextEdit = custom;
} else {
......
......@@ -38,9 +38,8 @@ ParsingResultDialog::ParsingResultDialog(QWidget *parent)
setWindowTitle(i18n("Sieve Parsing"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
QPushButton *user1Button = new QPushButton;
QVBoxLayout *mainLayout = new QVBoxLayout(this);
QPushButton *user1Button = new QPushButton(this);
buttonBox->addButton(user1Button, QDialogButtonBox::ActionRole);
connect(buttonBox, &QDialogButtonBox::rejected, this, &ParsingResultDialog::reject);
user1Button->setText(i18n("Save As..."));
......
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