Hello community, here is the log from the commit of package fate for openSUSE:Factory checked in at 2017-03-08 01:16:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/fate (Old) and /work/SRC/openSUSE:Factory/.fate.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "fate" Wed Mar 8 01:16:43 2017 rev:4 rq:477434 version:1.5.5.8.1 Changes: -------- --- /work/SRC/openSUSE:Factory/fate/fate.changes 2017-02-13 07:51:03.005704982 +0100 +++ /work/SRC/openSUSE:Factory/.fate.new/fate.changes 2017-03-08 01:16:44.447192358 +0100 @@ -1,0 +2,13 @@ +Tue Mar 7 10:51:05 UTC 2017 - [email protected] + +- remove dependency to libBoost, contribution from Michael Matz + +------------------------------------------------------------------- +Mon Mar 6 13:36:05 UTC 2017 - [email protected] + +- update to version 1.5.5.8 + * bsc#1028004: Error when generating a query that uses milestones + * remember DeltaDialog size over restart + * make diffs in 'Changes' dialog coloured + +------------------------------------------------------------------- Old: ---- fate-20170210-ac378d5.tar.bz2 New: ---- fate-20170307-5ebdb80.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ fate.spec ++++++ --- /var/tmp/diff_new_pack.RhBAko/_old 2017-03-08 01:16:45.491044642 +0100 +++ /var/tmp/diff_new_pack.RhBAko/_new 2017-03-08 01:16:45.491044642 +0100 @@ -16,9 +16,9 @@ # -%define baseversion 1.5.5.7 -%define patchlevel .2 -%define snapshot 20170210-ac378d5 +%define baseversion 1.5.5.8 +%define patchlevel .1 +%define snapshot 20170307-5ebdb80 Name: fate Version: %{baseversion}%{patchlevel} Release: 0 ++++++ fate-20170210-ac378d5.tar.bz2 -> fate-20170307-5ebdb80.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fate-20170210-ac378d5/CMakeLists.txt new/fate-20170307-5ebdb80/CMakeLists.txt --- old/fate-20170210-ac378d5/CMakeLists.txt 2017-02-10 13:02:19.169525178 +0100 +++ new/fate-20170307-5ebdb80/CMakeLists.txt 2017-03-07 11:50:52.975419364 +0100 @@ -25,7 +25,6 @@ find_package(SQLite3 REQUIRED) find_package(MEINPROC) find_package(Qt4 4.6 COMPONENTS QtCore QtGui QtXml QtDbus REQUIRED) -find_package(Boost COMPONENTS system REQUIRED) find_package(LibXslt REQUIRED) find_package(CTemplate REQUIRED) find_package(Threads REQUIRED) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fate-20170210-ac378d5/src/fate/querydialog.cpp new/fate-20170307-5ebdb80/src/fate/querydialog.cpp --- old/fate-20170210-ac378d5/src/fate/querydialog.cpp 2017-02-10 13:02:19.189525273 +0100 +++ new/fate-20170307-5ebdb80/src/fate/querydialog.cpp 2017-03-07 11:50:52.999419484 +0100 @@ -293,9 +293,9 @@ productCriteria.append(QString("product/productid='%1'") .arg(mMilestoneProduct)); if (milestone == i18n("None")) - productCriteria.append(QString(" and not(milestone)")); + productCriteria.append(QString("not(milestone)")); else if (milestone != i18n("Any")) - productCriteria.append(QString(" and milestone/name='%2'") + productCriteria.append(QString("milestone/name='%2'") .arg(milestone)); } } @@ -489,7 +489,7 @@ cmbMilestone->clear(); cmbMilestone->addItems( QStringList() << i18n("Any") << i18n("None")); - Product *p = mProductMap->product( product ); + Product *p = mProductMap->product(mProductMap->idForDisplayName(product)); if( !p ) return; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fate-20170210-ac378d5/src/fate.desktop new/fate-20170307-5ebdb80/src/fate.desktop --- old/fate-20170210-ac378d5/src/fate.desktop 2017-02-10 13:02:19.181525236 +0100 +++ new/fate-20170307-5ebdb80/src/fate.desktop 2017-03-07 11:50:52.991419444 +0100 @@ -3,8 +3,7 @@ Exec=fate %i -caption "%c" Icon=fate Type=Application -#DocPath=fate/index.html GenericName=SUSE Feature Tool Client Terminal=false -Categories=X-SuSE-core; +Categories=Qt;Office;Database;X-SuSE-core;ProjectManagement; X-SuSE-translate=false diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fate-20170210-ac378d5/src/libfate/productmap.cpp new/fate-20170307-5ebdb80/src/libfate/productmap.cpp --- old/fate-20170210-ac378d5/src/libfate/productmap.cpp 2017-02-10 13:02:19.197525312 +0100 +++ new/fate-20170307-5ebdb80/src/libfate/productmap.cpp 2017-03-07 11:50:53.007419525 +0100 @@ -2,8 +2,10 @@ This file is part of Fate. Copyright (c) 2007 SUSE LINUX Products GmbH - + 2017 SUSE Linux GmbH + Author: Cornelius Schumacher <[email protected]> + Joachim Plack <[email protected]> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,7 +32,6 @@ #include "startupsequence.h" #include "cache/cache.h" -#include <kdebug.h> #include <klocale.h> #include <qdom.h> @@ -61,9 +62,8 @@ void ProductMap::clear() { - QMap<QString, Product *>::ConstIterator it; - for( it = mProducts.begin(); it != mProducts.end(); ++it ) { - delete it.value(); + foreach (Product *p, mProducts.values()) { + delete p; } mProducts.clear(); @@ -95,34 +95,22 @@ Product *ProductMap::product( const QString &id ) const { - QMap<QString, Product *>::ConstIterator it = mProducts.find( id ); - if ( it == mProducts.end() ) return 0; - else return it.value(); + return mProducts.value(id, NULL); } Product::List ProductMap::products() const { - Product::List products; - - QMap<QString, Product *>::ConstIterator it; - for( it = mProducts.begin(); it != mProducts.end(); ++it ) { - products.append( it.value() ); - } - - return products; + return mProducts.values(); } Product::List ProductMap::products(const QStringList &idList) const { - QStringList::ConstIterator it; Product::List result; - for (it = idList.begin(); it != idList.end(); ++it) { - Product *p = mProducts[*it]; - - if (p != 0) - result.append(p); + foreach (const QString &id, idList) { + if (mProducts.contains(id)) + result.append(mProducts[id]); } return result; } @@ -137,12 +125,9 @@ QString ProductMap::idForDisplayName(const QString &name) const { - QMap<QString, Product *>::ConstIterator it; - - for (it = mProducts.begin(); it != mProducts.end(); ++it) { - Product *product = it.value(); + foreach (Product *product, mProducts.values()) { if (product->fateName() == name) - return it.key(); + return product->id(); } return QString::null; @@ -162,8 +147,6 @@ { if ( xml.isEmpty() ) return; -// kDebug() << "XML: " << xml; - clear(); QDomDocument doc; @@ -192,16 +175,13 @@ } } - kDebug() << "Non cached products: " << ids; - if ( !ids.isEmpty() ) { QString postXml = "<k:rpc xmlns:k=\"http://inttools.suse.de/sxkeeper/schema/keeper\">\n"; postXml += "<k:container>product</k:container>\n"; - QStringList::ConstIterator it2; - for( it2 = ids.begin(); it2 != ids.end(); ++it2 ) { - postXml.append( "<k:id>" + *it2 + "</k:id>\n"); + foreach (const QString &id, ids) { + postXml.append(QString("<k:id>%1</k:id>\n").arg(id)); } postXml += "</k:rpc>\n"; @@ -218,6 +198,7 @@ connect( &parser, SIGNAL( productParsed( Product * ) ), SLOT( addProduct( Product * ) ) ); + // FIXME: Show a usable error message if ( !parser.parse( xml ) ) { kError() << "Unable to parse XML"; } @@ -230,11 +211,9 @@ { QStringList result; - QStringList::ConstIterator it; - for( it = productIds.begin(); it != productIds.end(); ++it ) { - if ( mProducts.find( *it ) != mProducts.end() ) { - result.append( *it ); - } + foreach (const QString &id, productIds) { + if (mProducts.contains(id)) + result.append(id); } return result; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fate-20170210-ac378d5/src/libfate/tinyjson.hpp new/fate-20170307-5ebdb80/src/libfate/tinyjson.hpp --- old/fate-20170210-ac378d5/src/libfate/tinyjson.hpp 2017-02-10 13:02:19.201525331 +0100 +++ new/fate-20170307-5ebdb80/src/libfate/tinyjson.hpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,584 +0,0 @@ -/* - * TinyJson 1.3.0 - * A Minimalistic JSON Reader Based On Boost.Spirit, Boost.Any, and Boost.Smart_Ptr. - * - * Copyright (c) 2008 Thomas Jansen ([email protected]) - * - * Distributed under the Boost Software License, Version 1.0. (See accompanying - * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - * - * See http://blog.beef.de/projects/tinyjson/ for documentation. - * - * (view source with tab-size = 3) - * - * 29 Mar 2008 - use strict_real_p for number parsing, small cleanup (Thomas Jansen) - * 26 Mar 2008 - made json::grammar a template (Boris Schaeling) - * 20 Mar 2008 - optimized by using boost::shared_ptr (Thomas Jansen) - * 29 Jan 2008 - Small bugfixes (Thomas Jansen) - * 04 Jan 2008 - Released to the public (Thomas Jansen) - * 13 Nov 2007 - initial release (Thomas Jansen) * - * - * 29 Mar 2008 - */ - - -#ifndef TINYJSON_HPP -#define TINYJSON_HPP - -#include <boost/shared_ptr.hpp> -#include <boost/any.hpp> -#if !defined(BOOST_SPIRIT_USE_OLD_NAMESPACE) -#define BOOST_SPIRIT_USE_OLD_NAMESPACE -#endif -#include <boost/spirit/include/classic.hpp> -#include <boost/spirit/home/classic/utility/loops.hpp> -#include <boost/lexical_cast.hpp> - -#include <string> -#include <stack> -#include <utility> -#include <deque> -#include <map> - - -namespace json -{ - // ========================================================================================================== - // === U N I C O D E _ C O N V E R T === - // ========================================================================================================== - - template< typename Char > - struct unicodecvt - { - static std::basic_string< Char > convert(int iUnicode) - { - return std::basic_string< Char >(1, static_cast< Char >(iUnicode)); - } - }; - - - // ---[ TEMPLATE SPECIALIZATION FOR CHAR ]-------------------------------------------------------------------- - - template<> - struct unicodecvt< char > - { - static std::string convert(int iUnicode) - { - std::string strString; - - if(iUnicode < 0x0080) - { - // character 0x0000 - 0x007f... - - strString.push_back(0x00 | ((iUnicode & 0x007f) >> 0)); - } - else if(iUnicode < 0x0800) - { - // character 0x0080 - 0x07ff... - - strString.push_back(0xc0 | ((iUnicode & 0x07c0) >> 6)); - strString.push_back(0x80 | ((iUnicode & 0x003f) >> 0)); - } - else - { - // character 0x0800 - 0xffff... - - strString.push_back(0xe0 | ((iUnicode & 0x00f000) >> 12)); - strString.push_back(0x80 | ((iUnicode & 0x000fc0) >> 6)); - strString.push_back(0x80 | ((iUnicode & 0x00003f) >> 0)); - } - - return strString; - } - }; - - - // ========================================================================================================== - // === T H E J S O N G R A M M A R === - // ========================================================================================================== - - template< typename Char > - class grammar : public boost::spirit::grammar< grammar< Char > > - { - public: - - // ---[ TYPEDEFINITIONS ]--------------------------------------------------------------------------------- - - typedef boost::shared_ptr< boost::any > variant; // pointer to a shared variant - - typedef std::stack< variant > stack; // a stack of json variants - typedef std::pair< std::basic_string< Char >, variant > pair; // a pair as it appears in json - - typedef std::deque< variant > array; // an array of json variants - typedef std::map< std::basic_string< Char >, variant > object; // an object with json pairs - - protected: - - // ---[ SEMANTIC ACTION: PUSH A STRING ON THE STACK (AND ENCODE AS UTF-8) ]------------------------------- - - struct push_string - { - stack & m_stack; - push_string(stack & stack) : m_stack(stack) { } - - template <typename Iterator> - void operator() (Iterator szStart, Iterator szEnd) const - { - // 1: skip the quotes... - - ++szStart; - --szEnd; - - // 2: traverse through the original string and check for escape codes.. - - std::basic_string< typename Iterator::value_type > strString; - - while(szStart < szEnd) - { - // 2.1: if it's no escape code, just append to the resulting string... - - if(*szStart != static_cast< typename Iterator::value_type >('\\')) - { - // 2.1.1: append the character... - - strString.push_back(*szStart); - } - else - { - // 2.1.2: otherwise, check the escape code... - - ++szStart; - - switch(*szStart) - { - default: - - strString.push_back(*szStart); - break; - - case 'b': - - strString.push_back(static_cast< typename Iterator::value_type >('\b')); - break; - - case 'f': - - strString.push_back(static_cast< typename Iterator::value_type >('\f')); - break; - - case 'n': - - strString.push_back(static_cast< typename Iterator::value_type >('\n')); - break; - - case 'r': - - strString.push_back(static_cast< typename Iterator::value_type >('\r')); - break; - - case 't': - - strString.push_back(static_cast< typename Iterator::value_type >('\t')); - break; - - case 'u': - { - // 2.1.2.1: convert the following hex value into an int... - - int iUnicode; - std::basic_string< typename Iterator::value_type > s1(&szStart[1], 4); - std::basic_istringstream< Char > s2(s1); - s2 >> std::hex >> iUnicode; - // std::basic_istringstream< Char >(std::basic_string< typename Iterator::value_type >(&szStart[1], 4)) >> std::hex >> iUnicode; - - szStart += 4; - - // 2.1.2.2: append the unicode int... - - strString.append(unicodecvt< typename Iterator::value_type >::convert(iUnicode)); - } - } - } - - // 2.2: go on with the next character... - - ++szStart; - } - - // 3: finally, push the string on the stack... - - m_stack.push(variant(new boost::any(strString))); - } - }; - - - // ---[ SEMANTIC ACTION: PUSH A REAL ON THE STACK ]------------------------------------------------------- - - struct push_double - { - stack & m_stack; - push_double(stack & stack) : m_stack(stack) { } - - void operator() (double dValue) const - { - m_stack.push(variant(new boost::any(dValue))); - } - }; - - - // ---[ SEMANTIC ACTION: PUSH AN INT ON THE STACK ]------------------------------------------------------- - - struct push_int - { - stack & m_stack; - push_int(stack & stack) : m_stack(stack) { } - - void operator() (int iValue) const - { - m_stack.push(variant(new boost::any(iValue))); - } - }; - - - // ---[ SEMANTIC ACTION: PUSH A BOOLEAN ON THE STACK ]---------------------------------------------------- - - struct push_boolean - { - stack & m_stack; - push_boolean(stack & stack) : m_stack(stack) { } - - template <typename Iterator> - void operator() (Iterator szStart, Iterator /* szEnd */ ) const - { - // 1: push a boolean that is "true" if the string starts with 't' and "false" otherwise... - - m_stack.push(variant(new boost::any(*szStart == static_cast< typename Iterator::value_type >('t')))); - } - }; - - - // ---[ SEMANTIC ACTION: PUSH A NULL VALUE ON THE STACK ]------------------------------------------------- - - struct push_null - { - stack & m_stack; - push_null(stack & stack) : m_stack(stack) { } - - template <typename Iterator> - void operator() (Iterator /* szStart */ , Iterator /* szEnd */ ) const - { - m_stack.push(variant(new boost::any())); - } - }; - - - // ---[ SEMANTIC ACTION: CREATE A "JSON PAIR" ON THE STACK ]---------------------------------------------- - - struct create_pair - { - stack & m_stack; - create_pair(stack & stack) : m_stack(stack) { } - - template <typename Iterator> - void operator() (Iterator /* szStart */, Iterator /* szEnd */ ) const - { - // 1: get the variant from the stack... - - variant var = m_stack.top(); - m_stack.pop(); - - // 2: get the name from the stack... - - std::basic_string< typename Iterator::value_type > strName; - - try - { - strName = boost::any_cast< std::basic_string< typename Iterator::value_type > >(*m_stack.top()); - } - catch(boost::bad_any_cast &) { /* NOTHING */ } - - m_stack.pop(); - - // 3: push a pair of both on the stack... - - m_stack.push(variant(new boost::any(pair(strName, var)))); - } - }; - - - // ---[ SEMANTIC ACTION: BEGIN AN ARRAY ]----------------------------------------------------------------- - - class array_delimiter { /* EMPTY CLASS */ }; - - struct begin_array - { - stack & m_stack; - begin_array(stack & stack) : m_stack(stack) { } - - template <typename Iterator> - void operator() (Iterator /* cCharacter */) const - { - m_stack.push(variant(new boost::any(array_delimiter()))); - } - }; - - - // ---[ SEMANTIC ACTION: CREATE AN ARRAY FROM THE VALUES ON THE STACK ]----------------------------------- - - struct end_array - { - stack & m_stack; - end_array(stack & stack) : m_stack(stack) { } - - // - -[ functional operator ] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - template <typename Iterator> - void operator() (Iterator /* cCharacter */) const - { - // 1: create an array object and push everything in it, that's on the stack... - - variant varArray(new boost::any(array())); - - while(!m_stack.empty()) - { - // 1.1: get the top most variant of the stack... - - variant var = m_stack.top(); - m_stack.pop(); - - // 1.2: is it the end of the array? if yes => break the loop... - - if(boost::any_cast< array_delimiter >(var.get()) != NULL) - { - break; - } - - // 1.3: otherwise, add to the array... - - boost::any_cast< array >(varArray.get())->push_front(var); - } - - // 2: finally, push the array at the end of the stack... - - m_stack.push(varArray); - } - }; - - - // ---[ SEMANTIC ACTION: BEGIN AN OBJECT ]---------------------------------------------------------------- - - class object_delimiter { /* EMPTY CLASS */ }; - - struct begin_object - { - stack & m_stack; - begin_object(stack & stack) : m_stack(stack) { } - - template <typename Iterator> - void operator() (Iterator /* cCharacter */) const - { - m_stack.push(variant(new boost::any(object_delimiter()))); - } - }; - - - // ---[ SEMANTIC ACTION: CREATE AN OBJECT FROM THE VALUES ON THE STACK ]---------------------------------- - - struct end_object - { - stack & m_stack; - end_object(stack & stack) : m_stack(stack) { } - - template <typename Iterator> - void operator() (Iterator /* cCharacter */) const - { - // 1: create an array object and push everything in it, that's on the stack... - - variant varObject(new boost::any(object())); - - while(!m_stack.empty()) - { - // 1.1: get the top most variant of the stack... - - variant var = m_stack.top(); - m_stack.pop(); - - // 1.2: is it the end of the array? if yes => break the loop... - - if(boost::any_cast< object_delimiter >(var.get()) != NULL) - { - break; - } - - // 1.3: if this is not a pair, we have a problem... - - pair * pPair = boost::any_cast< pair >(var.get()); - if(!pPair) - { - /* BIG PROBLEM!! */ - - continue; - } - - // 1.4: set the child of this object... - - boost::any_cast< object >(varObject.get())->insert(std::make_pair(pPair->first, pPair->second)); - } - - // 2: finally, push the array at the end of the stack... - - m_stack.push(varObject); - } - }; - - public: - - stack & m_stack; - grammar(stack & stack) : m_stack(stack) { } - - // ---[ THE ACTUAL GRAMMAR DEFINITION ]------------------------------------------------------------------- - - template <typename SCANNER> - class definition - { - boost::spirit::rule< SCANNER > m_object; - boost::spirit::rule< SCANNER > m_array; - boost::spirit::rule< SCANNER > m_pair; - boost::spirit::rule< SCANNER > m_value; - boost::spirit::rule< SCANNER > m_string; - boost::spirit::rule< SCANNER > m_number; - boost::spirit::rule< SCANNER > m_boolean; - boost::spirit::rule< SCANNER > m_null; - boost::spirit::rule< SCANNER > m_start; - - public: - - boost::spirit::rule< SCANNER > const & start() const { return m_start; } - - // - -[ create the definition ] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - definition(grammar const & self) - { - using namespace boost::spirit; - - // 1: an object is an unordered set of pairs (seperated by commas)... - - m_object - = ch_p('{') [ begin_object(self.m_stack) ] >> - !(m_pair >> *(ch_p(',') >> m_pair)) >> - ch_p('}') [ end_object (self.m_stack) ]; - - // 2: an array is an ordered collection of values (seperated by commas)... - - m_array - = ch_p('[') [ begin_array(self.m_stack) ] >> - !(m_value >> *(ch_p(',') >> m_value)) >> - ch_p(']') [ end_array (self.m_stack) ]; - - m_start = m_object | m_array; - - // 3: a pair is given by a name and a value... - - m_pair - = ( m_string >> ch_p(':') >> m_value ) - [ create_pair(self.m_stack) ] - ; - - // 4: a value can be a string in double quotes, a number, a boolean, an object or an array. - - m_value - = m_string - | m_number - | m_object - | m_array - | m_boolean - | m_null - ; - - // 5: a string is a collection of zero or more unicode characters, wrapped in double quotes... - - m_string - = lexeme_d - [ - ( ch_p('"') >> *( - ( (anychar_p - (ch_p('"') | ch_p('\\'))) - | ch_p('\\') >> - ( ch_p('\"') - | ch_p('\\') - | ch_p('/') - | ch_p('b') - | ch_p('f') - | ch_p('n') - | ch_p('r') - | ch_p('t') - | (ch_p('u') >> repeat_p(4)[ xdigit_p ]) - ) - )) >> ch_p('"') - ) - [ push_string(self.m_stack) ] - ] - ; - - // 6: a number is very much like a C or java number... - - m_number - = strict_real_p [ push_double(self.m_stack) ] - | int_p [ push_int (self.m_stack) ] - ; - - // 7: a boolean can be "true" or "false"... - - m_boolean - = ( str_p("true") - | str_p("false") - ) - [ push_boolean(self.m_stack) ] - ; - - // 8: finally, a value also can be a 'null', i.e. an empty item... - - m_null - = str_p("null") - [ push_null(self.m_stack) ] - ; - } - }; - }; - - - // ========================================================================================================== - // === T H E F I N A L P A R S I N G R O U T I N E === - // ========================================================================================================== - - template <typename Iterator> - typename json::grammar< typename Iterator::value_type >::variant parse(Iterator const & szFirst, Iterator const & szEnd) - { - // 1: parse the input... - - typename json::grammar< typename Iterator::value_type >::stack st; - json::grammar< typename Iterator::value_type > gr(st); - - boost::spirit::parse_info<Iterator> pi = boost::spirit::parse(szFirst, szEnd, gr, boost::spirit::space_p); - - // 2: skip any spaces at the end of the parsed section... - - while((pi.stop != szEnd) && (*pi.stop == static_cast< typename Iterator::value_type >(' '))) - { - ++pi.stop; - } - - // 3: if the input's end wasn't reached or if there is more than one object on the stack => cancel... - - if((pi.stop != szEnd) || (st.size() != 1)) - { - return typename json::grammar< typename Iterator::value_type >::variant(new boost::any()); - } - - // 4: otherwise, return the result... - - return st.top(); - } -}; - - -#endif // TINYJSON_HPP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fate-20170210-ac378d5/src/libfate/ui/diffgenerator.cpp new/fate-20170307-5ebdb80/src/libfate/ui/diffgenerator.cpp --- old/fate-20170210-ac378d5/src/libfate/ui/diffgenerator.cpp 2017-02-10 13:02:19.201525331 +0100 +++ new/fate-20170307-5ebdb80/src/libfate/ui/diffgenerator.cpp 2017-03-07 11:50:53.007419525 +0100 @@ -24,46 +24,69 @@ #include "feature.h" #include "metafile.h" -#include "fatewidgets.h" #include "process.h" +#include "dialogsize.h" #include <kprocess.h> #include <ktemporaryfile.h> -#include <kdebug.h> #include <kstandarddirs.h> #include <kmessagebox.h> -#include <kdeversion.h> #include <klocale.h> #include <kdialog.h> -#include <qfile.h> #include <QByteArray> +#include <QDebug> +#include <QFile> +#include <QTextCursor> +#include <QTextEdit> #include <libxslt/transform.h> -class DiffDialog : public KDialog +class DeltaDialog : public KDialog { public: - DiffDialog( QWidget *parent, const QString &id, const QString &diff ); + DeltaDialog( QWidget *parent, const QString &id, const QString &diff ); + ~DeltaDialog(); }; -DiffDialog::DiffDialog( QWidget *parent, const QString &id, const QString &diff ) +DeltaDialog::DeltaDialog( QWidget *parent, const QString &id, const QString &diff ) : KDialog( parent ) { - FateTextEdit *edit = new FateTextEdit( this ); + QTextEdit *edit = new QTextEdit( this ); edit->setReadOnly( true ); setMainWidget( edit ); - edit->setText( diff ); + + foreach(const QString &line, diff.split("\n")) { + if (line.startsWith("-")) + edit->setTextColor(Qt::red); + else if (line.startsWith("+")) + edit->setTextColor(Qt::green); + else + edit->setTextColor(Qt::black); + edit->append( line ); + } + + QTextCursor cursor = edit->textCursor(); + cursor.setPosition(0); + edit->setTextCursor(cursor); + setInitialSize( QSize( 800, 600 ) ); setCaption( i18n("Changes made to Feature #%1").arg(id) ); setModal( true ); setButtons( KDialog::Ok ); + DialogSize::restore( this ); +} + +DeltaDialog::~DeltaDialog() +{ +DialogSize::remember( this ); } DiffGenerator::DiffGenerator( QWidget *parent ) : mParent( parent ) { + mDiffContext = 100000; } void DiffGenerator::diff( Feature *oldRev, Feature * newRev ) @@ -89,7 +112,7 @@ QByteArray xml = xmlString.toUtf8(); xmlDocPtr doc = xmlParseMemory( xml, xml.length() ); if ( !doc ) { - kError() << "XsltRenderer::render(): Error parsing xml"; + qWarning() << "XsltRenderer::render(): Error parsing xml"; return; } xmlDocPtr res = xsltApplyStylesheet( styleSheet, doc, 0 ); @@ -115,7 +138,7 @@ xml = xmlString.toUtf8(); doc = xmlParseMemory( xml, xml.length() ); if ( !doc ) { - kError() << "XsltRenderer::render(): Error parsing xml"; + qWarning() << "XsltRenderer::render(): Error parsing xml"; return; } res = xsltApplyStylesheet( styleSheet, doc, 0 ); @@ -134,8 +157,7 @@ QStringList diffArgs; - - diffArgs << "-U100000" << mOldFile->fileName() << mNewFile->fileName(); + diffArgs << QString::number(mDiffContext).prepend("-U") << mOldFile->fileName() << mNewFile->fileName(); FATE::Process *proc = new FATE::Process(this, "diff", diffArgs); connect(proc, SIGNAL(done(FATE::Process *, bool)), SLOT(processExited(FATE::Process *, bool))); @@ -169,7 +191,7 @@ output.replace( ">", ">" ); output.replace( "&", "&" ); - DiffDialog dlg( mParent, mId, output ); + DeltaDialog dlg( mParent, mId, output ); dlg.exec(); mNewFile->remove(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fate-20170210-ac378d5/src/libfate/ui/diffgenerator.h new/fate-20170307-5ebdb80/src/libfate/ui/diffgenerator.h --- old/fate-20170210-ac378d5/src/libfate/ui/diffgenerator.h 2017-02-10 13:02:19.201525331 +0100 +++ new/fate-20170307-5ebdb80/src/libfate/ui/diffgenerator.h 2017-03-07 11:50:53.007419525 +0100 @@ -48,6 +48,7 @@ KTemporaryFile *mOldFile; KTemporaryFile *mNewFile; QString mId; + unsigned mDiffContext; }; #endif
