167
226
QVBoxLayout *vb3 = new QVBoxLayout(sp_bottom, 4);
168
227
QHBoxLayout *hb3 = new QHBoxLayout(vb3);
169
d->tb_clear = new IconToolButton(sp_bottom);
170
connect(d->tb_clear, SIGNAL(clicked()), SLOT(doClearButton()));
171
QToolTip::add(d->tb_clear, tr("Clear chat window"));
172
hb3->addWidget(d->tb_clear);
176
//connect(pa->psi()->iconSelectPopup(), SIGNAL(iconSelected(const Icon *)), d, SLOT(addEmoticon(const Icon *)));
229
d->toolbar = new PsiToolBar(tr("Chat toolbar"), 0, sp_bottom);
230
d->toolbar->setCustomizeable( false ); // it isn't ready now, and we don't want segfaults
231
d->toolbar->setFrameShape( QFrame::NoFrame );
232
hb3->addWidget( d->toolbar );
234
d->act_clear = new IconAction (tr("Clear chat window"), "psi/clearChat", tr("Clear chat window"), 0, this);
235
connect( d->act_clear, SIGNAL( activated() ), SLOT( doClearButton() ) );
177
237
connect(pa->psi()->iconSelectPopup(), SIGNAL(textSelected(QString)), d, SLOT(addEmoticon(QString)));
178
d->tb_icon = new IconToolButton(sp_bottom);
179
d->tb_icon->setPopup(pa->psi()->iconSelectPopup());
180
d->tb_icon->setPopupDelay (1);
181
QToolTip::add(d->tb_icon, tr("Select icon"));
182
hb3->addWidget(d->tb_icon);
184
d->tb_file = new IconToolButton(sp_bottom);
185
connect(d->tb_file, SIGNAL(clicked()), SLOT(doFile()));
186
QToolTip::add(d->tb_file, tr("Send file"));
187
hb3->addWidget(d->tb_file);
189
d->tb_pgp = new IconToolButton(sp_bottom);
190
d->tb_pgp->setToggleButton(true);
191
QToolTip::add(d->tb_pgp, tr("Toggle encryption"));
192
hb3->addWidget(d->tb_pgp);
194
d->tb_info = new IconToolButton(sp_bottom);
195
connect(d->tb_info, SIGNAL(clicked()), SLOT(doInfo()));
196
QToolTip::add(d->tb_info, tr("User info"));
197
hb3->addWidget(d->tb_info);
199
d->tb_history = new IconToolButton(sp_bottom);
200
connect(d->tb_history, SIGNAL(clicked()), SLOT(doHistory()));
201
QToolTip::add(d->tb_history, tr("Message history"));
202
hb3->addWidget(d->tb_history);
238
d->act_icon = new IconAction( tr( "Select icon" ), "psi/smile", tr( "Select icon" ), 0, this );
239
d->act_icon->setPopup( pa->psi()->iconSelectPopup() );
241
d->act_file = new IconAction( tr( "Send file" ), "psi/upload", tr( "Send file" ), 0, this );
242
connect( d->act_file, SIGNAL( activated() ), SLOT( doFile() ) );
244
d->act_pgp = new IconAction( tr( "Toggle encryption" ), "psi/cryptoNo", tr( "Toggle encryption" ), 0, this, 0, true );
246
d->act_info = new IconAction( tr( "User info" ), "psi/vCard", tr( "User info" ), 0, this );
247
connect( d->act_info, SIGNAL( activated() ), SLOT( doInfo() ) );
249
d->act_history = new IconAction( tr( "Message history" ), "psi/history", tr( "Message history" ), 0, this );
250
connect( d->act_history, SIGNAL( activated() ), SLOT( doHistory() ) );
252
d->act_clear->addTo( d->toolbar );
253
d->toolbar->setStretchableWidget(new StretchWidget(d->toolbar));
255
d->act_icon->addTo( d->toolbar );
256
d->act_file->addTo( d->toolbar );
257
d->act_pgp->addTo( d->toolbar );
258
d->act_info->addTo( d->toolbar );
259
d->act_history->addTo( d->toolbar );
262
QHBoxLayout *hb4 = new QHBoxLayout(vb3);
204
265
d->mle = new ChatEdit(sp_bottom);
205
vb3->addWidget(d->mle);
266
hb4->addWidget(d->mle);
206
267
connect(d->mle, SIGNAL(textChanged()), d, SLOT(updateCounter()));
270
//d->avatar = new QLabel(sp_bottom);
271
//hb4->addWidget(d->avatar);
273
// FIXME: Maybe the psiaccount should do this, to avoid a signal to each
274
// open window when an avatar changes.
275
//connect(d->pa->avatarFactory(),SIGNAL(avatarChanged(const Jid&)), this, SLOT(updateAvatar(const Jid&)));
276
//connect(d->pa->psi(),SIGNAL(emitOptionsUpdate()), this, SLOT(updateAvatar()));
208
278
d->pm_settings=new QPopupMenu(this);
210
280
connect(d->pm_settings, SIGNAL(aboutToShow()), SLOT(buildMenu()));
497
633
d->lcd_count->hide();
499
if ( option.useEmoticons&& !d->smallChat )
504
635
// update contact info
505
636
d->status = -2; // sick way of making it redraw the status
506
637
updateContact(d->jid, false);
509
d->tb_clear->setIcon(IconsetFactory::iconPtr("psi/clearChat"));
510
d->tb_info->setIcon(IconsetFactory::iconPtr("psi/vCard"));
511
d->tb_history->setIcon(IconsetFactory::iconPtr("psi/history"));
512
d->tb_icon->setIcon(IconsetFactory::iconPtr("psi/smile"));
514
641
i.setPixmap(IconsetFactory::icon("psi/cryptoNo"), QIconSet::Automatic, QIconSet::Normal, QIconSet::Off);
515
642
i.setPixmap(IconsetFactory::icon("psi/cryptoYes"), QIconSet::Automatic, QIconSet::Normal, QIconSet::On);
516
d->tb_pgp->setIconSet( i );
517
d->tb_file->setIcon(IconsetFactory::iconPtr("psi/upload"));
643
d->act_pgp->setIcon( 0 );
644
d->act_pgp->setIconSet( i );
519
646
// update the widget icon
520
648
setIcon(IconsetFactory::icon("psi/chat"));
523
652
void ChatDlg::optionsUpdate()
654
if (option.oldSmallChats!=option.smallChats)
656
d->smallChat=option.smallChats;
883
1051
d->log->scrollToBottom();
1054
void ChatDlg::updateIsComposing(bool c)
1056
if (option.messageEvents && d->sendComposingEvents) {
1057
// Don't send to offline resource
1058
QPtrList<UserListItem> ul = d->pa->findRelavent(d->jid);
1060
d->sendComposingEvents = false;
1064
QString rname = d->jid.resource();
1065
UserListItem *u = ul.first();
1066
if(rname.isEmpty() && !u->isAvailable() || u->userResourceList().find(rname) == u->userResourceList().end()) {
1067
d->sendComposingEvents = false;
1071
// Send event message
1073
m.setEventId(d->eventId);
1075
m.addEvent(ComposingEvent);
1078
m.addEvent(CancelEvent);
1080
d->pa->dj_sendMessage(m, false);
1084
void ChatDlg::updateContactIsComposing(bool c)
1086
d->contactIsComposing = c;
886
1090
void ChatDlg::toggleSmallChat()
888
1092
if (d->smallChat)
895
1099
void ChatDlg::toggleEncryption()
897
d->tb_pgp->setOn(1-d->tb_pgp->isOn());
1101
d->act_pgp->setOn( !d->act_pgp->isOn() );
900
1104
void ChatDlg::buildMenu()
902
1107
d->pm_settings->clear();
903
d->pm_settings->insertItem("Toggle Compact/Full Size", this, SLOT(toggleSmallChat()));
904
d->pm_settings->insertItem(IconsetFactory::iconPtr("psi/clearChat")->pixmap(),"Clear Chat", this, SLOT(doClearButton()));
905
d->pm_settings->insertSeparator();
906
if (d->tb_pgp->isEnabled()) {
907
if (d->tb_pgp->isOn())
908
d->pm_settings->insertItem(IconsetFactory::icon("psi/cryptoYes").pixmap(),"Toggle Encryption", this, SLOT(toggleEncryption()));
910
d->pm_settings->insertItem(IconsetFactory::icon("psi/cryptoNo").pixmap(),"Toggle Encryption", this, SLOT(toggleEncryption()));
912
d->pm_settings->insertSeparator();
913
d->pm_settings->insertItem(IconsetFactory::iconPtr("psi/vCard")->pixmap(),"View User Profile", this, SLOT(doInfo()));
914
d->pm_settings->insertItem(IconsetFactory::iconPtr("psi/history")->pixmap(),"View History", this, SLOT(doHistory()));
1108
d->pm_settings->insertItem(tr("Toggle Compact/Full Size"), this, SLOT(toggleSmallChat()));
1110
d->act_clear->addTo( d->pm_settings );
1111
d->pm_settings->insertSeparator();
1113
d->act_icon->addTo( d->pm_settings );
1114
d->act_file->addTo( d->pm_settings );
1115
d->act_pgp->addTo( d->pm_settings );
1116
d->pm_settings->insertSeparator();
1118
d->act_info->addTo( d->pm_settings );
1119
d->act_history->addTo( d->pm_settings );
916
1122
#include "chatdlg.moc"