Skip to content

Commit

Permalink
[caliigra] Enable opening text documents. Contributes to JB#45282
Browse files Browse the repository at this point in the history
  • Loading branch information
adenexter committed Apr 11, 2019
1 parent 3de2553 commit 59efa96
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
45 changes: 45 additions & 0 deletions rpm/calligra-ascii-import.patch
@@ -0,0 +1,45 @@
diff --git a/filters/words/ascii/AsciiImport.cpp b/filters/words/ascii/AsciiImport.cpp
index 74ac6b3..139c143 100644
--- a/filters/words/ascii/AsciiImport.cpp
+++ b/filters/words/ascii/AsciiImport.cpp
@@ -135,6 +135,7 @@ KoFilter::ConversionStatus AsciiImport::convert(const QByteArray& from, const QB
}

int paragraphStrategy = 0;
+#if 0
if (!m_chain->manager()->getBatchMode()) {
QPointer<AsciiImportDialog> dialog = new AsciiImportDialog(codec->name(), QApplication::activeWindow());
if (!dialog) { in.close(); return KoFilter::StupidError; }
@@ -142,6 +143,7 @@ KoFilter::ConversionStatus AsciiImport::convert(const QByteArray& from, const QB
codec = dialog->getCodec();
paragraphStrategy = dialog->getParagraphStrategy();
}
+#endif
if (!codec) return KoFilter::StupidError;
debugAsciiImport << "Charset used:" << codec->name();

diff --git a/filters/words/ascii/CMakeLists.txt b/filters/words/ascii/CMakeLists.txt
index c7643e9..7fa2eb1 100644
--- a/filters/words/ascii/CMakeLists.txt
+++ b/filters/words/ascii/CMakeLists.txt
@@ -13,7 +13,7 @@ set(ascii2words_PART_SRCS
ki18n_wrap_ui(ascii2words_PART_SRCS ImportDialogUI.ui )
add_library(calligra_filter_ascii2words MODULE ${ascii2words_PART_SRCS})
calligra_filter_desktop_to_json(calligra_filter_ascii2words calligra_filter_ascii2words.desktop)
-target_link_libraries(calligra_filter_ascii2words komain kotextlayout wordsprivate KF5::Codecs)
+target_link_libraries(calligra_filter_ascii2words komain kotextlayout wordsprivate KF5::Codecs KF5::Completion)
install(TARGETS calligra_filter_ascii2words DESTINATION ${PLUGIN_INSTALL_DIR}/calligra/formatfilters)

endif()
diff --git a/words/part/wordspart.desktop b/words/part/wordspart.desktop
index 024d628..7477137 100644
--- a/words/part/wordspart.desktop
+++ b/words/part/wordspart.desktop
@@ -41,6 +41,6 @@ X-KDE-Library=wordspart
X-KDE-NativeMimeType=application/vnd.oasis.opendocument.text
X-KDE-NativeOasisMimeType=application/vnd.oasis.opendocument.text
X-KDE-ExtraNativeMimeTypes=application/vnd.oasis.opendocument.text-master,application/vnd.oasis.opendocument.text-template
-MimeType=application/vnd.oasis.opendocument.text-master;application/vnd.oasis.opendocument.text;application/vnd.oasis.opendocument.text-template;application/msword;application/rtf;application/x-mswrite;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.openxmlformats-officedocument.wordprocessingml.template;application/vnd.ms-works;application/vnd.wordperfect;
+MimeType=application/vnd.oasis.opendocument.text-master;application/vnd.oasis.opendocument.text;application/vnd.oasis.opendocument.text-template;application/msword;application/rtf;application/x-mswrite;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.openxmlformats-officedocument.wordprocessingml.template;application/vnd.ms-works;application/vnd.wordperfect;text/plain;
X-KDE-ServiceTypes=Calligra/Part
Icon=calligrawords
4 changes: 3 additions & 1 deletion rpm/calligra.spec
Expand Up @@ -34,6 +34,7 @@ Patch15: calligra-sheets.patch
Patch18: calligra-cache.patch
Patch19: calligra-qtdbus.patch
Patch20: calligra-background.patch
Patch21: calligra-ascii-import.patch

%description
%{summary}.
Expand Down Expand Up @@ -184,6 +185,7 @@ BuildRequires: extra-cmake-modules >= 5.34.0
%patch18 -d upstream -p1
%patch19 -d upstream -p1
%patch20 -d upstream -p1
%patch21 -d upstream -p1

%define build_kf5() cd %1 ; if [ ! -d build ] ; then mkdir build ; fi ; cd build ; if [ ! -e Makefile ] ; then CMAKE_PREFIX_PATH=%{_buildrootdir}/kf5/usr cmake -DCMAKE_INSTALL_PREFIX=/usr %2 .. ; fi ; make %{?_smp_mflags} install DESTDIR=%{_buildrootdir}/kf5 ; cd ../.. ;
%build
Expand All @@ -202,7 +204,7 @@ BuildRequires: extra-cmake-modules >= 5.34.0
%build_kf5 kio "-DKIOCORE_ONLY=True"
%build_kf5 kxmlgui
if [ ! -d upstream/build ] ; then mkdir upstream/build ; fi ; cd upstream/build
CMAKE_PREFIX_PATH=%{_buildrootdir}/kf5/usr cmake -DCMAKE_INSTALL_PREFIX=/usr -DPRODUCTSET="PART_WORDS PART_STAGE PART_SHEETS PART_COMPONENTS FILTER_DOCX_TO_ODT FILTER_DOC_TO_ODT FILTER_RTF_TO_ODT FILTER_XLSX_TO_ODS FILTER_XLS_TO_SHEETS FILTER_PPTX_TO_ODP FILTER_PPT_TO_ODP" -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release ..
CMAKE_PREFIX_PATH=%{_buildrootdir}/kf5/usr cmake -DCMAKE_INSTALL_PREFIX=/usr -DPRODUCTSET="PART_WORDS PART_STAGE PART_SHEETS PART_COMPONENTS FILTER_DOCX_TO_ODT FILTER_DOC_TO_ODT FILTER_RTF_TO_ODT FILTER_XLSX_TO_ODS FILTER_XLS_TO_SHEETS FILTER_PPTX_TO_ODP FILTER_PPT_TO_ODP FILTER_ASCII_TO_WORDS" -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release ..
make %{?_smp_mflags}

%install
Expand Down

0 comments on commit 59efa96

Please sign in to comment.