aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Haumann <dhaumann@kde.org>2014-01-24 23:50:33 (GMT)
committerDominik Haumann <dhaumann@kde.org>2014-01-24 23:50:33 (GMT)
commitb2f42a5150adbc3fda4e9c76c706f90c8d7eccd2 (patch)
tree326cc4db4cb0cf46f7af5b52723f382e60e9d503
parentb2009c8357b56e1bcfd3c623352da96c25178f15 (diff)
merge show/hide single-view-mode
disable create/remove viewspace actions if in single-view-mode remaining bug: if you quit kate and restart, the splitter settings are gone/broken. Ugly... hm...
-rw-r--r--kate/data/kateui.rc3
-rw-r--r--kate/src/kateviewmanager.cpp72
-rw-r--r--kate/src/kateviewmanager.h8
-rw-r--r--kate/src/kateviewspace.cpp1
4 files changed, 33 insertions, 51 deletions
diff --git a/kate/data/kateui.rc b/kate/data/kateui.rc
index a4ec482..093854b 100644
--- a/kate/data/kateui.rc
+++ b/kate/data/kateui.rc
@@ -1,5 +1,5 @@
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui name="kate" version="75">
+<kpartgui name="kate" version="76">
<MenuBar>
<Menu name="file" noMerge="1"><text>&amp;File</text>
@@ -62,7 +62,6 @@
<Action name="view_close_others"/>
<Separator />
<Action name="view_hide_others"/>
- <Action name="view_show_others"/>
<Separator />
<Action name="view_split_move_left" />
<Action name="view_split_move_right" />
diff --git a/kate/src/kateviewmanager.cpp b/kate/src/kateviewmanager.cpp
index 45bbaa4..b64e65c 100644
--- a/kate/src/kateviewmanager.cpp
+++ b/kate/src/kateviewmanager.cpp
@@ -129,21 +129,21 @@ void KateViewManager::setupActions()
/**
* view splitting
*/
- QAction *a = m_mainWindow->actionCollection()->addAction(QStringLiteral("view_split_vert"));
- a->setIcon(QIcon::fromTheme(QStringLiteral("view-split-left-right")));
- a->setText(i18n("Split Ve&rtical"));
- a->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_L);
- connect(a, SIGNAL(triggered()), this, SLOT(slotSplitViewSpaceVert()));
+ m_splitViewVert = m_mainWindow->actionCollection()->addAction(QStringLiteral("view_split_vert"));
+ m_splitViewVert->setIcon(QIcon::fromTheme(QStringLiteral("view-split-left-right")));
+ m_splitViewVert->setText(i18n("Split Ve&rtical"));
+ m_splitViewVert->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_L);
+ connect(m_splitViewVert, SIGNAL(triggered()), this, SLOT(slotSplitViewSpaceVert()));
- a->setWhatsThis(i18n("Split the currently active view vertically into two views."));
+ m_splitViewVert->setWhatsThis(i18n("Split the currently active view vertically into two views."));
- a = m_mainWindow->actionCollection()->addAction(QStringLiteral("view_split_horiz"));
- a->setIcon(QIcon::fromTheme(QStringLiteral("view-split-top-bottom")));
- a->setText(i18n("Split &Horizontal"));
- a->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_T);
- connect(a, SIGNAL(triggered()), this, SLOT(slotSplitViewSpaceHoriz()));
+ m_splitViewHoriz = m_mainWindow->actionCollection()->addAction(QStringLiteral("view_split_horiz"));
+ m_splitViewHoriz->setIcon(QIcon::fromTheme(QStringLiteral("view-split-top-bottom")));
+ m_splitViewHoriz->setText(i18n("Split &Horizontal"));
+ m_splitViewHoriz->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_T);
+ connect(m_splitViewHoriz, SIGNAL(triggered()), this, SLOT(slotSplitViewSpaceHoriz()));
- a->setWhatsThis(i18n("Split the currently active view horizontally into two views."));
+ m_splitViewHoriz->setWhatsThis(i18n("Split the currently active view horizontally into two views."));
m_closeView = m_mainWindow->actionCollection()->addAction(QStringLiteral("view_close_current_space"));
m_closeView->setIcon(QIcon::fromTheme(QStringLiteral("view-close")));
@@ -163,17 +163,11 @@ void KateViewManager::setupActions()
m_hideOtherViews = m_mainWindow->actionCollection()->addAction(QStringLiteral("view_hide_others"));
m_hideOtherViews->setIcon(QIcon::fromTheme(QStringLiteral("view-fullscreen")));
m_hideOtherViews->setText(i18n("Hide Inactive Views"));
- connect(m_hideOtherViews, SIGNAL(triggered()), this, SLOT(slotHideOtherViews()), Qt::QueuedConnection);
+ m_hideOtherViews->setCheckable(true);
+ connect(m_hideOtherViews, SIGNAL(triggered(bool)), this, SLOT(slotHideOtherViews(bool)), Qt::QueuedConnection);
m_hideOtherViews->setWhatsThis(i18n("Hide every view but the active one"));
- m_showOtherViews = m_mainWindow->actionCollection()->addAction(QStringLiteral("view_show_others"));
- m_showOtherViews->setIcon(QIcon::fromTheme(QStringLiteral("view-restore")));
- m_showOtherViews->setText(i18n("Show Inactive Views"));
- connect(m_showOtherViews, SIGNAL(triggered()), this, SLOT(slotShowOtherViews()), Qt::QueuedConnection);
-
- m_showOtherViews->setWhatsThis(i18n("Show the currently not active views"));
-
goNext = m_mainWindow->actionCollection()->addAction(QStringLiteral("go_next_split_view"));
goNext->setText(i18n("Next Split View"));
goNext->setShortcut(Qt::Key_F8);
@@ -188,7 +182,7 @@ void KateViewManager::setupActions()
goPrev->setWhatsThis(i18n("Make the previous split view the active one."));
- a = m_mainWindow->actionCollection()->addAction(QStringLiteral("view_split_move_right"));
+ QAction * a = m_mainWindow->actionCollection()->addAction(QStringLiteral("view_split_move_right"));
a->setText(i18n("Move Splitter Right"));
connect(a, SIGNAL(triggered()), this, SLOT(moveSplitterRight()));
@@ -896,9 +890,9 @@ void KateViewManager::slotCloseCurrentViewSpace()
void KateViewManager::slotCloseOtherViews()
{
// avoid flicker
- KateUpdateDisabler disableUpdates (mainWindow());
-
- KateViewSpace *active = activeViewSpace();
+ KateUpdateDisabler disableUpdates(mainWindow());
+
+ const KateViewSpace *active = activeViewSpace();
foreach(KateViewSpace * v, m_viewSpaceList) {
if (active != v) {
removeViewSpace(v);
@@ -906,36 +900,28 @@ void KateViewManager::slotCloseOtherViews()
}
}
-void KateViewManager::slotHideOtherViews()
+void KateViewManager::slotHideOtherViews(bool hideOthers)
{
// avoid flicker
- KateUpdateDisabler disableUpdates (mainWindow());
-
- KateViewSpace *active = activeViewSpace();
- foreach(KateViewSpace * v, m_viewSpaceList) {
- if (active != v) {
- v->hide();
- }
- }
-}
+ KateUpdateDisabler disableUpdates(mainWindow());
-void KateViewManager::slotShowOtherViews()
-{
- // avoid flicker
- KateUpdateDisabler disableUpdates (mainWindow());
-
- KateViewSpace *active = activeViewSpace();
- foreach(KateViewSpace * v, m_viewSpaceList) {
+ const KateViewSpace *active = activeViewSpace();
+ foreach(KateViewSpace * v, m_viewSpaceList) {
if (active != v) {
- v->show();
+ v->setVisible(!hideOthers);
}
}
+
+ // disable the split actions, if we are in single-view-mode
+ m_splitViewVert->setDisabled(hideOthers);
+ m_splitViewHoriz->setDisabled(hideOthers);
+ m_closeView->setDisabled(hideOthers);
+ m_closeOtherViews->setDisabled(hideOthers);
}
/**
* session config functions
*/
-
void KateViewManager::saveViewConfiguration(KConfigGroup &config)
{
// set Active ViewSpace to 0, just in case there is none active (would be
diff --git a/kate/src/kateviewmanager.h b/kate/src/kateviewmanager.h
index 41bb9f3..11e8055 100644
--- a/kate/src/kateviewmanager.h
+++ b/kate/src/kateviewmanager.h
@@ -223,10 +223,7 @@ public Q_SLOTS:
void slotCloseOtherViews();
/** hide every view but the active one */
- void slotHideOtherViews();
-
- /** show every view but the active one */
- void slotShowOtherViews();
+ void slotHideOtherViews(bool hideOthers);
void reactivateActiveView();
@@ -243,10 +240,11 @@ private:
KateMainWindow *m_mainWindow;
bool m_init;
+ QAction *m_splitViewVert;
+ QAction *m_splitViewHoriz;
QAction *m_closeView;
QAction *m_closeOtherViews;
QAction *m_hideOtherViews;
- QAction *m_showOtherViews;
QAction *goNext;
QAction *goPrev;
diff --git a/kate/src/kateviewspace.cpp b/kate/src/kateviewspace.cpp
index a849a5e..e3c97b8 100644
--- a/kate/src/kateviewspace.cpp
+++ b/kate/src/kateviewspace.cpp
@@ -73,7 +73,6 @@ KateViewSpace::KateViewSpace(KateViewManager *viewManager,
split->addAction(m_viewManager->mainWindow()->actionCollection()->action(QStringLiteral("view_close_current_space")));
split->addAction(m_viewManager->mainWindow()->actionCollection()->action(QStringLiteral("view_close_others")));
split->addAction(m_viewManager->mainWindow()->actionCollection()->action(QStringLiteral("view_hide_others")));
- split->addAction(m_viewManager->mainWindow()->actionCollection()->action(QStringLiteral("view_show_others")));
split->setWhatsThis(i18n("Control view space splitting"));
split->installEventFilter(this); // on click, active this view space
hLayout->addWidget(split);