[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdevelop/5.1] formatters: Restore preview for source formatting styles in config selection
From:       Friedrich W. H. Kossebau <null () kde ! org>
Date:       2017-08-01 3:41:14
Message-ID: E1dcO3W-0001We-KF () code ! kde ! org
[Download RAW message or body]

Git commit bbbf1fdeca2946f607c02088251db963547e6a08 by Friedrich W. H. Kossebau.
Committed on 01/08/2017 at 03:36.
Pushed by kossebau into branch '5.1'.

Restore preview for source formatting styles in config selection

While 4a48b37214e088ee9aacda5b8798b927df6d290b in 2011 used the new
usePreview flag of SourceFormatterStyle to disable the preview,
and only for kdev_format_sources.sh, actually the default value of the
flag has been set already to false in the matching commit to kdevplatform,
at least to the (unused) default constructor.
And at least once the SourceFormatterStyle(const QString &name) constructor
was fixed to not leave the initial value of the usePreview flag undefined
and now sets it to false per default as well, all the other styles
lost their previews as well.

Explicitely setting the flag to true for those styles where a preview
is usable restores the preview.

M  +1    -0    formatters/astyle/astyle_plugin.cpp
M  +3    -0    formatters/customscript/customscript_plugin.cpp

https://commits.kde.org/kdevelop/bbbf1fdeca2946f607c02088251db963547e6a08

diff --git a/formatters/astyle/astyle_plugin.cpp \
b/formatters/astyle/astyle_plugin.cpp index 12c9d56429..15d66664f6 100644
--- a/formatters/astyle/astyle_plugin.cpp
+++ b/formatters/astyle/astyle_plugin.cpp
@@ -113,6 +113,7 @@ SourceFormatterStyle predefinedStyle(const QString& name, const \
QString& caption  fmt.predefinedStyle( name );
     st.setContent( fmt.saveStyle() );
     st.setMimeTypes(supportedMimeTypes());
+    st.setUsePreview(true);
     return st;
 }
 
diff --git a/formatters/customscript/customscript_plugin.cpp \
b/formatters/customscript/customscript_plugin.cpp index 442b2b9bd8..168581d082 100644
--- a/formatters/customscript/customscript_plugin.cpp
+++ b/formatters/customscript/customscript_plugin.cpp
@@ -244,12 +244,15 @@ KDevelop::SourceFormatterStyle \
CustomScriptPlugin::predefinedStyle(const QString  {
 		result.setCaption(i18n("Gnu Indent: GNU"));
 		result.setContent("indent");
+		result.setUsePreview(true);
 	} else if (name == "GNU_indent_KR") {
 		result.setCaption(i18n("Gnu Indent: Kernighan & Ritchie"));
 		result.setContent("indent -kr");
+		result.setUsePreview(true);
 	} else if (name == "GNU_indent_orig") {
 		result.setCaption(i18n("Gnu Indent: Original Berkeley indent style"));
 		result.setContent("indent -orig");
+		result.setUsePreview(true);
 	} else if(name == "kdev_format_source") {
 		result.setCaption("KDevelop: kdev_format_source");
 		result.setContent("kdev_format_source $FILE $TMPFILE");


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic