Skip to content

Commit

Permalink
Option to clear chat log without confirmation (closes #1041)
Browse files Browse the repository at this point in the history
  • Loading branch information
silentroach authored and machekku committed Jan 22, 2010
1 parent c62fe1f commit af5d8a7
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
1 change: 1 addition & 0 deletions options/default.xml
Expand Up @@ -103,6 +103,7 @@
<use-chat-says-style type="bool">false</use-chat-says-style>
<use-expanding-line-edit type="bool">true</use-expanding-line-edit>
<use-small-chats type="bool">false</use-small-chats>
<warn-before-clear type="bool">true</warn-before-clear>
</chat>
<contactlist comment="Contact list options">
<auto-delete-unlisted comment="Automatically remove an unlisted contact from the contact list if it does not have any pending messages anymore" type="bool">false</auto-delete-unlisted>
Expand Down
21 changes: 19 additions & 2 deletions src/groupchatdlg.cpp
Expand Up @@ -1018,9 +1018,26 @@ void GCMainDlg::doClear()

void GCMainDlg::doClearButton()
{
int n = QMessageBox::information(this, tr("Warning"), tr("Are you sure you want to clear the chat window?\n(note: does not affect saved history)"), tr("&Yes"), tr("&No"));
if(n == 0)
if (PsiOptions::instance()->getOption("options.ui.chat.warn-before-clear").toBool()) {
switch (
QMessageBox::warning(
this,
tr("Warning"),
tr("Are you sure you want to clear the chat window?\n(note: does not affect saved history)"),
QMessageBox::Yes, QMessageBox::YesAll, QMessageBox::No
)
) {
case QMessageBox::No:
break;
case QMessageBox::YesAll:
PsiOptions::instance()->setOption("options.ui.chat.warn-before-clear", false);
// fall-through
case QMessageBox::Yes:
doClear();
}
} else {
doClear();
}
}

void GCMainDlg::openFind()
Expand Down
21 changes: 19 additions & 2 deletions src/psichatdlg.cpp
Expand Up @@ -468,9 +468,26 @@ void PsiChatDlg::updatePGP()

void PsiChatDlg::doClearButton()
{
int n = QMessageBox::information(this, tr("Warning"), tr("Are you sure you want to clear the chat window?\n(note: does not affect saved history)"), tr("&Yes"), tr("&No"));
if (n == 0)
if (PsiOptions::instance()->getOption("options.ui.chat.warn-before-clear").toBool()) {
switch (
QMessageBox::warning(
this,
tr("Warning"),
tr("Are you sure you want to clear the chat window?\n(note: does not affect saved history)"),
QMessageBox::Yes, QMessageBox::YesAll, QMessageBox::No
)
) {
case QMessageBox::No:
break;
case QMessageBox::YesAll:
PsiOptions::instance()->setOption("options.ui.chat.warn-before-clear", false);
// fall-through
case QMessageBox::Yes:
doClear();
}
} else {
doClear();
}
}

void PsiChatDlg::setPGPEnabled(bool enabled)
Expand Down

0 comments on commit af5d8a7

Please sign in to comment.