[Libreoffice-commits] core.git: Branch 'feature/gsoc14-personas' - 2 commits - cui/source
Rachit Gupta
rachitgupta1792 at gmail.com
Sat Jun 14 22:29:32 PDT 2014
cui/source/options/personalization.cxx | 14 ++++++++++++--
cui/source/options/personasdochandler.cxx | 15 +++++++++++----
cui/source/options/personasdochandler.hxx | 6 ++++--
3 files changed, 27 insertions(+), 8 deletions(-)
New commits:
commit 818a18bc0424c95a8fe658c8f3b5068da5f03ef7
Author: Rachit Gupta <rachitgupta1792 at gmail.com>
Date: Sun Jun 15 10:56:16 2014 +0530
Fixed Bug: SelectPersonaDialog was not closing on clicking OK.
The dialog did not close on clicking OK if nothing was selected or if
nothing was searched. It does now.
Change-Id: I92f777bca8f306fea8da3ebd18ca41c34443a733
diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx
index 0379a47..dab1925 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -315,8 +315,9 @@ IMPL_LINK( SvxPersonalizationTabPage, SelectPersona, PushButton*, /*pButton*/ )
if ( !aPersonaSetting.isEmpty() )
{
m_aPersonaSettings = aPersonaSetting;
- break;
}
+
+ break;
}
return 0;
commit ff69ba7d792eed61eff517bbd947fd721382a8d3
Author: Rachit Gupta <rachitgupta1792 at gmail.com>
Date: Sun Jun 15 10:05:34 2014 +0530
Added check for no results.
The XML root node contains total_results attribute. If there are no
results matching the search term, then the user is notified of it.
Change-Id: I4b2ae5efe4af700dbc7a554a22a558f94c56e3bc
diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx
index 2cc6cf8..0379a47 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -223,6 +223,8 @@ void SelectPersonaDialog::ClearSearchResults()
{
m_vPersonaSettings.clear();
m_aSelectedPersona = "";
+ for( sal_Int32 nIndex = 0; nIndex < 9; nIndex++ )
+ m_vResultList[nIndex]->Hide();
}
SvxPersonalizationTabPage::SvxPersonalizationTabPage( Window *pParent, const SfxItemSet &rSet )
@@ -435,6 +437,13 @@ void SearchAndParseThread::execute()
aParserInput.aInputStream = xStream;
xParser->parseStream( aParserInput );
+ if( !pHandler->hasResults() )
+ {
+ sProgress = "No results found.";
+ m_pPersonaDialog->SetProgress( sProgress );
+ return;
+ }
+
std::vector<OUString> vLearnmoreURLs = pHandler->getLearnmoreURLs();
std::vector<OUString>::iterator it;
std::vector<Image> vResultList;
@@ -537,7 +546,7 @@ void SearchAndParseThread::getPreviewFile( const OUString& rURL, OUString *pHead
}
catch (...)
{
- sProgress = "Something went wrong. Please try again.";
+ OUString sProgress = "Something went wrong. Please try again.";
m_pPersonaDialog->SetProgress( sProgress );
return;
}
diff --git a/cui/source/options/personasdochandler.cxx b/cui/source/options/personasdochandler.cxx
index 521b561..020b9fc 100644
--- a/cui/source/options/personasdochandler.cxx
+++ b/cui/source/options/personasdochandler.cxx
@@ -29,7 +29,7 @@ void SAL_CALL
PersonasDocHandler::characters( const OUString & aChars)
throw ( xml::sax::SAXException, RuntimeException, std::exception )
{
- if( m_bLearnmoreTag )
+ if( m_isLearnmoreTag )
m_vLearnmoreURLs.push_back( aChars );
}
@@ -55,14 +55,21 @@ PersonasDocHandler::setDocumentLocator(
void SAL_CALL
PersonasDocHandler::startElement( const OUString& aName,
- const Reference< xml::sax::XAttributeList > & )
+ const Reference< xml::sax::XAttributeList > &xAttribs )
throw ( xml::sax::SAXException,
RuntimeException, std::exception )
{
+ if( aName == "searchresults" )
+ {
+ OUString aTotalResults = xAttribs->getValueByName( "total_results" );
+ if( !aTotalResults.equals( "0" ) )
+ m_hasResults = true;
+ }
+
if ( aName == "learnmore" )
- m_bLearnmoreTag = true;
+ m_isLearnmoreTag = true;
else
- m_bLearnmoreTag = false;
+ m_isLearnmoreTag = false;
}
void SAL_CALL PersonasDocHandler::endElement( const OUString & )
diff --git a/cui/source/options/personasdochandler.hxx b/cui/source/options/personasdochandler.hxx
index d38f0f3..2383452 100644
--- a/cui/source/options/personasdochandler.hxx
+++ b/cui/source/options/personasdochandler.hxx
@@ -19,10 +19,12 @@ class PersonasDocHandler : public ::cppu::WeakImplHelper1< css::xml::sax::XDocum
{
private:
std::vector<OUString> m_vLearnmoreURLs;
- bool m_bLearnmoreTag;
+ bool m_isLearnmoreTag, m_hasResults;
public:
- PersonasDocHandler(){ m_bLearnmoreTag = false; }
+ PersonasDocHandler(){ m_isLearnmoreTag = false; m_hasResults = false; }
std::vector<OUString> getLearnmoreURLs() { return m_vLearnmoreURLs; }
+ bool hasResults() { return m_hasResults; }
+
// XDocumentHandler
virtual void SAL_CALL startDocument()
throw ( css::xml::sax::SAXException, css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
More information about the Libreoffice-commits
mailing list