+AbstractChatView *MainWidget::createChatView(BufferId id) {
+ Q_UNUSED(id)
+ ChatWidget *widget = new ChatWidget(this);
+ AbstractChatView *chatView = static_cast<AbstractChatView *>(widget); // can't use dynamic_cast on some Qtopia devices
+ Q_ASSERT(chatView);
+ _chatViews[id] = widget;
+ ui.stack->addWidget(widget);
+ widget->setFocusProxy(this);
+ return chatView;
+}
+
+void MainWidget::removeChatView(BufferId id) {
+ ChatWidget *view = _chatViews.value(id, 0);
+ if(!view) return;
+ ui.stack->removeWidget(view);
+ view->deleteLater();
+}
+
+void MainWidget::showChatView(BufferId id) {
+ if(id.isValid()) currentBufferInfo = Client::buffer(id)->bufferInfo();
+ else currentBufferInfo = BufferInfo();
+ ChatWidget *widget = _chatViews.value(id, 0);
+ if(!widget) ui.stack->setCurrentIndex(0);
+ else {
+ ui.stack->setCurrentWidget(widget);
+ ui.inputLine->show(); ui.topicBar->show();
+ ui.inputLine->setFocus();
+ }
+}
+
+
+/*