Commit 696d3d00 authored by Laurent Montel's avatar Laurent Montel 😁

Allow to save/load splitter position

parent d2736d6f
......@@ -77,6 +77,7 @@ void SieveScriptDebuggerDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openConfig(), "SieveScriptDebuggerDialog");
group.writeEntry("Size", size());
group.writeEntry("Splitter", mSieveScriptDebuggerWidget->splitterSizes());
}
void SieveScriptDebuggerDialog::readConfig()
......@@ -86,4 +87,6 @@ void SieveScriptDebuggerDialog::readConfig()
if (sizeDialog.isValid()) {
resize(sizeDialog);
}
QList<int> size{ 100 , 400};
mSieveScriptDebuggerWidget->setSplitterSizes(group.readEntry("Splitter", size));
}
......@@ -76,9 +76,9 @@ SieveScriptDebuggerFrontEndWidget::SieveScriptDebuggerFrontEndWidget(QWidget *pa
formLayout->addRow(extensionLab, mExtension);
QSplitter *splitter = new QSplitter(Qt::Vertical);
splitter->setObjectName(QStringLiteral("splitter"));
mainLayout->addWidget(splitter);
mSplitter = new QSplitter(Qt::Vertical);
mSplitter->setObjectName(QStringLiteral("splitter"));
mainLayout->addWidget(mSplitter);
QWidget *sieveEditorWidget = new QWidget(this);
QVBoxLayout *vboxSieveEditorLayout = new QVBoxLayout;
......@@ -94,13 +94,13 @@ SieveScriptDebuggerFrontEndWidget::SieveScriptDebuggerFrontEndWidget(QWidget *pa
vboxSieveEditorLayout->addWidget(mSieveTextEditWidget);
connect(mSieveTextEditWidget->textEdit(), &SieveTextEdit::say, textToSpeechWidget, &KPIMTextEdit::TextToSpeechWidget::say);
splitter->addWidget(sieveEditorWidget);
splitter->setChildrenCollapsible(false);
mSplitter->addWidget(sieveEditorWidget);
mSplitter->setChildrenCollapsible(false);
mSieveTestResult = new KPIMTextEdit::PlainTextEditorWidget(new KSieveUi::SieveScriptDebuggerResultEditor(this), this);
mSieveTestResult->setObjectName(QStringLiteral("sievetextresult"));
mSieveTestResult->setReadOnly(true);
splitter->addWidget(mSieveTestResult);
mSplitter->addWidget(mSieveTestResult);
mSieveScriptDebuggerWarning = new KSieveUi::SieveScriptDebuggerWarning(this);
mSieveScriptDebuggerWarning->setObjectName(QStringLiteral("sievescriptdebuggerwarning"));
......@@ -121,6 +121,17 @@ SieveScriptDebuggerFrontEndWidget::~SieveScriptDebuggerFrontEndWidget()
}
void SieveScriptDebuggerFrontEndWidget::setSplitterSizes(const QList<int> &sizes)
{
mSplitter->setSizes(sizes);
}
QList<int> SieveScriptDebuggerFrontEndWidget::splitterSizes() const
{
return mSplitter->sizes();
}
void SieveScriptDebuggerFrontEndWidget::slotEmailChanged(const QString &text)
{
mDebugScript->setEnabled(!text.trimmed().isEmpty());
......
......@@ -29,6 +29,7 @@ class KUrlRequester;
class QPushButton;
class QProcess;
class KLineEdit;
class QSplitter;
namespace KSieveUi
{
class SieveTextEditWidget;
......@@ -44,6 +45,9 @@ public:
void setScript(const QString &script);
bool canAccept() const;
QList<int> splitterSizes() const;
void setSplitterSizes(const QList<int> &sizes);
private Q_SLOTS:
void slotDebugScript();
void slotEmailChanged(const QString &text);
......@@ -59,6 +63,7 @@ private:
QPushButton *mDebugScript;
QProcess *mProcess;
KLineEdit *mExtension;
QSplitter *mSplitter;
};
}
#endif // SIEVESCRIPTDEBUGGERFONTENDWIDGET_H
......@@ -56,6 +56,17 @@ SieveScriptDebuggerWidget::~SieveScriptDebuggerWidget()
}
QList<int> SieveScriptDebuggerWidget::splitterSizes() const
{
return mSieveScriptFrontEnd->splitterSizes();
}
void SieveScriptDebuggerWidget::setSplitterSizes(const QList<int> &sizes)
{
mSieveScriptFrontEnd->setSplitterSizes(sizes);
}
bool SieveScriptDebuggerWidget::canAccept() const
{
return mSieveScriptFrontEnd->canAccept();
......
......@@ -37,6 +37,8 @@ public:
bool canAccept() const;
QList<int> splitterSizes() const;
void setSplitterSizes(const QList<int> &sizes);
private:
void checkSieveTestApplication();
QStackedWidget *mStackedWidget;
......
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