Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KOrganizer
Commits
f62de2e8
Commit
f62de2e8
authored
May 31, 2021
by
Laurent Montel
😁
Browse files
Add KHamburgerMenu
parent
4db25290
Pipeline
#63645
passed with stage
in 13 minutes and 42 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/actionmanager.cpp
View file @
f62de2e8
...
...
@@ -73,10 +73,17 @@
#include <QApplication>
#include <QStandardPaths>
#include <QTimer>
#include <QToolBar>
KOWindowList
*
ActionManager
::
mWindowList
=
nullptr
;
ActionManager
::
ActionManager
(
KXMLGUIClient
*
client
,
CalendarView
*
widget
,
QObject
*
parent
,
KOrg
::
MainWindow
*
mainWindow
,
bool
isPart
,
QMenuBar
*
menuBar
)
ActionManager
::
ActionManager
(
KXMLGUIClient
*
client
,
CalendarView
*
widget
,
QObject
*
parent
,
KOrg
::
MainWindow
*
mainWindow
,
bool
isPart
,
QMenuBar
*
menuBar
,
QToolBar
*
toolBar
)
:
QObject
(
parent
)
{
new
KOrgCalendarAdaptor
(
this
);
...
...
@@ -88,6 +95,7 @@ ActionManager::ActionManager(KXMLGUIClient *client, CalendarView *widget, QObjec
mIsPart
=
isPart
;
mMainWindow
=
mainWindow
;
mMenuBar
=
menuBar
;
mToolBar
=
toolBar
;
}
ActionManager
::~
ActionManager
()
...
...
@@ -112,7 +120,7 @@ void ActionManager::toggleMenubar(bool dontShowWarning)
if
(
mShowMenuBarAction
->
isChecked
())
{
mMenuBar
->
show
();
}
else
{
if
(
!
dontShowWarning
)
{
if
(
!
dontShowWarning
&&
(
!
mToolBar
->
isVisible
()
||
!
mToolBar
->
actions
().
contains
(
mHamburgerMenu
))
)
{
const
QString
accel
=
mShowMenuBarAction
->
shortcut
().
toString
();
KMessageBox
::
information
(
mCalendarView
,
i18n
(
"<qt>This will hide the menu bar completely."
...
...
@@ -690,6 +698,25 @@ void ActionManager::initActions()
KStandardAction
::
preferences
(
mCalendarView
,
&
CalendarView
::
edit_options
,
mACollection
);
KStandardAction
::
keyBindings
(
this
,
&
ActionManager
::
keyBindings
,
mACollection
);
}
mHamburgerMenu
=
KStandardAction
::
hamburgerMenu
(
nullptr
,
nullptr
,
mACollection
);
mHamburgerMenu
->
setShowMenuBarAction
(
mShowMenuBarAction
);
mHamburgerMenu
->
setMenuBar
(
mMenuBar
);
connect
(
mHamburgerMenu
,
&
KHamburgerMenu
::
aboutToShowMenu
,
this
,
[
this
]()
{
updateHamburgerMenu
();
// Immediately disconnect. We only need to run this once, but on demand.
// NOTE: The nullptr at the end disconnects all connections between
// q and mHamburgerMenu's aboutToShowMenu signal.
disconnect
(
mHamburgerMenu
,
&
KHamburgerMenu
::
aboutToShowMenu
,
this
,
nullptr
);
});
}
void
ActionManager
::
updateHamburgerMenu
()
{
QMenu
*
menu
=
new
QMenu
;
menu
->
addAction
(
mACollection
->
action
(
QLatin1String
(
KStandardAction
::
name
(
KStandardAction
::
Print
))));
menu
->
addSeparator
();
menu
->
addAction
(
mACollection
->
action
(
QLatin1String
(
KStandardAction
::
name
(
KStandardAction
::
Quit
))));
mHamburgerMenu
->
setMenu
(
menu
);
}
void
ActionManager
::
setItems
(
const
QStringList
&
lst
,
int
idx
)
...
...
src/actionmanager.h
View file @
f62de2e8
...
...
@@ -34,9 +34,11 @@ class ETMViewStateSaver;
class
QAction
;
class
QMenuBar
;
class
QToolBar
;
class
KSelectAction
;
class
QTemporaryFile
;
class
KToggleAction
;
class
KHamburgerMenu
;
/**
The ActionManager creates all the actions in KOrganizer. This class
...
...
@@ -48,7 +50,13 @@ class KORGANIZERPRIVATE_EXPORT ActionManager : public QObject
{
Q_OBJECT
public:
ActionManager
(
KXMLGUIClient
*
client
,
CalendarView
*
widget
,
QObject
*
parent
,
KOrg
::
MainWindow
*
mainWindow
,
bool
isPart
,
QMenuBar
*
menuBar
=
nullptr
);
ActionManager
(
KXMLGUIClient
*
client
,
CalendarView
*
widget
,
QObject
*
parent
,
KOrg
::
MainWindow
*
mainWindow
,
bool
isPart
,
QMenuBar
*
menuBar
=
nullptr
,
QToolBar
*
toolBar
=
nullptr
);
~
ActionManager
()
override
;
/** Perform initialization that requires this* to be full constructed */
...
...
@@ -284,6 +292,7 @@ private:
/** Create all the actions. */
void
initActions
();
void
enableIncidenceActions
(
bool
enable
);
void
updateHamburgerMenu
();
Akonadi
::
ETMCalendar
::
Ptr
calendar
()
const
;
Akonadi
::
Collection
selectedCollection
()
const
;
...
...
@@ -343,10 +352,12 @@ private:
KActionCollection
*
mACollection
=
nullptr
;
CalendarView
*
mCalendarView
=
nullptr
;
KOrg
::
MainWindow
*
mMainWindow
=
nullptr
;
QToolBar
*
mToolBar
=
nullptr
;
bool
mIsPart
;
AkonadiCollectionView
*
mCollectionView
=
nullptr
;
KViewStateMaintainer
<
Akonadi
::
ETMViewStateSaver
>
*
mCollectionViewStateSaver
=
nullptr
;
KViewStateMaintainer
<
Akonadi
::
ETMViewStateSaver
>
*
mCollectionSelectionModelStateSaver
=
nullptr
;
KHamburgerMenu
*
mHamburgerMenu
=
nullptr
;
};
src/data/korganizer_part.rc
View file @
f62de2e8
<!DOCTYPE gui>
<gui
name=
"korganizer"
version=
"43
6
"
translationDomain=
"korganizer"
>
<gui
name=
"korganizer"
version=
"43
7
"
translationDomain=
"korganizer"
>
<MenuBar>
<Menu
name=
"file"
><text>
&
File
</text>
<Merge/>
...
...
@@ -137,6 +137,8 @@
<Separator/>
<Action
name=
"select_day"
/>
<Action
name=
"select_week"
/>
<Spacer/>
<Action
name=
"hamburger_menu"
/>
</ToolBar>
<ToolBar
noMerge=
"1"
name=
"korganizer_toolbar"
><text>
Views
</text>
...
...
src/data/korganizerui.rc
View file @
f62de2e8
<!DOCTYPE gui>
<gui
name=
"korganizer"
version=
"43
5
"
translationDomain=
"korganizer"
>
<gui
name=
"korganizer"
version=
"43
6
"
translationDomain=
"korganizer"
>
<MenuBar>
<Menu
name=
"file"
><text>
&
File
</text>
<Menu
name=
"import"
><text>
&
Import
</text>
...
...
@@ -121,6 +121,8 @@
<Separator/>
<Action
name=
"select_day"
/>
<Action
name=
"select_week"
/>
<Spacer/>
<Action
name=
"hamburger_menu"
/>
</ToolBar>
<ToolBar
noMerge=
"1"
name=
"korganizer_toolbar"
><text>
Views
</text>
...
...
@@ -143,6 +145,7 @@
<ToolBar
noMerge=
"1"
name=
"filter_toolbar"
hidden=
"true"
><text>
Filters Toolbar
</text>
<Action
name=
"filter_select"
/>
<Action
name=
"edit_filters"
/>
</ToolBar>
<Menu
name=
"rmb_selection_popup"
>
...
...
src/korganizer.cpp
View file @
f62de2e8
...
...
@@ -28,6 +28,7 @@
#include <KSharedConfig>
#include <KShortcutsDialog>
#include <KStandardAction>
#include <KToolBar>
#include <QLabel>
#include <QStatusBar>
#ifdef WITH_KUSERFEEDBACK
...
...
@@ -51,7 +52,7 @@ KOrganizer::KOrganizer()
mCalendarView
->
setObjectName
(
QStringLiteral
(
"KOrganizer::CalendarView"
));
setCentralWidget
(
mCalendarView
);
mActionManager
=
new
ActionManager
(
this
,
mCalendarView
,
this
,
this
,
false
,
menuBar
());
mActionManager
=
new
ActionManager
(
this
,
mCalendarView
,
this
,
this
,
false
,
menuBar
()
,
toolBar
()
);
(
void
)
new
KOrganizerIfaceImpl
(
mActionManager
,
this
,
QStringLiteral
(
"IfaceImpl"
));
#ifdef WITH_KUSERFEEDBACK
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment