Commit dfc3c7c2 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add support for fullscreen

parent 400da6c0
Pipeline #154103 passed with stage
in 1 minute and 41 seconds
<?xml version="1.0"?>
<!DOCTYPE gui SYSTEM "kpartgui.dtd">
<gui version="419" name="kontact" >
<gui version="420" name="kontact" >
<MenuBar>
<Menu name="file" noMerge="1">
<text>&amp;File</text>
......@@ -13,6 +13,8 @@
<Menu noMerge="1" name="view">
<text>&amp;View</text>
<Action name="hide_show_sidebar"/>
<Separator/>
<Action name="fullscreen"/>
</Menu>
<Menu noMerge="1" name="settings">
<text>&amp;Settings</text>
......
......@@ -20,6 +20,8 @@ using namespace Kontact;
#ifdef WIN32
#include <windows.h>
#else
#include <QFontDatabase>
#include <QMenuBar>
#include <unistd.h>
#endif
#include <Libkdepim/ProgressStatusBarWidget>
......@@ -303,6 +305,30 @@ void MainWindow::setupActions()
actionCollection()->addAction(QStringLiteral("hide_show_sidebar"), mShowHideAction);
actionCollection()->setDefaultShortcut(mShowHideAction, QKeySequence(Qt::Key_F9));
connect(mShowHideAction, &QAction::triggered, this, &MainWindow::slotShowHideSideBar);
mShowFullScreenAction = KStandardAction::fullScreen(nullptr, nullptr, this, actionCollection());
actionCollection()->setDefaultShortcut(mShowFullScreenAction, Qt::Key_F11);
connect(mShowFullScreenAction, &QAction::toggled, this, &MainWindow::slotFullScreen);
}
void MainWindow::slotFullScreen(bool t)
{
KToggleFullScreenAction::setFullScreen(this, t);
QMenuBar *mb = menuBar();
if (t) {
auto b = new QToolButton(mb);
b->setDefaultAction(mShowFullScreenAction);
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();
}
}
}
KontactInterface::Plugin *MainWindow::pluginFromName(const QString &identifier) const
......
......@@ -21,6 +21,7 @@ class QFrame;
class QSplitter;
class QStackedWidget;
class IntroductionWebEngineView;
class KToggleFullScreenAction;
using PluginList = QList<KontactInterface::Plugin *>;
using ActionPluginList = QList<QAction *>;
......@@ -101,6 +102,7 @@ private Q_SLOTS:
private:
void setHelpText(QAction *action, const QString &text);
void slotFullScreen(bool t);
QFrame *mTopWidget = nullptr;
QSplitter *mSplitter = nullptr;
......@@ -126,6 +128,7 @@ private:
bool mReallyClose = false;
int mSaveSideBarWidth = 10;
QAction *mShowHideAction = nullptr;
KToggleFullScreenAction *mShowFullScreenAction = nullptr;
};
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment