Commit 5923142b authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Allow to show or not dialogbox

parent 55c24f5a
Pipeline #88671 passed with stage
in 4 minutes and 33 seconds
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
set(PIM_VERSION "5.18.40")
set(PIM_VERSION "5.18.41")
project(libkdepim VERSION ${PIM_VERSION})
......
......@@ -36,12 +36,12 @@ MultiplyingLineEditor::~MultiplyingLineEditor()
delete mMultiplyingLineFactory;
}
bool MultiplyingLineEditor::addData(const MultiplyingLineData::Ptr &data)
bool MultiplyingLineEditor::addData(const MultiplyingLineData::Ptr &data, bool showDialogBox)
{
MultiplyingLine *line = mView->emptyLine();
bool tooManyAddress = false;
if (!line) {
line = mView->addLine();
line = mView->addLine(showDialogBox);
}
if (!line) {
tooManyAddress = true;
......
......@@ -105,7 +105,7 @@ public:
@param data The data you want to add.
Can be used to add an empty/default line.
*/
bool addData(const MultiplyingLineData::Ptr &data = MultiplyingLineData::Ptr());
bool addData(const MultiplyingLineData::Ptr &data = MultiplyingLineData::Ptr(), bool showDialogBox = true);
/** Removes data provided it can be found. The Data class must support operator==
@param data The data you want to add.
......
......@@ -53,13 +53,15 @@ MultiplyingLine *MultiplyingLineView::emptyLine() const
return nullptr;
}
MultiplyingLine *MultiplyingLineView::addLine()
MultiplyingLine *MultiplyingLineView::addLine(bool showDialogBox)
{
const int maximumRecipients = mMultiplyingLineFactory->maximumRecipients();
if (maximumRecipients != -1) {
int numberOfLine = mLines.count();
if (numberOfLine++ >= maximumRecipients) {
KMessageBox::sorry(this, i18n("We can not add more recipients. We have reached maximum recipients"));
if (showDialogBox) {
KMessageBox::sorry(this, i18n("We can not add more recipients. We have reached maximum recipients"));
}
return nullptr;
}
......@@ -103,7 +105,7 @@ void MultiplyingLineView::slotReturnPressed(MultiplyingLine *line)
if (!line->data()->isEmpty()) {
MultiplyingLine *empty = emptyLine();
if (!empty) {
empty = addLine();
empty = addLine(true);
}
if (!empty) {
return;
......
......@@ -78,10 +78,10 @@ public:
bool dynamicSizeHint() const;
QList<MultiplyingLine *> lines() const;
MultiplyingLine *addLine(bool showDialogBox);
public Q_SLOTS:
void setCompletionMode(KCompletion::CompletionMode mode);
MultiplyingLine *addLine();
void setFocus();
void setFocusTop();
......
Supports Markdown
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