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
Hadi Charara
Dolphin
Commits
1e0bc163
Commit
1e0bc163
authored
Jun 19, 2021
by
Hadi Charara
Browse files
Initial Commit
parent
5e79f27a
Pipeline
#66622
passed with stage
in 4 minutes and 55 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/CMakeLists.txt
View file @
1e0bc163
...
...
@@ -235,6 +235,7 @@ target_sources(dolphinstatic PRIVATE
panels/folders/treeviewcontextmenu.cpp
panels/folders/folderspanel.cpp
panels/terminal/terminalpanel.cpp
panels/readme/readmepanel.cpp
search/dolphinfacetswidget.cpp
search/dolphinquery.cpp
search/dolphinsearchbox.cpp
...
...
src/dolphinmainwindow.cpp
View file @
1e0bc163
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/dolphinmainwindow.h
View file @
1e0bc163
...
...
@@ -43,6 +43,7 @@ class KToolBarPopupAction;
class
QToolButton
;
class
PlacesPanel
;
class
TerminalPanel
;
class
ReadmePanel
;
namespace
KIO
{
class
OpenUrlJob
;
...
...
@@ -113,6 +114,7 @@ public:
bool
isFoldersPanelEnabled
()
const
;
bool
isInformationPanelEnabled
()
const
;
bool
isReadmePanelEnabled
()
const
;
public
Q_SLOTS
:
/**
...
...
@@ -666,6 +668,7 @@ private:
TerminalPanel
*
m_terminalPanel
;
PlacesPanel
*
m_placesPanel
;
ReadmePanel
*
m_readmePanel
;
bool
m_tearDownFromPlacesRequested
;
KToolBarPopupAction
*
m_backAction
;
...
...
src/panels/readme/readmepanel.cpp
0 → 100644
View file @
1e0bc163
#include
"readmepanel.h"
#include
<qevent.h>
#include
<kservice.h>
#include
<KParts/ReadOnlyPart>
#include
<QVBoxLayout>
#include
<QFileInfo>
#include
<QtWidgets>
ReadmePanel
::
ReadmePanel
(
QWidget
*
parent
)
:
Panel
(
parent
),
m_layout
(
nullptr
),
m_readmeWidget
(
nullptr
),
m_markdownPart
(
nullptr
),
m_readmeUrl
()
{
m_layout
=
new
QVBoxLayout
(
this
);
m_layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
}
void
ReadmePanel
::
showEvent
(
QShowEvent
*
event
)
{
if
(
!
m_markdownPart
)
{
KPluginFactory
*
factory
=
nullptr
;
KService
::
Ptr
service
=
KService
::
serviceByDesktopName
(
QStringLiteral
(
"markdownpart"
));
if
(
service
)
{
factory
=
KPluginLoader
(
service
->
library
()).
factory
();
}
m_markdownPart
=
factory
?
(
factory
->
create
<
KParts
::
ReadOnlyPart
>
(
this
))
:
nullptr
;
m_readmeWidget
=
m_markdownPart
->
widget
();
configureTextBrowser
(
m_readmeWidget
->
findChild
<
QTextBrowser
*>
());
setFocusProxy
(
m_readmeWidget
);
m_layout
->
addWidget
(
m_readmeWidget
);
}
Panel
::
showEvent
(
event
);
}
inline
void
ReadmePanel
::
configureTextBrowser
(
QTextBrowser
*
browser
)
{
browser
->
setFrameStyle
(
0
);
browser
->
setStyleSheet
(
"QTextEdit { background-color: transparent; }"
);
browser
->
scroll
(
0
,
0
);
}
void
ReadmePanel
::
hideEvent
(
QHideEvent
*
event
)
{
if
(
m_markdownPart
)
m_markdownPart
->
closeUrl
();
}
bool
ReadmePanel
::
urlChanged
()
{
m_readmeUrl
=
QUrl
(
url
().
toString
().
append
(
"/README.md"
));
QFileInfo
check_file
(
m_readmeUrl
.
path
());
if
(
!
m_readmeUrl
.
isValid
()
||
!
check_file
.
exists
())
{
this
->
hide
();
return
false
;
}
this
->
show
();
m_markdownPart
->
openUrl
(
m_readmeUrl
);
return
true
;
}
src/panels/readme/readmepanel.h
0 → 100644
View file @
1e0bc163
#ifndef READMEPANEL_H
#define READMEPANEL_H
#include
"panels/panel.h"
#include
<QTextBrowser>
class
QVBoxLayout
;
class
QWidget
;
namespace
KParts
{
class
ReadOnlyPart
;
}
/**
* @brief Shows a preview of README.md if it is located in the current folder.
*/
class
ReadmePanel
:
public
Panel
{
Q_OBJECT
public:
explicit
ReadmePanel
(
QWidget
*
parent
=
nullptr
);
~
ReadmePanel
()
override
=
default
;
protected:
bool
urlChanged
()
override
;
void
showEvent
(
QShowEvent
*
event
)
override
;
void
hideEvent
(
QHideEvent
*
event
)
override
;
private:
inline
void
configureTextBrowser
(
QTextBrowser
*
browser
);
private:
QVBoxLayout
*
m_layout
;
QWidget
*
m_readmeWidget
;
KParts
::
ReadOnlyPart
*
m_markdownPart
;
QUrl
m_readmeUrl
;
};
#endif // READMEPANEL_H
src/userfeedback/settingsdatasource.cpp
View file @
1e0bc163
...
...
@@ -46,6 +46,7 @@ QVariant SettingsDataSource::data()
if
(
m_mainWindow
)
{
map
.
insert
(
QStringLiteral
(
"informationPanelEnabled"
),
m_mainWindow
->
isInformationPanelEnabled
());
map
.
insert
(
QStringLiteral
(
"foldersPanelEnabled"
),
m_mainWindow
->
isFoldersPanelEnabled
());
map
.
insert
(
QStringLiteral
(
"readmePanelEnabled"
),
m_mainWindow
->
isReadmePanelEnabled
());
}
map
.
insert
(
QStringLiteral
(
"tooltipsEnabled"
),
GeneralSettings
::
showToolTips
());
...
...
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