+ connect(_showNickListAction, SIGNAL(toggled(bool)), this, SLOT(showWidget(bool)));
+}
+
+NickListWidget::~NickListWidget() {
+ QtUiSettings s;
+ s.setValue("ShowNickListAction", showNickListAction()->isChecked());
+}
+
+void NickListWidget::setShowDockAction(QAction *action) {
+ _showDockAction = action;
+}
+
+QAction *NickListWidget::showDockAction() const {
+ return _showDockAction;
+}
+
+QAction *NickListWidget::showNickListAction() const {
+ return _showNickListAction;
+}
+
+void NickListWidget::showWidget(bool visible) {
+ if(!selectionModel())
+ return;
+
+ QModelIndex currentIndex = selectionModel()->currentIndex();
+ if(currentIndex.data(NetworkModel::BufferTypeRole) == BufferInfo::ChannelBuffer && showDockAction()) {
+ if(visible != showDockAction()->isChecked()) {
+ // show or hide
+ showDockAction()->trigger();
+ }
+ }
+}
+
+void NickListWidget::changedVisibility(bool visible) {
+ if(!selectionModel())
+ return;
+
+ QModelIndex currentIndex = selectionModel()->currentIndex();
+ if(currentIndex.data(NetworkModel::BufferTypeRole) == BufferInfo::ChannelBuffer && !visible) {
+ showNickListAction()->setChecked(false);
+ }