36
37
// set up text view, will automatically take care of logging
37
IRCViewBox* ircBox = new IRCViewBox(this); // Server will be set later in setServer()
38
IRCViewBox* ircBox = new IRCViewBox(this, 0); // Server will be set later in setServer()
38
39
setTextView(ircBox->ircView());
40
41
KHBox* commandLineBox=new KHBox(this);
46
47
nicknameCombobox->setSizeAdjustPolicy(KComboBox::AdjustToContents);
47
48
KLineEdit* nicknameComboboxLineEdit = qobject_cast<KLineEdit*>(nicknameCombobox->lineEdit());
48
49
if (nicknameComboboxLineEdit) nicknameComboboxLineEdit->setClearButtonShown(false);
49
nicknameCombobox->setWhatsThis(i18n("<qt><p>This shows your current nick, and any alternatives you have set up. If you select or type in a different nickname, then a request will be sent to the IRC server to change your nick. If the server allows it, the new nickname will be selected. If you type in a new nickname, you need to press 'Enter' at the end.</p><p>You can edit the alternative nicknames from the <em>Identities</em> option in the <em>Settings</em> menu.</p></qt>"));
50
nicknameCombobox->setWhatsThis(i18n("<qt><p>This shows your current nick, and any alternatives you have set up. If you select or type in a different nickname, then a request will be sent to the IRC server to change your nick. If the server allows it, the new nickname will be selected. If you type in a new nickname, you need to press 'Enter' at the end.</p><p>You can add change the alternative nicknames from the <em>Identities</em> option in the <em>File</em> menu.</p></qt>"));
51
52
awayLabel=new QLabel(i18n("(away)"), commandLineBox);
63
64
connect(statusInput,SIGNAL (submit()),this,SLOT(statusTextEntered()) );
64
65
connect(statusInput,SIGNAL (textPasted(const QString&)),this,SLOT(textPasted(const QString&)) );
65
66
connect(getTextView(), SIGNAL(textPasted(bool)), statusInput, SLOT(paste(bool)));
67
connect(getTextView(), SIGNAL(popupCommand(int)), this, SLOT(popupCommand(int)));
67
69
connect(nicknameCombobox,SIGNAL (activated(int)),this,SLOT(nicknameComboboxChanged()));
68
70
Q_ASSERT(nicknameCombobox->lineEdit()); //it should be editedable. if we design it so it isn't, remove these lines.
108
110
QString output(outList[index]);
110
112
// encoding stuff is done in Server()
111
Konversation::OutputFilterResult result = m_server->getOutputFilter()->parse(m_server->getNickname(), output, QString(), this);
113
Konversation::OutputFilterResult result = m_server->getOutputFilter()->parse(m_server->getNickname(), output, QString());
113
115
if(!result.output.isEmpty())
122
124
void StatusPanel::statusTextEntered()
124
QString line = sterilizeUnicode(statusInput->toPlainText());
126
QString line=sterilizeUnicode(statusInput->toPlainText());
126
127
statusInput->clear();
128
if (!line.isEmpty()) sendStatusText(line);
129
if(line.toLower()==Preferences::self()->commandChar()+"clear") textView->clear();
132
if(line.length()) sendStatusText(line);
131
136
void StatusPanel::textPasted(const QString& text)
147
152
void StatusPanel::updateAppearance()
149
if (Preferences::self()->showNicknameBox())
151
if (Preferences::self()->customTextFont())
152
nicknameCombobox->setFont(Preferences::self()->textFont());
154
nicknameCombobox->setFont(KGlobalSettings::generalFont());
156
nicknameCombobox->show();
159
nicknameCombobox->hide();
156
if (Preferences::self()->inputFieldsBackgroundColor())
158
fg = Preferences::self()->color(Preferences::ChannelMessage);
159
bg = Preferences::self()->color(Preferences::TextViewBackground);
163
fg = palette().windowText().color();
164
bg = palette().base().color();
167
QPalette statusInputPalette(statusInput->palette());
168
statusInputPalette.setColor(QPalette::WindowText, fg);
169
statusInputPalette.setColor(QPalette::Text, fg);
170
statusInputPalette.setColor(QPalette::Base, bg);
171
statusInput->setPalette(statusInputPalette);
174
if (Preferences::self()->customTextFont())
176
statusInput->setFont(Preferences::self()->textFont());
177
nicknameCombobox->setFont(Preferences::self()->textFont());
181
statusInput->setFont(KGlobalSettings::generalFont());
182
nicknameCombobox->setFont(KGlobalSettings::generalFont());
185
showNicknameBox(Preferences::self()->showNicknameBox());
161
187
ChatWindow::updateAppearance();
252
//FIXME: Show "Do you really want to close ..." warnings in
253
// disconnected state instead of closing directly. Can't do
254
// that due to string freeze at the moment.
226
255
if (confirm && !m_server->isConnected())
228
257
result = KMessageBox::warningContinueCancel(
325
347
void StatusPanel::serverOnline(bool online)
327
349
//statusInput->setEnabled(online);
350
getTextView()->setNickAndChannelContextMenusEnabled(online);
328
351
nicknameCombobox->setEnabled(online);
354
void StatusPanel::showNicknameBox(bool show)
358
nicknameCombobox->show();
362
nicknameCombobox->hide();
331
366
void StatusPanel::setServer(Server* server)
333
368
ChatWindow::setServer(server);
334
369
nicknameCombobox->setModel(m_server->nickListModel());
372
void StatusPanel::popupCommand(int command)
376
case Konversation::Join:
377
m_server->queue("JOIN " + getTextView()->currentChannel());
379
case Konversation::Topic:
380
m_server->requestTopic(getTextView()->currentChannel());
382
case Konversation::Names:
383
m_server->queue("NAMES " + getTextView()->currentChannel(), Server::LowPriority);
337
388
#include "statuspanel.moc"