Commit 7957768c authored by Laurent Montel's avatar Laurent Montel 😁

Merge remote-tracking branch 'origin/Applications/17.04'

parents ec15282c 481f3d7d
......@@ -62,7 +62,8 @@ void LogActivitiesDialogTest::shouldHaveDefaultValue()
if (b->objectName() == QLatin1String("clearbutton")) {
hasClearButton = true;
QVERIFY(!b->text().isEmpty());
break;
} else if (b->objectName() == QLatin1String("savebutton")) {
QVERIFY(!b->isEnabled());
}
}
QVERIFY(hasClearButton);
......
......@@ -52,7 +52,10 @@ LogActivitiesDialog::LogActivitiesDialog(QWidget *parent)
mClearButton->setObjectName(QStringLiteral("clearbutton"));
buttonBox->addButton(mClearButton, QDialogButtonBox::ActionRole);
connect(mClearButton, &QPushButton::clicked, this, &LogActivitiesDialog::slotClear);
connect(buttonBox->button(QDialogButtonBox::Save), &QPushButton::clicked, this, &LogActivitiesDialog::slotSave);
QPushButton *saveButton = buttonBox->button(QDialogButtonBox::Save);
saveButton->setObjectName(QStringLiteral("savebutton"));
saveButton->setEnabled(false);;
connect(saveButton, &QPushButton::clicked, this, &LogActivitiesDialog::slotSave);
mainLayout->addWidget(buttonBox);
connect(buttonBox, &QDialogButtonBox::rejected, this, &LogActivitiesDialog::reject);
......@@ -60,6 +63,7 @@ LogActivitiesDialog::LogActivitiesDialog(QWidget *parent)
connect(PimCommon::LogActivitiesManager::self(), &LogActivitiesManager::logEntryAdded, this, &LogActivitiesDialog::slotLogEntryAdded);
connect(PimCommon::LogActivitiesManager::self(), &LogActivitiesManager::logEntryCleared, this, &LogActivitiesDialog::slotLogEntryCleared);
connect(mLogWidget, &LogActivitiesWidget::textChanged, saveButton, &QPushButton::setEnabled);
mEnableLogActivities->setChecked(PimCommon::LogActivitiesManager::self()->enableLogActivities());
}
......
......@@ -34,6 +34,7 @@ LogActivitiesWidget::LogActivitiesWidget(QWidget *parent)
mLog->setObjectName(QStringLiteral("log"));
mLog->setReadOnly(true);
mainLayout->addWidget(mLog);
connect(mLog->editor(), &KPIMTextEdit::PlainTextEditor::textChanged, this, &LogActivitiesWidget::slotTextChanged);
}
LogActivitiesWidget::~LogActivitiesWidget()
......@@ -41,6 +42,11 @@ LogActivitiesWidget::~LogActivitiesWidget()
}
void LogActivitiesWidget::slotTextChanged()
{
Q_EMIT textChanged(!mLog->editor()->document()->isEmpty());
}
void LogActivitiesWidget::addLogEntry(const QString &entry)
{
mLog->editor()->appendHtml(entry);
......
......@@ -37,7 +37,11 @@ public:
QString log() const;
void clear();
void addLogEntry(const QString &entry);
Q_SIGNALS:
void textChanged(bool changed);
private:
void slotTextChanged();
KPIMTextEdit::PlainTextEditorWidget *mLog;
};
}
......
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