added context menu to systray
authorAlexander von Renteln <phon@quassel-irc.org>
Thu, 24 Jan 2008 23:04:56 +0000 (23:04 +0000)
committerAlexander von Renteln <phon@quassel-irc.org>
Thu, 24 Jan 2008 23:04:56 +0000 (23:04 +0000)
hide topic and #users in bufferview per default
expand all categories in nickview per default

src/qtui/mainwin.cpp
src/uisupport/bufferview.cpp
src/uisupport/nickview.cpp
src/uisupport/nickview.h

index 6041d31..817a762 100644 (file)
@@ -70,6 +70,20 @@ void MainWin::init() {
   statusBar()->showMessage(tr("Not connected to core."));
   systray = new QSystemTrayIcon(this);
   systray->setIcon(QIcon(":/icons/quassel-icon.png"));
   statusBar()->showMessage(tr("Not connected to core."));
   systray = new QSystemTrayIcon(this);
   systray->setIcon(QIcon(":/icons/quassel-icon.png"));
+  
+  QString toolTip("left click to minimize the quassel client to tray");
+  systray->setToolTip(toolTip);
+  
+  QMenu *systrayMenu = new QMenu();
+  systrayMenu->addAction(ui.actionAboutQuassel);
+  systrayMenu->addSeparator();
+  systrayMenu->addAction(ui.actionConnectCore);
+  systrayMenu->addAction(ui.actionDisconnectCore);
+  systrayMenu->addSeparator();
+  systrayMenu->addAction(ui.actionQuit);
+  
+  systray->setContextMenu(systrayMenu);
+  
   systray->show();
   connect(systray, SIGNAL(activated( QSystemTrayIcon::ActivationReason )), 
           this, SLOT(systrayActivated( QSystemTrayIcon::ActivationReason )));
   systray->show();
   connect(systray, SIGNAL(activated( QSystemTrayIcon::ActivationReason )), 
           this, SLOT(systrayActivated( QSystemTrayIcon::ActivationReason )));
index fd4c245..37d0be5 100644 (file)
@@ -34,6 +34,8 @@ BufferView::BufferView(QWidget *parent) : QTreeView(parent) {
 void BufferView::init() {
   setIndentation(10);
   header()->setContextMenuPolicy(Qt::ActionsContextMenu);
 void BufferView::init() {
   setIndentation(10);
   header()->setContextMenuPolicy(Qt::ActionsContextMenu);
+  hideColumn(1);
+  hideColumn(2);
   expandAll();
 
   setAnimated(true);
   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);
     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);
     showSection->setProperty("column", i);
     connect(showSection, SIGNAL(toggled(bool)), this, SLOT(toggleHeader(bool)));
     header()->addAction(showSection);
index fe4b9e7..bc8d97c 100644 (file)
@@ -34,9 +34,7 @@ NickView::NickView(QWidget *parent) : QTreeView(parent) {
   setAnimated(true);
   setSortingEnabled(true);
   sortByColumn(0, Qt::AscendingOrder);
   setAnimated(true);
   setSortingEnabled(true);
   sortByColumn(0, Qt::AscendingOrder);
-
-//   filteredModel = new FilteredNickModel(this);
-//   QTreeView::setModel(filteredModel);
+  expandAll();
 }
 
 NickView::~NickView() {
 }
 
 NickView::~NickView() {
@@ -44,10 +42,11 @@ NickView::~NickView() {
 
 }
 
 
 }
 
-// void NickView::setModel(NickModel *model) {
-//   filteredModel->setSourceModel(model);
-//   expandAll();
-// }
+
+void NickView::setModel(QAbstractItemModel *model) {
+  QTreeView::setModel(model); 
+  expandAll();
+}
 
 void NickView::rowsInserted(const QModelIndex &index, int start, int end) {
   QTreeView::rowsInserted(index, start, end);
 
 void NickView::rowsInserted(const QModelIndex &index, int start, int end) {
   QTreeView::rowsInserted(index, start, end);
index 70206cb..42e920a 100644 (file)
@@ -37,8 +37,8 @@ class NickView : public QTreeView {
   protected:
     void rowsInserted(const QModelIndex &, int, int);
 
   protected:
     void rowsInserted(const QModelIndex &, int, int);
 
-//   public slots:
-//     void setModel(NickModel *model);
+  public slots:
+     void setModel(QAbstractItemModel *model);
 
 //   private:
 //     QSortFilterProxyModel *filteredModel;
 
 //   private:
 //     QSortFilterProxyModel *filteredModel;