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
KDE PIM Add-ons
Commits
9af6695a
Commit
9af6695a
authored
Feb 13, 2022
by
Laurent Montel
😁
Browse files
Add support as commandline
parent
ebbcbf88
Pipeline
#136703
failed with stage
in 15 minutes and 6 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
plugins/messageviewerconfigureplugins/openurlwith/CMakeLists.txt
View file @
9af6695a
...
...
@@ -10,6 +10,7 @@ target_sources(messageviewer_openurlwithconfigplugin PRIVATE
target_link_libraries
(
messageviewer_openurlwithconfigplugin
KF5::MessageViewer
KF5::I18n
KF5::KIOWidgets
openurlwithconfigure
)
...
...
@@ -41,6 +42,7 @@ generate_export_header(openurlwithconfigure BASE_NAME libopenurlwithconfigure)
target_link_libraries
(
openurlwithconfigure
KF5::I18n
KF5::MessageViewer
KF5::KIOWidgets
KF5::ItemViews
KF5::Libkdepim
)
...
...
plugins/messageviewerconfigureplugins/openurlwith/autotests/CMakeLists.txt
View file @
9af6695a
...
...
@@ -5,7 +5,7 @@ macro(add_messageviewer_openwithurl_unittest _source)
ecm_add_test
(
${
_source
}
${
_name
}
.h
TEST_NAME
${
_name
}
NAME_PREFIX
"messageviewer-"
LINK_LIBRARIES KF5::MessageViewer KF5::Libkdepim openurlwithconfigure Qt
${
QT_MAJOR_VERSION
}
::Test
LINK_LIBRARIES KF5::MessageViewer KF5::Libkdepim openurlwithconfigure Qt
${
QT_MAJOR_VERSION
}
::Test
KF5::KIOWidgets
)
endmacro
()
...
...
plugins/messageviewerconfigureplugins/openurlwith/autotests/openurlwithconfigurecreatewidgettest.cpp
View file @
9af6695a
...
...
@@ -6,6 +6,7 @@
#include "openurlwithconfigurecreatewidgettest.h"
#include "openurlwithconfigurecreatewidget.h"
#include <KUrlRequester>
#include <QFormLayout>
#include <QLabel>
#include <QLineEdit>
...
...
@@ -28,11 +29,14 @@ void OpenUrlWithConfigureCreateWidgetTest::shouldHaveDefaultValues()
QVERIFY
(
mServerName
);
QVERIFY
(
mServerName
->
text
().
isEmpty
());
auto
mCommand
=
w
.
findChild
<
QLineEdit
*>
(
QStringLiteral
(
"mCommand"
));
QVERIFY
(
mCommand
);
QVERIFY
(
mCommand
->
text
().
isEmpty
());
auto
mCommand
Line
=
w
.
findChild
<
QLineEdit
*>
(
QStringLiteral
(
"mCommand
Line
"
));
QVERIFY
(
mCommand
Line
);
QVERIFY
(
mCommand
Line
->
text
().
isEmpty
());
auto
formatHelp
=
w
.
findChild
<
QLabel
*>
(
QStringLiteral
(
"formatHelp"
));
QVERIFY
(
formatHelp
);
QCOMPARE
(
formatHelp
->
contextMenuPolicy
(),
Qt
::
NoContextMenu
);
auto
mExecutable
=
w
.
findChild
<
KUrlRequester
*>
(
QStringLiteral
(
"mEditorRequester"
));
QVERIFY
(
mExecutable
);
}
plugins/messageviewerconfigureplugins/openurlwith/openurlwithconfigurecreatewidget.cpp
View file @
9af6695a
...
...
@@ -5,7 +5,9 @@
*/
#include "openurlwithconfigurecreatewidget.h"
#include <KLineEdit>
#include <KLocalizedString>
#include <KUrlRequester>
#include <Libkdepim/LineEditCatchReturnKey>
#include <QFormLayout>
#include <QLabel>
...
...
@@ -14,7 +16,8 @@
OpenUrlWithConfigureCreateWidget
::
OpenUrlWithConfigureCreateWidget
(
QWidget
*
parent
)
:
QWidget
{
parent
}
,
mServerName
(
new
QLineEdit
(
this
))
,
mCommand
(
new
QLineEdit
(
this
))
,
mCommandLine
(
new
QLineEdit
(
this
))
,
mExecutable
(
new
KUrlRequester
(
this
))
{
auto
mainLayout
=
new
QFormLayout
(
this
);
mainLayout
->
setObjectName
(
QStringLiteral
(
"mainlayout"
));
...
...
@@ -40,9 +43,20 @@ OpenUrlWithConfigureCreateWidget::OpenUrlWithConfigureCreateWidget(QWidget *pare
formatHelp
->
setWhatsThis
(
mCommandWhatsThis
);
mainLayout
->
addWidget
(
formatHelp
);
mCommand
->
setObjectName
(
QStringLiteral
(
"mCommand"
));
mainLayout
->
addRow
(
i18n
(
"Command:"
),
mCommand
);
KPIM
::
LineEditCatchReturnKey
(
mCommand
,
this
);
mCommandLine
->
setObjectName
(
QStringLiteral
(
"mCommandLine"
));
mainLayout
->
addRow
(
i18n
(
"Command:"
),
mCommandLine
);
KPIM
::
LineEditCatchReturnKey
(
mCommandLine
,
this
);
mExecutable
->
setObjectName
(
QStringLiteral
(
"mEditorRequester"
));
mExecutable
->
setMimeTypeFilters
(
{
QStringLiteral
(
"application/x-executable"
),
QStringLiteral
(
"application/x-shellscript"
),
QStringLiteral
(
"application/x-desktop"
)});
mExecutable
->
setMode
(
KFile
::
File
|
KFile
::
ExistingOnly
|
KFile
::
LocalOnly
);
mExecutable
->
lineEdit
()
->
setClearButtonEnabled
(
true
);
mainLayout
->
addRow
(
i18n
(
"Executable:"
),
mExecutable
);
// connect(mName, &QLineEdit::textChanged, this, &ViewerPluginExternalEditWidget::slotInfoChanged);
// connect(mExecutable->lineEdit(), &QLineEdit::textChanged, this, &ViewerPluginExternalEditWidget::slotInfoChanged);
}
OpenUrlWithConfigureCreateWidget
::~
OpenUrlWithConfigureCreateWidget
()
...
...
@@ -60,14 +74,16 @@ OpenUrlWithConfigureCreateWidget::OpenUrlWithInfo OpenUrlWithConfigureCreateWidg
{
OpenUrlWithConfigureCreateWidget
::
OpenUrlWithInfo
info
;
info
.
url
=
mServerName
->
text
().
trimmed
();
info
.
command
=
mCommand
->
text
().
trimmed
();
info
.
command
=
mExecutable
->
text
().
trimmed
();
info
.
commandLines
=
mCommandLine
->
text
().
trimmed
();
return
info
;
}
void
OpenUrlWithConfigureCreateWidget
::
setInfo
(
const
OpenUrlWithInfo
&
i
)
{
mServerName
->
setText
(
i
.
url
);
mCommand
->
setText
(
i
.
command
);
mExecutable
->
setText
(
i
.
command
);
mCommandLine
->
setText
(
i
.
commandLines
);
}
bool
OpenUrlWithConfigureCreateWidget
::
OpenUrlWithInfo
::
isValid
()
const
...
...
plugins/messageviewerconfigureplugins/openurlwith/openurlwithconfigurecreatewidget.h
View file @
9af6695a
...
...
@@ -8,12 +8,14 @@
#include "openurlwith_private_export.h"
#include <QWidget>
class
QLineEdit
;
class
KUrlRequester
;
class
LIBOPENURLWITHCONFIGURE_TESTS_EXPORT
OpenUrlWithConfigureCreateWidget
:
public
QWidget
{
Q_OBJECT
public:
struct
OpenUrlWithInfo
{
QString
command
;
QString
commandLines
;
QString
url
;
Q_REQUIRED_RESULT
bool
isValid
()
const
;
};
...
...
@@ -27,5 +29,6 @@ private:
void
slotLinkClicked
(
const
QString
&
link
);
QString
mCommandWhatsThis
;
QLineEdit
*
const
mServerName
;
QLineEdit
*
const
mCommand
;
QLineEdit
*
const
mCommandLine
;
KUrlRequester
*
const
mExecutable
;
};
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