Commit 214c35f9 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix Bug 161598 - configuring templates: add "revert to default" to context menu

I don't add a new menu entry but a kmessagebox::questionyesnocancel to ask what we want to reset
FIXED-IN: 4.9
BUG: 161598
parent abb6ebf1
......@@ -91,10 +91,32 @@ void TemplatesConfiguration::slotTextChanged()
void TemplatesConfiguration::resetToDefault()
{
textEdit_new->setText( DefaultTemplates::defaultNewMessage() );
textEdit_reply->setText( DefaultTemplates::defaultReply() );
textEdit_reply_all->setText( DefaultTemplates::defaultReplyAll() );
textEdit_forward->setText( DefaultTemplates::defaultForward() );
const int choice = KMessageBox::questionYesNoCancel( 0, i18n( "Do you want to reset current template or all templates to default?" ) ,
i18n( "Reset to default" ),
KGuiItem(i18n( "Reset Current Template" )),
KGuiItem(i18n( "Reset All Templates" )),
KStandardGuiItem::cancel() );
if ( choice == KMessageBox::Cancel ) {
return;
} else if ( choice == KMessageBox::Yes ) {
const int toolboxCurrentIndex( toolBox1->currentIndex() );
if( toolBox1->widget( toolboxCurrentIndex ) == page_new ) {
textEdit_new->setText( DefaultTemplates::defaultNewMessage() );
} else if( toolBox1->widget( toolboxCurrentIndex ) == page_reply ) {
textEdit_reply->setText( DefaultTemplates::defaultReply() );
} else if( toolBox1->widget( toolboxCurrentIndex ) == page_reply_all ) {
textEdit_reply_all->setText( DefaultTemplates::defaultReplyAll() );
} else if( toolBox1->widget( toolboxCurrentIndex ) == page_forward ) {
textEdit_forward->setText( DefaultTemplates::defaultForward() );
} else {
kDebug() << "Unknown current page in TemplatesConfiguration!";
}
} else {
textEdit_new->setText( DefaultTemplates::defaultNewMessage() );
textEdit_reply->setText( DefaultTemplates::defaultReply() );
textEdit_reply_all->setText( DefaultTemplates::defaultReplyAll() );
textEdit_forward->setText( DefaultTemplates::defaultForward() );
}
lineEdit_quote->setText( DefaultTemplates::defaultQuoteString() );
}
......
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