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
Utilities
Kate
Commits
4cfb4123
Commit
4cfb4123
authored
Oct 05, 2022
by
Nicolas Fella
Committed by
Christoph Cullmann
Oct 08, 2022
Browse files
Port away from KDirOperator::actionCollection
parent
4f675fa6
Pipeline
#244219
canceled with stage
in 20 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
addons/filebrowser/katefilebrowser.cpp
View file @
4cfb4123
...
...
@@ -162,7 +162,11 @@ void KateFileBrowser::setupToolbar()
if
(
it
==
QLatin1String
(
"bookmarks"
)
||
it
==
QLatin1String
(
"sync_dir"
)
||
it
==
QLatin1String
(
"configure"
))
{
ac
=
actionCollection
()
->
action
(
it
);
}
else
{
#if KIO_VERSION < QT_VERSION_CHECK(5, 100, 0)
ac
=
m_dirOperator
->
actionCollection
()
->
action
(
it
);
#else
ac
=
m_dirOperator
->
action
(
actionFromName
(
it
));
#endif
}
if
(
ac
)
{
...
...
@@ -195,6 +199,41 @@ void KateFileBrowser::writeSessionConfig(KConfigGroup &cg)
cg
.
writeEntry
(
"filter history"
,
m_filter
->
historyItems
());
}
#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0)
KDirOperator
::
Action
KateFileBrowser
::
actionFromName
(
const
QString
&
name
)
{
if
(
name
==
QLatin1String
(
"up"
))
{
return
KDirOperator
::
Up
;
}
else
if
(
name
==
QLatin1String
(
"back"
))
{
return
KDirOperator
::
Back
;
}
else
if
(
name
==
QLatin1String
(
"forward"
))
{
return
KDirOperator
::
Forward
;
}
else
if
(
name
==
QLatin1String
(
"home"
))
{
return
KDirOperator
::
Home
;
}
else
if
(
name
==
QLatin1String
(
"reload"
))
{
return
KDirOperator
::
Reload
;
}
else
if
(
name
==
QLatin1String
(
"mkdir"
))
{
return
KDirOperator
::
NewFolder
;
}
else
if
(
name
==
QLatin1String
(
"delete"
))
{
return
KDirOperator
::
Delete
;
}
else
if
(
name
==
QLatin1String
(
"short view"
))
{
return
KDirOperator
::
ShortView
;
}
else
if
(
name
==
QLatin1String
(
"detailed view"
))
{
return
KDirOperator
::
DetailedView
;
}
else
if
(
name
==
QLatin1String
(
"tree view"
))
{
return
KDirOperator
::
TreeView
;
}
else
if
(
name
==
QLatin1String
(
"detailed tree view"
))
{
return
KDirOperator
::
DetailedTreeView
;
}
else
if
(
name
==
QLatin1String
(
"show hidden"
))
{
return
KDirOperator
::
ShowHiddenFiles
;
}
else
{
qWarning
()
<<
"Unknown KDirOperator action:"
<<
name
;
}
return
{};
}
#endif
// END Public Methods
// BEGIN Public Slots
...
...
@@ -402,12 +441,21 @@ void KateFileBrowser::setupActions()
// section for settings menu
KActionMenu
*
optionsMenu
=
new
KActionMenu
(
QIcon
::
fromTheme
(
QStringLiteral
(
"configure"
)),
i18n
(
"Options"
),
this
);
optionsMenu
->
setPopupMode
(
QToolButton
::
InstantPopup
);
#if KIO_VERSION < QT_VERSION_CHECK(5, 100, 0)
optionsMenu
->
addAction
(
m_dirOperator
->
actionCollection
()
->
action
(
QStringLiteral
(
"short view"
)));
optionsMenu
->
addAction
(
m_dirOperator
->
actionCollection
()
->
action
(
QStringLiteral
(
"detailed view"
)));
optionsMenu
->
addAction
(
m_dirOperator
->
actionCollection
()
->
action
(
QStringLiteral
(
"tree view"
)));
optionsMenu
->
addAction
(
m_dirOperator
->
actionCollection
()
->
action
(
QStringLiteral
(
"detailed tree view"
)));
optionsMenu
->
addSeparator
();
optionsMenu
->
addAction
(
m_dirOperator
->
actionCollection
()
->
action
(
QStringLiteral
(
"show hidden"
)));
#else
optionsMenu
->
addAction
(
m_dirOperator
->
action
(
KDirOperator
::
ShortView
));
optionsMenu
->
addAction
(
m_dirOperator
->
action
(
KDirOperator
::
DetailedView
));
optionsMenu
->
addAction
(
m_dirOperator
->
action
(
KDirOperator
::
TreeView
));
optionsMenu
->
addAction
(
m_dirOperator
->
action
(
KDirOperator
::
DetailedTreeView
));
optionsMenu
->
addSeparator
();
optionsMenu
->
addAction
(
m_dirOperator
->
action
(
KDirOperator
::
ShowHiddenFiles
));
#endif
// action for synchronising the dir operator with the current document path...
m_autoSyncFolder
=
new
QAction
(
this
);
...
...
@@ -443,7 +491,11 @@ void KateFileBrowser::setupActions()
for
(
QAction
*
a
:
actions
)
{
a
->
setShortcut
(
QKeySequence
());
}
#if KIO_VERSION < QT_VERSION_CHECK(5, 100, 0)
const
auto
dirActions
=
m_dirOperator
->
actionCollection
()
->
actions
();
#else
const
auto
dirActions
=
m_dirOperator
->
allActions
();
#endif
for
(
QAction
*
a
:
dirActions
)
{
a
->
setShortcut
(
QKeySequence
());
}
...
...
addons/filebrowser/katefilebrowser.h
View file @
4cfb4123
...
...
@@ -13,7 +13,9 @@
#include
<ktexteditor/mainwindow.h>
#include
<KDirOperator>
#include
<KFile>
#include
<kio_version.h>
#include
<QMenu>
#include
<QUrl>
...
...
@@ -64,6 +66,10 @@ public:
return
m_actionCollection
;
}
#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0)
static
KDirOperator
::
Action
actionFromName
(
const
QString
&
name
);
#endif
public
Q_SLOTS
:
void
slotFilterChange
(
const
QString
&
);
void
setDir
(
const
QUrl
&
);
...
...
addons/filebrowser/katefilebrowserconfig.cpp
View file @
4cfb4123
...
...
@@ -158,7 +158,11 @@ void KateFileBrowserConfigPage::init()
if
(
actionName
==
QLatin1String
(
"bookmarks"
)
||
actionName
==
QLatin1String
(
"sync_dir"
)
||
actionName
==
QLatin1String
(
"configure"
))
{
ac
=
fileBrowser
->
actionCollection
()
->
action
(
actionName
);
}
else
{
#if KIO_VERSION < QT_VERSION_CHECK(5, 100, 0)
ac
=
fileBrowser
->
dirOperator
()
->
actionCollection
()
->
action
(
actionName
);
#else
ac
=
fileBrowser
->
dirOperator
()
->
action
(
KateFileBrowser
::
actionFromName
(
actionName
));
#endif
}
if
(
ac
)
{
...
...
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