Making Quassel slowly ready for its first release...
[quassel.git] / src / qtui / nicklistwidget.cpp
index a7a78de..29a7d9b 100644 (file)
@@ -5,7 +5,7 @@
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
  *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
+ *   (at your option) version 3.                                           *
  *                                                                         *
  *   This program is distributed in the hope that it will be useful,       *
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
@@ -29,6 +29,10 @@ NickListWidget::NickListWidget(QWidget *parent) : QWidget(parent) {
 }
 
 void NickListWidget::setBuffer(Buffer *buf) {
+  if(!buf) {
+    ui.stackedWidget->setCurrentWidget(ui.emptyPage);
+    return;
+  }
   if(buf->bufferType() != Buffer::ChannelType) {
     ui.stackedWidget->setCurrentWidget(ui.emptyPage);
   } else {
@@ -43,3 +47,10 @@ void NickListWidget::setBuffer(Buffer *buf) {
     }
   }
 }
+
+void NickListWidget::reset() {
+  foreach(NickView *view, nickViews.values()) {
+    ui.stackedWidget->removeWidget(view);
+    view->deleteLater();
+  }
+}