1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-11 13:18:13 +03:00

exportdialog rephrase export button in second time

BUG:433735
This commit is contained in:
Michail Vourlakos 2021-03-01 19:22:27 +02:00
parent ddcfe56eda
commit c07b42b0b2
4 changed files with 18 additions and 2 deletions

View File

@ -43,7 +43,7 @@ ExportTemplateDialog::ExportTemplateDialog(SettingsDialog *parent, const QString
initExportButton(i18n("Export your selected layout as template"));
//! we must create handlers after creating/adjusting the ui
m_handler = new Handler::ExportTemplateHandler(this, layoutName, layoutId);
connect(m_handler, &Handler::ExportTemplateHandler::dataChanged, this, &ExportTemplateDialog::onDataChanged);
initSignals();
}
ExportTemplateDialog::ExportTemplateDialog(Latte::View *view)
@ -56,7 +56,7 @@ ExportTemplateDialog::ExportTemplateDialog(Latte::View *view)
initExportButton(i18n("Export your selected view as template"));
//! we must create handlers after creating/adjusting the ui
m_handler = new Handler::ExportTemplateHandler(this, view);
connect(m_handler, &Handler::ExportTemplateHandler::dataChanged, this, &ExportTemplateDialog::onDataChanged);
initSignals();
}
ExportTemplateDialog::~ExportTemplateDialog()
@ -102,6 +102,12 @@ void ExportTemplateDialog::initExportButton(const QString &tooltip)
m_ui->buttonBox->addButton(m_exportButton, QDialogButtonBox::AcceptRole);
}
void ExportTemplateDialog::initSignals()
{
connect(m_handler, &Handler::ExportTemplateHandler::dataChanged, this, &ExportTemplateDialog::onDataChanged);
connect(m_handler, &Handler::ExportTemplateHandler::exportSucceeded, this, &ExportTemplateDialog::onExportSucceeded);
}
QPushButton *ExportTemplateDialog::exportButton() const
{
return m_exportButton;
@ -112,6 +118,11 @@ void ExportTemplateDialog::onDataChanged()
m_ui->buttonBox->button(QDialogButtonBox::Reset)->setEnabled(!m_handler->inDefaultValues());
}
void ExportTemplateDialog::onExportSucceeded()
{
m_exportButton->setText(i18nc("export template", "Export Again"));
}
void ExportTemplateDialog::accept()
{
qDebug() << Q_FUNC_INFO;

View File

@ -72,10 +72,12 @@ protected:
private slots:
void onCancel();
void onDataChanged();
void onExportSucceeded();
void onReset();
void initButtons();
void initExportButton(const QString &tooltip);
void initSignals();
private:
void init();

View File

@ -234,6 +234,8 @@ void ExportTemplateHandler::onExport()
KMessageWidget::Information,
false,
actions);
emit exportSucceeded();
} else {
showExportTemplateError(QFileInfo(c_filepath).baseName());
}

View File

@ -80,6 +80,7 @@ public slots:
signals:
void filepathChanged();
void exportSucceeded();
private:
void init();