summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Wenninger <jowenn@kde.org>2014-01-23 12:48:41 (GMT)
committerJoseph Wenninger <jowenn@kde.org>2014-01-23 13:00:04 (GMT)
commitdd2af34e0565201b90bba8892bf4e349c55042c5 (patch)
treee875dea31eac0ca16b7783791c4e112512baf94a
parentc92a00ea45f77e88194dafd4a962cbec2fb9528a (diff)
KF5: If the window is fullscreen, show a toolbutton as a corner widget for the menubar. I guess this only works if the menubar is within the application and not if the bar is external, but it is better than nothing.
BUG: 162233
-rw-r--r--kate/app/katemainwindow.cpp24
-rw-r--r--kate/app/katemainwindow.h2
2 files changed, 23 insertions, 3 deletions
diff --git a/kate/app/katemainwindow.cpp b/kate/app/katemainwindow.cpp
index f01bd3e..6dc3788 100644
--- a/kate/app/katemainwindow.cpp
+++ b/kate/app/katemainwindow.cpp
@@ -70,7 +70,10 @@
#include <QDropEvent>
#include <QApplication>
#include <QMenu>
+#include <QMenuBar>
+#include <QToolButton>
#include <QTimer>
+#include <QFontDatabase>
#include <ktexteditor/sessionconfiginterface.h>
@@ -322,9 +325,9 @@ void KateMainWindow::setupActions()
connect(a, SIGNAL(triggered()), this, SLOT(slotQuickOpen()));
a->setWhatsThis(i18n("Open a form to quick open documents."));
- KToggleAction *showFullScreenAction = KStandardAction::fullScreen(0, 0, this, this);
- actionCollection()->addAction(showFullScreenAction->objectName(), showFullScreenAction);
- connect(showFullScreenAction, SIGNAL(toggled(bool)), this, SLOT(slotFullScreen(bool)));
+ m_showFullScreenAction = KStandardAction::fullScreen(0, 0, this, this);
+ actionCollection()->addAction(m_showFullScreenAction->objectName(), m_showFullScreenAction);
+ connect(m_showFullScreenAction, SIGNAL(toggled(bool)), this, SLOT(slotFullScreen(bool)));
documentOpenWith = new KActionMenu(i18n("Open W&ith"), this);
actionCollection()->addAction(QStringLiteral("file_open_with"), documentOpenWith);
@@ -805,6 +808,21 @@ void KateMainWindow::aboutEditor()
void KateMainWindow::slotFullScreen(bool t)
{
KToggleFullScreenAction::setFullScreen(this, t);
+ QMenuBar *mb = menuBar();
+ if (t) {
+
+ QToolButton *b = new QToolButton(mb);
+ b->setDefaultAction(m_showFullScreenAction);
+ b->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Ignored));
+ b->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
+ mb->setCornerWidget(b,Qt::TopRightCorner);
+ b->setVisible(true);
+ b->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
+ } else {
+ QWidget *w=mb->cornerWidget(Qt::TopRightCorner);
+ if (w) w->deleteLater();
+ }
+
}
bool KateMainWindow::showModOnDiskPrompt()
diff --git a/kate/app/katemainwindow.h b/kate/app/katemainwindow.h
index 1482136..2de4c4f 100644
--- a/kate/app/katemainwindow.h
+++ b/kate/app/katemainwindow.h
@@ -456,6 +456,8 @@ private:
KToggleAction *settingsShowFileselector;
+ KToggleAction *m_showFullScreenAction;
+
bool m_modignore;
// all plugin views for this mainwindow, used by the pluginmanager