204
205
pm_settings_ = new QMenu(this);
205
206
connect(pm_settings_, SIGNAL(aboutToShow()), SLOT(buildMenu()));
206
207
ui_.tb_actions->setMenu(pm_settings_);
208
ui_.tb_actions->setStyleSheet(" QToolButton::menu-indicator { image:none } ");
208
210
connect(account()->capsManager(), SIGNAL(capsChanged(const Jid&)), SLOT(capsChanged(const Jid&)));
468
470
void PsiChatDlg::doClearButton()
470
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"));
472
if (PsiOptions::instance()->getOption("options.ui.chat.warn-before-clear").toBool()) {
474
QMessageBox::warning(
477
tr("Are you sure you want to clear the chat window?\n(note: does not affect saved history)"),
478
QMessageBox::Yes, QMessageBox::YesAll, QMessageBox::No
481
case QMessageBox::No:
483
case QMessageBox::YesAll:
484
PsiOptions::instance()->setOption("options.ui.chat.warn-before-clear", false);
486
case QMessageBox::Yes:
475
494
void PsiChatDlg::setPGPEnabled(bool enabled)
507
526
ui_.lb_count->setNum(chatEdit()->toPlainText().length());
510
void PsiChatDlg::appendEmoteMessage(SpooledType spooled, const QDateTime& time, bool local, QString txt)
529
void PsiChatDlg::appendEmoteMessage(SpooledType spooled, const QDateTime& time, bool local, const QString& txt, const QString& subject)
512
531
updateLastMsgTime(time);
513
532
QString color = colorString(local, spooled);
514
533
QString timestr = chatView()->formatTimeStamp(time);
516
chatView()->appendText(QString("<span style=\"color: %1\">").arg(color) + QString("[%1]").arg(timestr) + QString(" *%1 ").arg(whoNick(local)) + txt + "</span>");
535
if (subject.isEmpty()) {
536
chatView()->appendText(QString("<span style=\"color: %1\">").arg(color) + QString("[%1]").arg(timestr) + QString(" *%1 ").arg(whoNick(local)) + txt + "</span>");
538
chatView()->appendText(QString("<span style=\"color: %1\">").arg(color) + QString("[%1]").arg(timestr) + "</span><br><b>" + tr("Subject:") + "</b> " + subject);
539
chatView()->appendText(QString("<span style=\"color: %1\">").arg(color) + QString(" *%1 ").arg(whoNick(local)) + txt + "</span>");
519
void PsiChatDlg::appendNormalMessage(SpooledType spooled, const QDateTime& time, bool local, QString txt)
544
void PsiChatDlg::appendNormalMessage(SpooledType spooled, const QDateTime& time, bool local, const QString& txt, const QString& subject)
521
546
updateLastMsgTime(time);
522
547
QString color = colorString(local, spooled);
523
548
QString timestr = chatView()->formatTimeStamp(time);
550
if (!subject.isEmpty()) {
551
subjectLine = "<b>" + tr("Subject:") + "</b> " + subject;
525
554
if (PsiOptions::instance()->getOption("options.ui.chat.use-chat-says-style").toBool()) {
526
chatView()->appendText(QString("<p style=\"color: %1\">").arg(color) + QString("[%1] ").arg(timestr) + tr("%1 says:").arg(whoNick(local)) + "</p>" + txt);
555
chatView()->appendText(QString("<span style=\"color: %1\">").arg(color) + QString("[%1] ").arg(timestr) + tr("%1 says:").arg(whoNick(local)) + "</span>");
556
if (!subjectLine.isEmpty()) {
557
chatView()->appendText(subjectLine);
559
chatView()->appendText(txt);
529
chatView()->appendText(QString("<span style=\"color: %1\">").arg(color) + QString("[%1] <").arg(timestr) + whoNick(local) + QString("></span> ") + txt);
562
QString intro = QString("<span style=\"color: %1\">").arg(color) + QString("[%1] <").arg(timestr) + whoNick(local) + QString("></span>");
563
if (subjectLine.isEmpty()) {
564
chatView()->appendText(intro + " " + txt);
566
chatView()->appendText(intro);
567
chatView()->appendText(subjectLine);
568
chatView()->appendText(txt);
533
574
void PsiChatDlg::appendMessageFields(const Message& m)
535
if (!m.subject().isEmpty()) {
536
chatView()->appendText(QString("<b>") + tr("Subject:") + "</b> " + QString("%1").arg(Qt::escape(m.subject())));
576
// if (!m.subject().isEmpty()) {
577
// chatView()->appendText(QString("<b>") + tr("Subject:") + "</b> " + QString("%1").arg(Qt::escape(m.subject())));
538
579
if (!m.urlList().isEmpty()) {
539
580
UrlList urls = m.urlList();
540
581
chatView()->appendText(QString("<i>") + tr("-- Attached URL(s) --") + "</i>");
564
605
QString PsiChatDlg::colorString(bool local, ChatDlg::SpooledType spooled) const
566
607
if (spooled == ChatDlg::Spooled_OfflineStorage) {
567
return PsiOptions::instance()->getOption("options.ui.look.colors.messages.informational").toString();
608
return ColorOpt::instance()->color("options.ui.look.colors.messages.informational").name();
571
return PsiOptions::instance()->getOption("options.ui.look.colors.messages.sent").toString();
612
return ColorOpt::instance()->color("options.ui.look.colors.messages.sent").name();
574
return PsiOptions::instance()->getOption("options.ui.look.colors.messages.received").toString();
615
return ColorOpt::instance()->color("options.ui.look.colors.messages.received").name();
577
618
ChatView* PsiChatDlg::chatView() const