added context menu to systray
[quassel.git] / src / uisupport / bufferview.cpp
index a0d5b28..37d0be5 100644 (file)
@@ -34,6 +34,8 @@ BufferView::BufferView(QWidget *parent) : QTreeView(parent) {
 void BufferView::init() {
   setIndentation(10);
   header()->setContextMenuPolicy(Qt::ActionsContextMenu);
+  hideColumn(1);
+  hideColumn(2);
   expandAll();
 
   setAnimated(true);
@@ -73,7 +75,7 @@ void BufferView::setModel(QAbstractItemModel *model) {
     sectionName = (model->headerData(i, Qt::Horizontal, Qt::DisplayRole)).toString();
     showSection = new QAction(sectionName, header());
     showSection->setCheckable(true);
-    showSection->setChecked(true);
+    showSection->setChecked(!isColumnHidden(i));
     showSection->setProperty("column", i);
     connect(showSection, SIGNAL(toggled(bool)), this, SLOT(toggleHeader(bool)));
     header()->addAction(showSection);
@@ -113,5 +115,5 @@ void BufferView::rowsInserted(const QModelIndex & parent, int start, int end) {
 
 void BufferView::toggleHeader(bool checked) {
   QAction *action = qobject_cast<QAction *>(sender());
-  header()->setSectionHidden((action->property("column")).toInt(), not checked);
+  header()->setSectionHidden((action->property("column")).toInt(), !checked);
 }