Commit 88bdd701 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add support for fullscreen

parent d739af84
Pipeline #154035 failed with stage
in 5 minutes and 3 seconds
......@@ -2,7 +2,7 @@
the same menu entries at the same place in KMail and Kontact -->
<!DOCTYPE gui>
<gui version="549" name="kmmainwin" translationDomain="kmail">
<gui version="550" name="kmmainwin" translationDomain="kmail">
<MenuBar>
<Menu noMerge="1" name="file" >
<text>&amp;File</text>
......@@ -90,6 +90,8 @@
<Action name="encoding" />
<Separator/>
<Action name="zoom_menu"/>
<Separator/>
<Action name="view-full-screen"/>
</Menu>
<Menu noMerge="1" name="go">
<text>&amp;Go</text>
......
......@@ -87,6 +87,10 @@ KMMainWin::KMMainWin(QWidget *)
mShowMenuBarAction->setChecked(KMailSettings::self()->showMenuBar());
slotToggleMenubar(true);
connect(guiFactory(), &KXMLGUIFactory::shortcutsSaved, this, &KMMainWin::slotShortcutSaved);
mShowFullScreenAction = KStandardAction::fullScreen(nullptr, nullptr, this, actionCollection());
actionCollection()->setDefaultShortcut(mShowFullScreenAction, Qt::Key_F11);
connect(mShowFullScreenAction, &QAction::toggled, this, &KMMainWin::slotFullScreen);
}
KMMainWin::~KMMainWin()
......@@ -96,6 +100,26 @@ KMMainWin::~KMMainWin()
disconnect(PimCommon::BroadcastStatus::instance(), &PimCommon::BroadcastStatus::statusMsg, this, nullptr);
}
void KMMainWin::slotFullScreen(bool t)
{
KToggleFullScreenAction::setFullScreen(this, t);
QMenuBar *mb = menuBar();
if (t) {
QToolButton *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();
}
}
}
void KMMainWin::updateHamburgerMenu()
{
auto menu = new QMenu(this);
......
......@@ -15,6 +15,7 @@ class KMMainWidget;
class KToggleAction;
class QLabel;
class KHamburgerMenu;
class KToggleFullScreenAction;
namespace KPIM
{
class ProgressStatusBarWidget;
......@@ -56,10 +57,12 @@ private:
void slotToggleMenubar(bool dontShowWarning);
void updateHamburgerMenu();
void slotShortcutSaved();
void slotFullScreen(bool t);
KPIM::ProgressStatusBarWidget *mProgressBar = nullptr;
KMMainWidget *mKMMainWidget = nullptr;
KToggleAction *mShowMenuBarAction = nullptr;
QLabel *mMessageLabel = nullptr;
KHamburgerMenu *mHamburgerMenu = nullptr;
KToggleFullScreenAction *mShowFullScreenAction = nullptr;
bool mReallyClose = false;
};
......@@ -2,7 +2,7 @@
the same menu entries at the same place in KMail and Kontact -->
<!DOCTYPE gui>
<gui version="549" name="kmmainwin" translationDomain="kmail">
<gui version="550" name="kmmainwin" translationDomain="kmail">
<MenuBar>
<Menu noMerge="1" name="file" >
<text>&amp;File</text>
......@@ -90,6 +90,8 @@
<Action name="encoding" />
<Separator/>
<Action name="zoom_menu"/>
<Separator/>
<Action name="view-full-screen"/>
</Menu>
<Menu noMerge="1" name="go">
<text>&amp;Go</text>
......
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