Fix crash when encountering a topic with HTML tags
[quassel.git] / src / qtui / channellistdlg.cpp
index 093ec22..18bc5ef 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-08 by the Quassel Project                          *
+ *   Copyright (C) 2005-09 by the Quassel Project                          *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
 
 #include "channellistdlg.h"
 
-#include "client.h"
-#include "clientirclisthelper.h"
-
 #include <QHeaderView>
 #include <QHBoxLayout>
 #include <QSpacerItem>
 
+#include "client.h"
+#include "clientirclisthelper.h"
+#include "icon.h"
+#include "iconloader.h"
+
 ChannelListDlg::ChannelListDlg(QWidget *parent)
   : QDialog(parent),
     _listFinished(true),
@@ -38,8 +40,10 @@ ChannelListDlg::ChannelListDlg(QWidget *parent)
   _sortFilter.setSourceModel(&_ircListModel);
   _sortFilter.setFilterCaseSensitivity(Qt::CaseInsensitive);
   _sortFilter.setFilterKeyColumn(-1);
-  
+
   ui.setupUi(this);
+  ui.advancedModeLabel->setPixmap(BarIcon("edit-rename"));
+
   ui.channelListView->setSelectionBehavior(QAbstractItemView::SelectRows);
   ui.channelListView->setSelectionMode(QAbstractItemView::SingleSelection);
   ui.channelListView->setAlternatingRowColors(true);
@@ -51,6 +55,8 @@ ChannelListDlg::ChannelListDlg(QWidget *parent)
 
   ui.searchChannelsButton->setAutoDefault(false);
 
+  setWindowIcon(Icon("format-list-unordered"));
+
   connect(ui.advancedModeLabel, SIGNAL(clicked()), this, SLOT(toggleMode()));
   connect(ui.searchChannelsButton, SIGNAL(clicked()), this, SLOT(requestSearch()));
   connect(ui.channelNameLineEdit, SIGNAL(returnPressed()), this, SLOT(requestSearch()));
@@ -70,7 +76,7 @@ ChannelListDlg::ChannelListDlg(QWidget *parent)
 void ChannelListDlg::setNetwork(NetworkId netId) {
   if(_netId == netId)
     return;
-  
+
   _netId = netId;
   _ircListModel.setChannelList();
   showFilterLine(false);
@@ -86,8 +92,9 @@ void ChannelListDlg::requestSearch() {
 }
 
 void ChannelListDlg::receiveChannelList(const NetworkId &netId, const QStringList &channelFilters, const QList<IrcListHelper::ChannelDescription> &channelList) {
-  Q_UNUSED(netId)
   Q_UNUSED(channelFilters)
+  if(netId != _netId)
+    return;
 
   showFilterLine(!channelList.isEmpty());
   _ircListModel.setChannelList(channelList);
@@ -107,20 +114,22 @@ void ChannelListDlg::enableQuery(bool enable) {
 
 void ChannelListDlg::setAdvancedMode(bool advanced) {
   _advancedMode = advanced;
+
   if(advanced) {
     if(_simpleModeSpacer) {
       ui.searchLayout->removeItem(_simpleModeSpacer);
       delete _simpleModeSpacer;
       _simpleModeSpacer = 0;
     }
-    ui.advancedModeLabel->setPixmap(QPixmap(QString::fromUtf8(":/22x22/actions/oxygen/22x22/actions/edit-clear-locationbar-rtl.png")));
+    ui.advancedModeLabel->setPixmap(BarIcon("edit-clear-locationbar-rtl"));
   } else {
     if(!_simpleModeSpacer) {
       _simpleModeSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
       ui.searchLayout->insertSpacerItem(0, _simpleModeSpacer);
     }
-    ui.advancedModeLabel->setPixmap(QPixmap(QString::fromUtf8(":/22x22/actions/oxygen/22x22/actions/edit-clear.png")));
+    ui.advancedModeLabel->setPixmap(BarIcon("edit-rename"));
   }
+
   ui.channelNameLineEdit->clear();
   ui.channelNameLineEdit->setVisible(advanced);
   ui.searchPatternLabel->setVisible(advanced);