[kde-doc-english] [trojita] src/Gui: GUI: keep the actions for disabling/enabling headers in action with their actual state when restoring
Jan Kundrát
jkt at flaska.net
Sun May 26 23:39:49 UTC 2013
Git commit 363d7f7fcf3d2f58024f3137c80f73fa9853a222 by Jan Kundrát.
Committed on 27/05/2013 at 00:33.
Pushed by jkt into branch 'master'.
GUI: keep the actions for disabling/enabling headers in action with their actual state when restoring
M +8 -0 src/Gui/MsgListView.cpp
M +1 -0 src/Gui/MsgListView.h
M +2 -0 src/Gui/Window.cpp
http://commits.kde.org/trojita/363d7f7fcf3d2f58024f3137c80f73fa9853a222
diff --git a/src/Gui/MsgListView.cpp b/src/Gui/MsgListView.cpp
index 0060aa8..dc01ecd 100644
--- a/src/Gui/MsgListView.cpp
+++ b/src/Gui/MsgListView.cpp
@@ -314,6 +314,14 @@ void MsgListView::slotHeaderSectionVisibilityToggled(int section)
}
}
+void MsgListView::updateActions()
+{
+ QList<QAction *> actions = header()->actions();
+ for (int i = 0; i < actions.size(); ++i) {
+ actions[i]->setChecked(!header()->isSectionHidden(i));
+ }
+}
+
/** @short Overridden from QTreeView::setModel
The whole point is that we have to listen for sortingPreferenceChanged to update your header view when sorting is requested
diff --git a/src/Gui/MsgListView.h b/src/Gui/MsgListView.h
index 426d84a..43232ca 100644
--- a/src/Gui/MsgListView.h
+++ b/src/Gui/MsgListView.h
@@ -49,6 +49,7 @@ public:
virtual ~MsgListView() {}
void setModel(QAbstractItemModel *model);
void setAutoActivateAfterKeyNavigation(bool enabled);
+ void updateActions();
protected:
void keyPressEvent(QKeyEvent *ke);
void keyReleaseEvent(QKeyEvent *ke);
diff --git a/src/Gui/Window.cpp b/src/Gui/Window.cpp
index 1c2b4f9..dff99b8 100644
--- a/src/Gui/Window.cpp
+++ b/src/Gui/Window.cpp
@@ -2158,6 +2158,8 @@ void MainWindow::applySizesAndState()
if (size-- && !stream.atEnd()) {
stream >> item;
msgListWidget->tree->header()->restoreState(item);
+ // got to manually update the state of the actions which control the visibility state
+ msgListWidget->tree->updateActions();
}
}
More information about the kde-doc-english
mailing list