From ba81a3d454db0abd0b8e00a34a9da3b720af454f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be> Date: Mon, 21 Feb 2011 21:17:56 +0100 Subject: Remove Edit entry from MUC roster context menu. Resolves: #766 diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index 3e314e5..f056a1d 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -48,6 +48,7 @@ QtChatWindow::QtChatWindow(const QString &contact, QtChatTheme* theme, UIEventSt logRosterSplitter->addWidget(messageLog_); treeWidget_ = new QtTreeWidget(eventStream_); + treeWidget_->setEditable(false); treeWidget_->hide(); logRosterSplitter->addWidget(treeWidget_); logRosterSplitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); diff --git a/Swift/QtUI/Roster/QtTreeWidget.cpp b/Swift/QtUI/Roster/QtTreeWidget.cpp index 963ce72..e88e1bb 100644 --- a/Swift/QtUI/Roster/QtTreeWidget.cpp +++ b/Swift/QtUI/Roster/QtTreeWidget.cpp @@ -22,7 +22,7 @@ namespace Swift { -QtTreeWidget::QtTreeWidget(UIEventStream* eventStream, QWidget* parent) : QTreeView(parent) { +QtTreeWidget::QtTreeWidget(UIEventStream* eventStream, QWidget* parent) : QTreeView(parent), editable_(false) { eventStream_ = eventStream; model_ = new RosterModel(this); setModel(model_); @@ -76,6 +76,9 @@ void QtTreeWidget::handleItemActivated(const QModelIndex& index) { } void QtTreeWidget::contextMenuEvent(QContextMenuEvent* event) { + if (!editable_) { + return; + } QModelIndex index = indexAt(event->pos()); if (!index.isValid()) { return; diff --git a/Swift/QtUI/Roster/QtTreeWidget.h b/Swift/QtUI/Roster/QtTreeWidget.h index 3430f7e..ce2351b 100644 --- a/Swift/QtUI/Roster/QtTreeWidget.h +++ b/Swift/QtUI/Roster/QtTreeWidget.h @@ -23,6 +23,8 @@ class QtTreeWidget : public QTreeView{ QtTreeWidgetItem* getRoot(); void setRosterModel(Roster* roster); Roster* getRoster() {return roster_;} + void setEditable(bool b) { editable_ = b; } + private slots: void handleItemActivated(const QModelIndex&); void handleModelItemExpanded(const QModelIndex&, bool expanded); @@ -39,6 +41,7 @@ class QtTreeWidget : public QTreeView{ RosterDelegate* delegate_; QtTreeWidgetItem* treeRoot_; UIEventStream* eventStream_; + bool editable_; }; } -- cgit v0.10.2-6-g49f6