Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KMenuEdit
Commits
25669cd5
Commit
25669cd5
authored
May 17, 2022
by
Nicolas Fella
Browse files
Raise window when activating instance
parent
d16a2117
Pipeline
#177578
passed with stage
in 1 minute and 48 seconds
Changes
3
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
.kde-ci.yml
View file @
25669cd5
...
...
@@ -14,3 +14,4 @@ Dependencies:
'
frameworks/ksonnet'
:
'
@stable'
'
frameworks/kdoctools'
:
'
@stable'
'
frameworks/kglobalaccel'
:
'
@stable'
'
frameworks/kwindowsystem'
:
'
@stable'
CMakeLists.txt
View file @
25669cd5
...
...
@@ -39,6 +39,7 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Sonnet
DocTools
GlobalAccel
WindowSystem
)
add_definitions
(
-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00
)
...
...
@@ -94,6 +95,7 @@ target_link_libraries(kmenuedit
KF5::SonnetCore
KF5::SonnetUi
KF5::XmlGui
KF5::WindowSystem
)
# add clang-format target for all our real source files
...
...
main.cpp
View file @
25669cd5
...
...
@@ -12,14 +12,13 @@
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include
<Kdelibs4ConfigMigrator>
#endif
#include
<KWindowSystem>
#include
<kdbusservice.h>
#include
"kmenuedit.h"
#include
<QApplication>
#include
<QCommandLineParser>
static
KMenuEdit
*
menuEdit
=
nullptr
;
class
KMenuApplication
:
public
QApplication
{
public:
...
...
@@ -67,15 +66,28 @@ int main(int argc, char **argv)
parser
.
process
(
app
);
aboutData
.
processCommandLine
(
&
parser
);
const
auto
args
=
parser
.
positionalArguments
();
auto
*
menuEdit
=
new
KMenuEdit
();
menuEdit
=
new
KMenuEdit
();
if
(
!
args
.
isEmpty
())
{
menuEdit
->
selectMenu
(
args
.
at
(
0
));
if
(
args
.
count
()
>
1
)
{
menuEdit
->
selectMenuEntry
(
args
.
at
(
1
));
auto
useArgs
=
[
menuEdit
](
const
QCommandLineParser
&
parser
)
{
const
QStringList
args
=
parser
.
positionalArguments
();
if
(
!
args
.
isEmpty
())
{
menuEdit
->
selectMenu
(
args
.
at
(
0
));
if
(
args
.
count
()
>
1
)
{
menuEdit
->
selectMenuEntry
(
args
.
at
(
1
));
}
}
}
};
useArgs
(
parser
);
QObject
::
connect
(
&
service
,
&
KDBusService
::
activateRequested
,
menuEdit
,
[
useArgs
,
&
parser
,
menuEdit
](
const
QStringList
&
args
,
const
QString
&
/*workDir*/
)
{
parser
.
parse
(
args
);
useArgs
(
parser
);
KWindowSystem
::
updateStartupId
(
menuEdit
->
windowHandle
());
KWindowSystem
::
activateWindow
(
menuEdit
->
windowHandle
());
});
menuEdit
->
show
();
return
app
.
exec
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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