cui/AllLangResTarget_cui.mk | 1 cui/Library_cui.mk | 1 cui/source/inc/cuires.hrc | 8 cui/source/options/personalization.cxx | 602 +++++++++++-- cui/source/options/personalization.hxx | 96 +- cui/source/options/personalization.src | 52 + cui/source/options/personasdochandler.cxx | 80 + cui/source/options/personasdochandler.hxx | 60 + cui/uiconfig/ui/personalization_tab.ui | 107 ++ cui/uiconfig/ui/select_persona_dialog.ui | 298 +++++- officecfg/registry/schema/org/openoffice/Office/Common.xcs | 44 sfx2/source/dialog/backingwindow.cxx | 4 vcl/source/app/settings.cxx | 22 13 files changed, 1256 insertions(+), 119 deletions(-)
New commits: commit a6fc653bbf38de453a540ca2ab69958dafa1d322 Author: Jan Holesovsky <[email protected]> Date: Thu Aug 14 15:07:58 2014 +0200 personas: Added a TODO FIXME wrt. ssl negotiation. Change-Id: I5f5889b6e63e8e6763abc39690adb78d48929783 diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 71da75f..5aafe83 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -123,6 +123,37 @@ IMPL_LINK( SelectPersonaDialog, SearchPersonas, PushButton*, pButton ) if( searchTerm.isEmpty( ) ) return 0; + // TODO FIXME! + // Before the release, the allizom.org url shoud be changed to: + // OUString rSearchURL = "https://services.addons.mozilla.org/en-US/firefox/api/1.5/search/" + searchTerm + "/9/9"; + // The problem why it cannot be done just now is that the SSL negotiation + // with services.addons.mozilla.org fails very early - during an early + // propfind, SSL returns X509_V_ERR_CERT_UNTRUSTED to neon, causing the + // NE_SSL_UNTRUSTED being set in verify_callback in neon/src/ne_openssl.c + // + // This is not cleared anywhere during the init, and so later, even though + // we have found the certificate, this triggers + // NeonSession_CertificationNotify callback, that + // causes that NE_SSL_UNTRUSTED is igored in cases when the condition + // if ( pSession->isDomainMatch( + // GetHostnamePart( xEECert.get()->getSubjectName() ) ) ) + // is true; but that is only when getSubjectName() actually returns a + // wildcard, or the exact name. + // + // In the case of services.addons.mozilla.com, the certificate is for + // versioncheck.addons.mozilla.com, but it also has + // X509v3 Subject Alternative Name: + // DNS:services.addons.mozilla.org, DNS:versioncheck-bg.addons.mozilla.org, DNS:pyrepo.addons.mozilla.org, DNS:versioncheck.addons.mozilla.org + // So it is all valid; but the early X509_V_ERR_CERT_UNTRUSTED failure + // described above just makes this being ignored. + // + // My suspicion is that this never actually worked, and the + // if ( pSession->isDomainMatch( + // GetHostnamePart( xEECert.get()->getSubjectName() ) ) ) + // works around the root cause that is there for years, and which makes it + // work in most cases. I guess that we initialize something wrongly or + // too late; but I have already spent few hours debugging, and + // give up for the moment - need to return to this at some stage. OUString rSearchURL = "https://addons.allizom.org/en-US/firefox/api/1.5/search/" + searchTerm + "/9/9"; m_rSearchThread = new SearchAndParseThread( this, rSearchURL ); m_rSearchThread->launch(); commit f4003ccbe4be3c5ef6ca08b98d43416b30ba8d0d Author: Jan Holesovsky <[email protected]> Date: Thu Aug 14 11:49:55 2014 +0200 personas: Better default searches, improved error messaging. Change-Id: I0a1303f5864516efbf69e7a0227f17e43aea4af7 diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 31e37e1..71da75f 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -45,23 +45,23 @@ SelectPersonaDialog::SelectPersonaDialog( Window *pParent ) m_pSearchButton->SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) ); get( m_vSearchSuggestions[0], "suggestion1" ); - m_vSearchSuggestions[0]->SetText( "libreoffice" ); + m_vSearchSuggestions[0]->SetText( "LibreOffice" ); m_vSearchSuggestions[0]->SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) ); get( m_vSearchSuggestions[1], "suggestion2" ); - m_vSearchSuggestions[1]->SetText( "science" ); + m_vSearchSuggestions[1]->SetText( "Abstract" ); m_vSearchSuggestions[1]->SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) ); get( m_vSearchSuggestions[2], "suggestion3" ); - m_vSearchSuggestions[2]->SetText( "firefox" ); + m_vSearchSuggestions[2]->SetText( "Color" ); m_vSearchSuggestions[2]->SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) ); get( m_vSearchSuggestions[3], "suggestion4" ); - m_vSearchSuggestions[3]->SetText( "nasa" ); + m_vSearchSuggestions[3]->SetText( "Music" ); m_vSearchSuggestions[3]->SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) ); get( m_vSearchSuggestions[4], "suggestion5" ); - m_vSearchSuggestions[4]->SetText( "harry potter" ); + m_vSearchSuggestions[4]->SetText( "Nature" ); m_vSearchSuggestions[4]->SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) ); get( m_pEdit, "search_term" ); @@ -562,8 +562,9 @@ void SearchAndParseThread::execute() } catch (...) { - sProgress = CUI_RES( RID_SVXSTR_SEARCHERROR ); - m_pPersonaDialog->SetProgress( sProgress ); + sProgress = CUI_RES(RID_SVXSTR_SEARCHERROR); + sProgress = sProgress.replaceAll("%1", m_aURL); + m_pPersonaDialog->SetProgress(sProgress); return; } diff --git a/cui/source/options/personalization.src b/cui/source/options/personalization.src index 7cfe7c0..e266e6c 100644 --- a/cui/source/options/personalization.src +++ b/cui/source/options/personalization.src @@ -31,12 +31,12 @@ String RID_SVXSTR_SELECTEDPERSONA String RID_SVXSTR_SEARCHING { - Text [ en-US ] = "Searching.. Please Wait.."; + Text [ en-US ] = "Searching, please wait..."; }; String RID_SVXSTR_SEARCHERROR { - Text [ en-US ] = "Something went wrong. Please try again."; + Text [ en-US ] = "Cannot open %1, please try again later."; }; String RID_SVXSTR_NORESULTS commit 8288aaa59a7df3f3632e98e824aef29a25b96b47 Author: Jan Holesovsky <[email protected]> Date: Thu Aug 14 09:28:47 2014 +0200 fdo#82043: Instead of the bold font, use a higher multiplifier. This reverts commit 04b02f2f5a4f71198e0cb616404c4721c918afe6. Change-Id: Iac19a0ced09bc8372e3a572d57dd3ac33ece9191 diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index 1c356c9..83d3aad 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -60,7 +60,7 @@ const char TEMPLATE_URL[] = "slot:5500"; const char OPEN_URL[] = ".uno:Open"; const char SERVICENAME_CFGREADACCESS[] = "com.sun.star.configuration.ConfigurationAccess"; -float fMultiplier = 1.2f; +float fMultiplier = 1.4f; const Color aButtonsBackground(114, 168, 84); // TDF green const Color aButtonsText(COL_WHITE); @@ -244,7 +244,6 @@ void BackingWindow::initControls() mpCreateLabel->SetControlForeground(aButtonsText); Font aFont(mpCreateLabel->GetSettings().GetStyleSettings().GetLabelFont()); aFont.SetSize(Size(0, aFont.GetSize().Height() * fMultiplier)); - aFont.SetWeight(WEIGHT_BOLD); mpCreateLabel->SetControlFont(aFont); mpHelpButton->SetControlForeground(aButtonsText); @@ -277,7 +276,6 @@ void BackingWindow::setupButton( PushButton* pButton ) // the buttons should have a bit bigger font Font aFont(pButton->GetSettings().GetStyleSettings().GetPushButtonFont()); aFont.SetSize(Size(0, aFont.GetSize().Height() * fMultiplier)); - aFont.SetWeight(WEIGHT_BOLD); pButton->SetControlFont(aFont); // color that fits the theme commit 5a23c290b58bc8b637de55472f85b4b17dded026 Author: Rachit Gupta <[email protected]> Date: Tue Aug 5 22:49:22 2014 +0530 Removed hardcoded strings. Replaced the hardcoded strings with their CUI_RES equivalents. Change-Id: I1f4e0451839cd9fe10aa9d1c5ae82af9fa13dc4e diff --git a/cui/AllLangResTarget_cui.mk b/cui/AllLangResTarget_cui.mk index 931fd1f..10bf5e6 100644 --- a/cui/AllLangResTarget_cui.mk +++ b/cui/AllLangResTarget_cui.mk @@ -47,6 +47,7 @@ $(eval $(call gb_SrsTarget_add_files,cui/res,\ cui/source/options/optjava.src \ cui/source/options/optlingu.src \ cui/source/options/optpath.src \ + cui/source/options/personalization.src \ cui/source/options/treeopt.src \ cui/source/tabpages/border.src \ cui/source/tabpages/frmdirlbox.src \ diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc index 03b5d61..81f4736 100644 --- a/cui/source/inc/cuires.hrc +++ b/cui/source/inc/cuires.hrc @@ -425,6 +425,14 @@ #define RID_SVXSTR_EDITHINT (RID_SVX_START + 1266) +// Search Persona Dialog +#define RID_SVXSTR_SEARCHTERM (RID_SVX_START + 1277) +#define RID_SVXSTR_SELECTEDPERSONA (RID_SVX_START + 1278) +#define RID_SVXSTR_SEARCHING (RID_SVX_START + 1279) +#define RID_SVXSTR_SEARCHERROR (RID_SVX_START + 1280) +#define RID_SVXSTR_NORESULTS (RID_SVX_START + 1281) +#define RID_SVXSTR_APPLYPERSONA (RID_SVX_START + 1282) + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 90ce9a3..31e37e1 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -25,6 +25,8 @@ #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include <vcl/graphicfilter.hxx> +#include <dialmgr.hxx> +#include "cuires.hrc" #include <com/sun/star/ucb/SimpleFileAccess.hpp> #include <com/sun/star/xml/sax/XParser.hpp> @@ -63,7 +65,7 @@ SelectPersonaDialog::SelectPersonaDialog( Window *pParent ) m_vSearchSuggestions[4]->SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) ); get( m_pEdit, "search_term" ); - m_pEdit->SetPlaceholderText( "Search term..." ); + m_pEdit->SetPlaceholderText( CUI_RES( RID_SVXSTR_SEARCHTERM ) ); get( m_pProgressLabel, "progress_label" ); @@ -170,7 +172,7 @@ IMPL_LINK( SelectPersonaDialog, SelectPersona, PushButton*, pButton ) // get the persona name from the setting variable to show in the progress. sal_Int32 nNameIndex = m_aSelectedPersona.indexOf( ';' ); OUString aName = m_aSelectedPersona.copy( 0, nNameIndex ); - OUString aProgress( "Selected Persona: " ); + OUString aProgress( CUI_RES( RID_SVXSTR_SELECTEDPERSONA ) ); aProgress += aName; SetProgress( aProgress ); } @@ -542,7 +544,7 @@ void SearchAndParseThread::execute() if( m_aURL.startsWith( "https://" ) ) { m_pPersonaDialog->ClearSearchResults(); - OUString sProgress( "Searching.. Please Wait.." ); + OUString sProgress( CUI_RES( RID_SVXSTR_SEARCHING ) ); m_pPersonaDialog->SetProgress( sProgress ); Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() ); Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(xContext); @@ -560,7 +562,7 @@ void SearchAndParseThread::execute() } catch (...) { - sProgress = "Something went wrong. Please try again."; + sProgress = CUI_RES( RID_SVXSTR_SEARCHERROR ); m_pPersonaDialog->SetProgress( sProgress ); return; } @@ -571,7 +573,7 @@ void SearchAndParseThread::execute() if( !pHandler->hasResults() ) { - sProgress = "No results found."; + sProgress = CUI_RES( RID_SVXSTR_NORESULTS ); m_pPersonaDialog->SetProgress( sProgress ); return; } @@ -611,7 +613,7 @@ void SearchAndParseThread::execute() else { - OUString sProgress( "Applying persona.." ); + OUString sProgress( CUI_RES( RID_SVXSTR_APPLYPERSONA ) ); m_pPersonaDialog->SetProgress( sProgress ); uno::Reference< ucb::XSimpleFileAccess3 > xFileAccess( ucb::SimpleFileAccess::create( comphelper::getProcessComponentContext() ), uno::UNO_QUERY ); @@ -660,7 +662,7 @@ void SearchAndParseThread::execute() } catch ( const uno::Exception & ) { - sProgress = "Something went wrong. Please try again."; + sProgress = CUI_RES( RID_SVXSTR_SEARCHERROR ); m_pPersonaDialog->SetProgress( sProgress ); return; } @@ -688,7 +690,7 @@ void SearchAndParseThread::getPreviewFile( const OUString& rURL, OUString *pPrev } catch (...) { - OUString sProgress = "Something went wrong. Please try again."; + OUString sProgress( CUI_RES( RID_SVXSTR_SEARCHERROR ) ); m_pPersonaDialog->SetProgress( sProgress ); return; } diff --git a/cui/source/options/personalization.src b/cui/source/options/personalization.src new file mode 100644 index 0000000..7cfe7c0 --- /dev/null +++ b/cui/source/options/personalization.src @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <cuires.hrc> + +String RID_SVXSTR_SEARCHTERM +{ + Text [ en-US ] = "Search term..."; +}; + +String RID_SVXSTR_SELECTEDPERSONA +{ + Text [ en-US ] = "Selected Persona: "; +}; + +String RID_SVXSTR_SEARCHING +{ + Text [ en-US ] = "Searching.. Please Wait.."; +}; + +String RID_SVXSTR_SEARCHERROR +{ + Text [ en-US ] = "Something went wrong. Please try again."; +}; + +String RID_SVXSTR_NORESULTS +{ + Text [ en-US ] = "No results found."; +}; + +String RID_SVXSTR_APPLYPERSONA +{ + Text [ en-US ] = "Applying persona.."; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 3fcd1064b31af66f5575a27e5ebbf7659d7675bd Author: Rachit Gupta <[email protected]> Date: Tue Aug 5 21:27:20 2014 +0530 Changed Select Persona Dialog. The result buttons are visible initially but are disabled. These get enabled when the results are available. A little code clean up. Change-Id: I6217d59220d871909bd001a6c7f3636b05cdf911 diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 2e53087..90ce9a3 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -74,31 +74,20 @@ SelectPersonaDialog::SelectPersonaDialog( Window *pParent ) m_pCancelButton->SetClickHdl( LINK( this, SelectPersonaDialog, ActionCancel ) ); get( m_vResultList[0], "result1" ); - m_vResultList[0]->SetClickHdl( LINK( this, SelectPersonaDialog, SelectPersona ) ); - get( m_vResultList[1], "result2" ); - m_vResultList[1]->SetClickHdl( LINK( this, SelectPersonaDialog, SelectPersona ) ); - get( m_vResultList[2], "result3" ); - m_vResultList[2]->SetClickHdl( LINK( this, SelectPersonaDialog, SelectPersona ) ); - get( m_vResultList[3], "result4" ); - m_vResultList[3]->SetClickHdl( LINK( this, SelectPersonaDialog, SelectPersona ) ); - get( m_vResultList[4], "result5" ); - m_vResultList[4]->SetClickHdl( LINK( this, SelectPersonaDialog, SelectPersona ) ); - get( m_vResultList[5], "result6" ); - m_vResultList[5]->SetClickHdl( LINK( this, SelectPersonaDialog, SelectPersona ) ); - get( m_vResultList[6], "result7" ); - m_vResultList[6]->SetClickHdl( LINK( this, SelectPersonaDialog, SelectPersona ) ); - get( m_vResultList[7], "result8" ); - m_vResultList[7]->SetClickHdl( LINK( this, SelectPersonaDialog, SelectPersona ) ); - get( m_vResultList[8], "result9" ); - m_vResultList[8]->SetClickHdl( LINK( this, SelectPersonaDialog, SelectPersona ) ); + + for (sal_Int32 nIndex = 0; nIndex < 9; ++nIndex) + { + m_vResultList[nIndex]->SetClickHdl( LINK( this, SelectPersonaDialog, SelectPersona ) ); + m_vResultList[nIndex]->Disable(); + } } OUString SelectPersonaDialog::GetSelectedPersona() const @@ -216,7 +205,7 @@ void SelectPersonaDialog::SetProgress( OUString& rProgress ) void SelectPersonaDialog::SetImages( Image aImage, sal_Int32 nIndex ) { - m_vResultList[nIndex]->Show(); + m_vResultList[nIndex]->Enable(); m_vResultList[nIndex]->SetModeImage( aImage ); } @@ -230,7 +219,10 @@ void SelectPersonaDialog::ClearSearchResults() m_vPersonaSettings.clear(); m_aSelectedPersona = ""; for( sal_Int32 nIndex = 0; nIndex < 9; nIndex++ ) - m_vResultList[nIndex]->Hide(); + { + m_vResultList[nIndex]->Disable(); + m_vResultList[nIndex]->SetModeImage(Image()); + } } SvxPersonalizationTabPage::SvxPersonalizationTabPage( Window *pParent, const SfxItemSet &rSet ) diff --git a/cui/uiconfig/ui/select_persona_dialog.ui b/cui/uiconfig/ui/select_persona_dialog.ui index 0d99bae..2826a19 100644 --- a/cui/uiconfig/ui/select_persona_dialog.ui +++ b/cui/uiconfig/ui/select_persona_dialog.ui @@ -262,6 +262,7 @@ <property name="column_homogeneous">True</property> <child> <object class="GtkButton" id="result1"> + <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="hexpand">True</property> @@ -276,6 +277,7 @@ </child> <child> <object class="GtkButton" id="result2"> + <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="hexpand">True</property> @@ -290,6 +292,7 @@ </child> <child> <object class="GtkButton" id="result3"> + <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="hexpand">True</property> @@ -304,6 +307,7 @@ </child> <child> <object class="GtkButton" id="result4"> + <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="hexpand">True</property> @@ -318,6 +322,7 @@ </child> <child> <object class="GtkButton" id="result5"> + <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="hexpand">True</property> @@ -332,6 +337,7 @@ </child> <child> <object class="GtkButton" id="result6"> + <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="hexpand">True</property> @@ -346,6 +352,7 @@ </child> <child> <object class="GtkButton" id="result7"> + <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="hexpand">True</property> @@ -360,6 +367,7 @@ </child> <child> <object class="GtkButton" id="result8"> + <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="hexpand">True</property> @@ -374,6 +382,7 @@ </child> <child> <object class="GtkButton" id="result9"> + <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="hexpand">True</property> commit 53162944da82a837bfe83b71b47b380280f779c6 Author: Rachit Gupta <[email protected]> Date: Tue Jul 29 19:39:57 2014 +0530 Added title to the Select Persona Dialog. Change-Id: Ia54e94c84e71fb794e7dec67f89306a5dd465f68 diff --git a/cui/uiconfig/ui/select_persona_dialog.ui b/cui/uiconfig/ui/select_persona_dialog.ui index 7497c5f..0d99bae 100644 --- a/cui/uiconfig/ui/select_persona_dialog.ui +++ b/cui/uiconfig/ui/select_persona_dialog.ui @@ -1,9 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.16.1 --> <interface> - <!-- interface-requires gtk+ 3.0 --> + <requires lib="gtk+" version="3.0"/> <object class="GtkDialog" id="SelectPersonaDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> + <property name="title" translatable="yes">Select Persona</property> <property name="type_hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> commit 01153faccf6d20b67f797581e60885165a83e2aa Author: Rachit Gupta <[email protected]> Date: Fri Jul 11 21:50:54 2014 +0530 Fixed crash when cancel is clicked without searching. Change-Id: I67ca901270874794ec55d5b7db2cd18e6d3a997d diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 58606a8..2e53087 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -159,7 +159,8 @@ IMPL_LINK( SelectPersonaDialog, ActionOK, PushButton*, /* pButton */ ) IMPL_LINK( SelectPersonaDialog, ActionCancel, PushButton*, /* pButton */ ) { - m_rSearchThread->StopExecution(); + if( m_rSearchThread.is() ) + m_rSearchThread->StopExecution(); EndDialog( RET_CANCEL ); return 0; commit e372d28cbd29cbcd1d36e397a681693272cf9407 Author: Rachit Gupta <[email protected]> Date: Thu Jul 10 23:23:12 2014 +0530 Fixed thread related issues. Added a data member m_bExecute which defaults to true but is set to false when StopExecution is called. During execution, the member's value is checked at various positions, if it is false, the execution is stopped by returning from the execute method. Following issues have been resolved: * Multiple searches can be performed. The previous search is halted. * Cancel button can be pressed in between any search or application of the persona. * A theme can be selected and applied by clicking on OK while the search is being done. Change-Id: Ic76c224ca0d317a6e1a44b3e8933a3ba50b371cb diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 0d47b7e..58606a8 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -112,7 +112,10 @@ OUString SelectPersonaDialog::GetSelectedPersona() const IMPL_LINK( SelectPersonaDialog, SearchPersonas, PushButton*, pButton ) { OUString searchTerm; - if( pButton == m_pSearchButton) + if( m_rSearchThread.is() ) + m_rSearchThread->StopExecution(); + + if( pButton == m_pSearchButton ) searchTerm = m_pEdit->GetText(); else { @@ -146,14 +149,17 @@ IMPL_LINK( SelectPersonaDialog, ActionOK, PushButton*, /* pButton */ ) } else + { + if( m_rSearchThread.is() ) + m_rSearchThread->StopExecution(); EndDialog( RET_OK ); + } return 0; } IMPL_LINK( SelectPersonaDialog, ActionCancel, PushButton*, /* pButton */ ) { - if( m_rSearchThread.is() ) - m_rSearchThread->terminate(); + m_rSearchThread->StopExecution(); EndDialog( RET_CANCEL ); return 0; @@ -161,6 +167,9 @@ IMPL_LINK( SelectPersonaDialog, ActionCancel, PushButton*, /* pButton */ ) IMPL_LINK( SelectPersonaDialog, SelectPersona, PushButton*, pButton ) { + if( m_rSearchThread.is() ) + m_rSearchThread->StopExecution(); + for( sal_Int32 index = 0; index < 9; index++ ) { if( pButton == m_vResultList[index] ) @@ -526,7 +535,8 @@ SearchAndParseThread::SearchAndParseThread( SelectPersonaDialog* pDialog, const OUString& rURL ) : Thread( "cuiPersonasSearchThread" ), m_pPersonaDialog( pDialog ), - m_aURL( rURL ) + m_aURL( rURL ), + m_bExecute( true ) { } @@ -587,6 +597,9 @@ void SearchAndParseThread::execute() aFilter.ImportGraphic( aGraphic, aURLObj ); Bitmap aBmp = aGraphic.GetBitmap(); + if( !m_bExecute ) + return; + // for VCL to be able to do visual changes in the thread SolarMutexGuard aGuard; m_pPersonaDialog->SetImages( Image( aBmp ), nIndex++ ); @@ -594,8 +607,10 @@ void SearchAndParseThread::execute() m_pPersonaDialog->AddPersonaSetting( aPersonaSetting ); } - SolarMutexGuard aGuard; + if( !m_bExecute ) + return; + SolarMutexGuard aGuard; sProgress = ""; m_pPersonaDialog->SetProgress( sProgress ); m_pPersonaDialog->setOptimalLayoutSize(); @@ -657,6 +672,9 @@ void SearchAndParseThread::execute() return; } + if( !m_bExecute ) + return; + SolarMutexGuard aGuard; aPersonaSetting = aHeaderFile + ";" + aFooterFile + ";" + aTextColor + ";" + aAccentColor; diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx index a3fc908..2ef49e9 100644 --- a/cui/source/options/personalization.hxx +++ b/cui/source/options/personalization.hxx @@ -116,6 +116,7 @@ private: SelectPersonaDialog *m_pPersonaDialog; OUString m_aURL; + bool m_bExecute; virtual ~SearchAndParseThread(); virtual void execute() SAL_OVERRIDE; @@ -125,6 +126,8 @@ public: SearchAndParseThread( SelectPersonaDialog* pDialog, const OUString& rURL ); + + void StopExecution() { m_bExecute = false; } }; #endif // INCLUDED_CUI_SOURCE_OPTIONS_PERSONALIZATION_HXX commit 95771f49f064ff7ff6daaee45d4716c930fd5cbb Author: Rachit Gupta <[email protected]> Date: Tue Jul 8 22:09:30 2014 +0530 The "Select personas installed via extensions" label is invisible by default. The label is not shown if there are no persona extensions installed. Change-Id: I758bb7ff7f22d56bfb7fe212908f9f5f1f3e7979 diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index b3775c8..0d47b7e 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -250,6 +250,8 @@ SvxPersonalizationTabPage::SvxPersonalizationTabPage( Window *pParent, const Sfx get( m_pExtensionPersonaPreview, "persona_preview" ); + get ( m_pExtensionLabel, "extensions_label" ); + LoadDefaultImages(); LoadExtensionThemes(); } @@ -371,6 +373,7 @@ void SvxPersonalizationTabPage::LoadExtensionThemes() return; m_pPersonaList->Show(); + m_pExtensionLabel->Show(); for( sal_Int32 nIndex = 0; nIndex < nLength; nIndex++ ) { diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx index cd2fc97..a3fc908 100644 --- a/cui/source/options/personalization.hxx +++ b/cui/source/options/personalization.hxx @@ -33,6 +33,7 @@ private: PushButton *m_pExtensionPersonaPreview; ///< Buttons to show the last 3 personas installed via extensions ListBox* m_pPersonaList; ///< The ListBox to show the list of installed personas OUString m_aPersonaSettings; ///< Header and footer images + color to be set in the settings. + FixedText *m_pExtensionLabel; ///< The "select persona installed via extensions" label std::vector<OUString> m_vDefaultPersonaSettings; std::vector<OUString> m_vExtensionPersonaSettings; diff --git a/cui/uiconfig/ui/personalization_tab.ui b/cui/uiconfig/ui/personalization_tab.ui index c76e00f..f288a90 100644 --- a/cui/uiconfig/ui/personalization_tab.ui +++ b/cui/uiconfig/ui/personalization_tab.ui @@ -151,8 +151,7 @@ </packing> </child> <child> - <object class="GtkLabel" id="label1"> - <property name="visible">True</property> + <object class="GtkLabel" id="extensions_label"> <property name="can_focus">False</property> <property name="xalign">0</property> <property name="label" translatable="yes">Or, select from the personas installed via extensions</property> commit d64f6d20872004da190c5ea351cd1ad255b18872 Author: Rachit Gupta <[email protected]> Date: Tue Jul 8 21:53:28 2014 +0530 Improved UI: Large buttons are not shown. * In the Personalization Tab Page, the button sizes are not affected by the presence of the preview buttons. THey remain their original size. * Added some padding and spacing to avoid cluttering of the widgets. Change-Id: Iea919b9fbfce4a7bfc82f73ccb49f94aa10ec804 diff --git a/cui/uiconfig/ui/personalization_tab.ui b/cui/uiconfig/ui/personalization_tab.ui index f19e1db..c76e00f 100644 --- a/cui/uiconfig/ui/personalization_tab.ui +++ b/cui/uiconfig/ui/personalization_tab.ui @@ -18,13 +18,14 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="top_padding">6</property> + <property name="bottom_padding">6</property> <property name="left_padding">12</property> + <property name="right_padding">6</property> <child> <object class="GtkVBox" id="vbox2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="spacing">2</property> - <property name="homogeneous">True</property> + <property name="spacing">12</property> <child> <object class="GtkRadioButton" id="no_persona"> <property name="label" translatable="yes">Plain look, do not use Themes</property> @@ -169,7 +170,6 @@ <property name="spacing">6</property> <child> <object class="GtkTreeView" id="installed_personas:border"> - <property name="visible">False</property> <property name="can_focus">True</property> <child internal-child="selection"> <object class="GtkTreeSelection" id="treeview-selection2"/> commit 674faa559a18e5a040b9ee608f16b0ed52c0716d Author: Rachit Gupta <[email protected]> Date: Wed Jul 2 14:01:59 2014 +0530 Added feature of clearing the registry in case something goes wrong. If the installed extension is removed, then the persona settings in the registry are cleared to avoid odd look in the UI. Change-Id: Iaa99f4c87ec6ce4a663e1a3cebb3f8ff45e02079 diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 730c80f..1ded485 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -2168,6 +2168,16 @@ static void setupPersonaHeaderFooter( WhichPersona eWhich, OUString& rHeaderFoot if ( rHeaderFooterBitmap.IsEmpty() ) rHeaderFooterBitmap = readBitmapEx( "$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" + aName ); } + + // Something went wrong. Probably, the images are missing. Clear the persona properties in the registry. + + if( rHeaderFooterBitmap.IsEmpty() ) + { + boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() ); + officecfg::Office::Common::Misc::Persona::set( "no", batch ); + officecfg::Office::Common::Misc::PersonaSettings::set( "", batch ); + batch->commit(); + } } const BitmapEx StyleSettings::GetPersonaHeader() const commit 9160e57847511d364ead4c088a50065b829ef5de Author: Rachit Gupta <[email protected]> Date: Wed Jul 2 10:11:04 2014 +0530 Minor fix: Own persona selected when user selects installed persona. Change-Id: I5ecd9e3b4a9b878cf5aeb2ccce2e51b45ce9a70a diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index d133673..b3775c8 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -441,6 +441,8 @@ IMPL_LINK( SvxPersonalizationTabPage, DefaultPersona, PushButton*, pButton ) IMPL_LINK( SvxPersonalizationTabPage, SelectInstalledPersona, ListBox*, ) { + m_pOwnPersona->Check(); + // Get the details of the selected theme. m_pExtensionPersonaPreview->Show(); sal_Int32 nSelectedPos = m_pPersonaList->GetSelectEntryPos(); commit e653a1fd2d46d07d48f99c8a604ec0b46d51bd5c Author: Rachit Gupta <[email protected]> Date: Tue Jul 1 18:27:42 2014 +0530 Changed Personas installed through extensions procedure. The UI now consists of a TreeView that lists all the personas that were installed through extensions. When the user selects any name from the list, the preview is shown in a button besides the list. If there are no extensions installed, the list stays hidden. Change-Id: I030d99549fd5b15d1104224116257ad62cdd1891 diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index f49ea12..d133673 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -21,6 +21,7 @@ #include <tools/urlobj.hxx> #include <vcl/edit.hxx> #include <vcl/msgbox.hxx> +#include <vcl/lstbox.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include <vcl/graphicfilter.hxx> @@ -244,17 +245,13 @@ SvxPersonalizationTabPage::SvxPersonalizationTabPage( Window *pParent, const Sfx get( m_vDefaultPersonaImages[2], "default3" ); m_vDefaultPersonaImages[2]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); - get( m_vExtensionPersonas[0], "extension1" ); - m_vExtensionPersonas[0]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, InstalledPersona ) ); + get( m_pPersonaList, "installed_personas" ); + m_pPersonaList->SetSelectHdl( LINK( this, SvxPersonalizationTabPage, SelectInstalledPersona ) ); - get( m_vExtensionPersonas[1], "extension2" ); - m_vExtensionPersonas[1]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, InstalledPersona ) ); - - get( m_vExtensionPersonas[2], "extension3" ); - m_vExtensionPersonas[2]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, InstalledPersona ) ); + get( m_pExtensionPersonaPreview, "persona_preview" ); LoadDefaultImages(); - LoadExtensionImages(); + LoadExtensionThemes(); } SvxPersonalizationTabPage::~SvxPersonalizationTabPage() @@ -363,37 +360,28 @@ void SvxPersonalizationTabPage::LoadDefaultImages() } } -void SvxPersonalizationTabPage::LoadExtensionImages() +void SvxPersonalizationTabPage::LoadExtensionThemes() { // See if any extensions are used to install personas. If yes, load them. - GraphicFilter aFilter; - Graphic aGraphic; - sal_Int32 nIndex = 0; css::uno::Sequence<OUString> installedPersonas( officecfg::Office::Common::Misc::PersonasList::get()->getElementNames() ); sal_Int32 nLength = installedPersonas.getLength(); - sal_Int32 nCount = 0; if( nLength == 0 ) return; - if( nLength > 3 ) - nIndex = nLength - 3; + m_pPersonaList->Show(); - for( ; nIndex < nLength; nIndex++ ) + for( sal_Int32 nIndex = 0; nIndex < nLength; nIndex++ ) { Reference< XPropertySet > xPropertySet( officecfg::Office::Common::Misc::PersonasList::get()->getByName( installedPersonas[nIndex] ), UNO_QUERY_THROW ); OUString aPersonaName, aPreviewFile, aHeaderFile, aFooterFile, aTextColor, aAccentColor, aPersonaSettings; - Any aValue = xPropertySet->getPropertyValue( "Preview" ); - aValue >>= aPreviewFile; - INetURLObject aURLObj( aPreviewFile ); - aFilter.ImportGraphic( aGraphic, aURLObj ); - Bitmap aBmp = aGraphic.GetBitmap(); - m_vExtensionPersonas[nCount]->Show(); - m_vExtensionPersonas[nCount++]->SetModeImage( Image( aBmp ) ); - - aValue = xPropertySet->getPropertyValue( "Name" ); + Any aValue = xPropertySet->getPropertyValue( "Name" ); aValue >>= aPersonaName; + m_pPersonaList->InsertEntry( aPersonaName ); + + aValue = xPropertySet->getPropertyValue( "Preview" ); + aValue >>= aPreviewFile; aValue = xPropertySet->getPropertyValue( "Header" ); aValue >>= aHeaderFile; @@ -407,7 +395,7 @@ void SvxPersonalizationTabPage::LoadExtensionImages() aValue = xPropertySet->getPropertyValue( "AccentColor" ); aValue >>= aAccentColor; - aPersonaSettings = aHeaderFile + ";" + aFooterFile + ";" + aTextColor + ";" + aAccentColor; + aPersonaSettings = aPreviewFile + ";" + aHeaderFile + ";" + aFooterFile + ";" + aTextColor + ";" + aAccentColor; rtl::Bootstrap::expandMacros( aPersonaSettings ); m_vExtensionPersonaSettings.push_back( aPersonaSettings ); } @@ -451,14 +439,23 @@ IMPL_LINK( SvxPersonalizationTabPage, DefaultPersona, PushButton*, pButton ) return 0; } -IMPL_LINK( SvxPersonalizationTabPage, InstalledPersona, PushButton*, pButton ) +IMPL_LINK( SvxPersonalizationTabPage, SelectInstalledPersona, ListBox*, ) { - m_pOwnPersona->Check(); - for( sal_Int32 nIndex = 0; nIndex < 3; nIndex++ ) - { - if( pButton == m_vExtensionPersonas[nIndex] ) - m_aPersonaSettings = m_vExtensionPersonaSettings[nIndex]; - } + // Get the details of the selected theme. + m_pExtensionPersonaPreview->Show(); + sal_Int32 nSelectedPos = m_pPersonaList->GetSelectEntryPos(); + OUString aSettings = m_vExtensionPersonaSettings[nSelectedPos]; + sal_Int32 nIndex = aSettings.indexOf( ';', 0 ); + OUString aPreviewFile = aSettings.copy( 0, nIndex ); + m_aPersonaSettings = aSettings.copy( nIndex + 1 ); + + // Show the preview file in the button. + GraphicFilter aFilter; + Graphic aGraphic; + INetURLObject aURLObj( aPreviewFile ); + aFilter.ImportGraphic( aGraphic, aURLObj ); + Bitmap aBmp = aGraphic.GetBitmap(); + m_pExtensionPersonaPreview->SetModeImage( Image( aBmp ) ); return 0; } diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx index 0d0cb3f..cd2fc97 100644 --- a/cui/source/options/personalization.hxx +++ b/cui/source/options/personalization.hxx @@ -25,13 +25,14 @@ class SvxPersonalizationTabPage : public SfxTabPage using SfxTabPage::DeactivatePage; private: - RadioButton *m_pNoPersona; ///< Just the default look, without any bitmap - RadioButton *m_pDefaultPersona; ///< Use the built-in bitmap - RadioButton *m_pOwnPersona; ///< Use the user-defined bitmap - PushButton *m_pSelectPersona; ///< Let the user select in the 'own' case - PushButton *m_vDefaultPersonaImages[3]; ///< Buttons to show the default persona images - PushButton *m_vExtensionPersonas[3]; ///< Buttons to show the last 3 personas installed via extensions - OUString m_aPersonaSettings; ///< Header and footer images + color to be set in the settings. + RadioButton *m_pNoPersona; ///< Just the default look, without any bitmap + RadioButton *m_pDefaultPersona; ///< Use the built-in bitmap + RadioButton *m_pOwnPersona; ///< Use the user-defined bitmap + PushButton *m_pSelectPersona; ///< Let the user select in the 'own' case + PushButton *m_vDefaultPersonaImages[3]; ///< Buttons to show the default persona images + PushButton *m_pExtensionPersonaPreview; ///< Buttons to show the last 3 personas installed via extensions + ListBox* m_pPersonaList; ///< The ListBox to show the list of installed personas + OUString m_aPersonaSettings; ///< Header and footer images + color to be set in the settings. std::vector<OUString> m_vDefaultPersonaSettings; std::vector<OUString> m_vExtensionPersonaSettings; @@ -52,7 +53,7 @@ public: void SetPersonaSettings( const OUString ); void LoadDefaultImages(); - void LoadExtensionImages(); + void LoadExtensionThemes(); private: /// Handle the Persona selection @@ -65,7 +66,7 @@ private: DECL_LINK( DefaultPersona, PushButton* ); /// Handle the Personas installed through extensions selection - DECL_LINK( InstalledPersona, PushButton* ); + DECL_LINK( SelectInstalledPersona, ListBox* ); }; /** Dialog that will allow the user to choose a Persona to use. diff --git a/cui/uiconfig/ui/personalization_tab.ui b/cui/uiconfig/ui/personalization_tab.ui index 2b53e02..f19e1db 100644 --- a/cui/uiconfig/ui/personalization_tab.ui +++ b/cui/uiconfig/ui/personalization_tab.ui @@ -168,26 +168,23 @@ <property name="can_focus">False</property> <property name="spacing">6</property> <child> - <object class="GtkButton" id="extension1"> + <object class="GtkTreeView" id="installed_personas:border"> + <property name="visible">False</property> <property name="can_focus">True</property> - <property name="receives_default">True</property> - <child> - <placeholder/> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="treeview-selection2"/> </child> </object> <packing> - <property name="expand">False</property> + <property name="expand">True</property> <property name="fill">True</property> <property name="position">0</property> </packing> </child> <child> - <object class="GtkButton" id="extension2"> + <object class="GtkButton" id="persona_preview"> <property name="can_focus">True</property> <property name="receives_default">True</property> - <child> - <placeholder/> - </child> </object> <packing> <property name="expand">False</property> @@ -195,20 +192,6 @@ <property name="position">1</property> </packing> </child> - <child> - <object class="GtkButton" id="extension3"> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> </object> <packing> <property name="expand">True</property> commit 5bed7be540e55149667fb5f4af826acdc1127efc Author: Rachit Gupta <[email protected]> Date: Tue Jul 1 15:30:44 2014 +0530 Moved the personas installed through extensions handling to 'own'. Change-Id: I12baaf22bfad73e228d3ed55dcf365f8eba9cf0a diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 6074eaf..f49ea12 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -245,15 +245,16 @@ SvxPersonalizationTabPage::SvxPersonalizationTabPage( Window *pParent, const Sfx m_vDefaultPersonaImages[2]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); get( m_vExtensionPersonas[0], "extension1" ); - m_vExtensionPersonas[0]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); + m_vExtensionPersonas[0]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, InstalledPersona ) ); get( m_vExtensionPersonas[1], "extension2" ); - m_vExtensionPersonas[1]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); + m_vExtensionPersonas[1]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, InstalledPersona ) ); get( m_vExtensionPersonas[2], "extension3" ); - m_vExtensionPersonas[2]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); + m_vExtensionPersonas[2]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, InstalledPersona ) ); LoadDefaultImages(); + LoadExtensionImages(); } SvxPersonalizationTabPage::~SvxPersonalizationTabPage() @@ -360,13 +361,18 @@ void SvxPersonalizationTabPage::LoadDefaultImages() m_vDefaultPersonaImages[nIndex]->Show(); m_vDefaultPersonaImages[nIndex++]->SetModeImage( Image( aBmp ) ); } +} +void SvxPersonalizationTabPage::LoadExtensionImages() +{ // See if any extensions are used to install personas. If yes, load them. + GraphicFilter aFilter; + Graphic aGraphic; + sal_Int32 nIndex = 0; css::uno::Sequence<OUString> installedPersonas( officecfg::Office::Common::Misc::PersonasList::get()->getElementNames() ); sal_Int32 nLength = installedPersonas.getLength(); sal_Int32 nCount = 0; - nIndex = 0; if( nLength == 0 ) return; @@ -442,6 +448,12 @@ IMPL_LINK( SvxPersonalizationTabPage, DefaultPersona, PushButton*, pButton ) m_aPersonaSettings = m_vDefaultPersonaSettings[nIndex]; } + return 0; +} + +IMPL_LINK( SvxPersonalizationTabPage, InstalledPersona, PushButton*, pButton ) +{ + m_pOwnPersona->Check(); for( sal_Int32 nIndex = 0; nIndex < 3; nIndex++ ) { if( pButton == m_vExtensionPersonas[nIndex] ) diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx index 98bff5d..0d0cb3f 100644 --- a/cui/source/options/personalization.hxx +++ b/cui/source/options/personalization.hxx @@ -52,6 +52,7 @@ public: void SetPersonaSettings( const OUString ); void LoadDefaultImages(); + void LoadExtensionImages(); private: /// Handle the Persona selection @@ -62,6 +63,9 @@ private: /// Handle the default Persona selection DECL_LINK( DefaultPersona, PushButton* ); + + /// Handle the Personas installed through extensions selection + DECL_LINK( InstalledPersona, PushButton* ); }; /** Dialog that will allow the user to choose a Persona to use. diff --git a/cui/uiconfig/ui/personalization_tab.ui b/cui/uiconfig/ui/personalization_tab.ui index e2f4332..2b53e02 100644 --- a/cui/uiconfig/ui/personalization_tab.ui +++ b/cui/uiconfig/ui/personalization_tab.ui @@ -58,11 +58,9 @@ </packing> </child> <child> - <object class="GtkGrid" id="grid1"> + <object class="GtkBox" id="box1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> <child> <object class="GtkButton" id="default1"> <property name="can_focus">True</property> @@ -71,10 +69,9 @@ <property name="vexpand">True</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> </packing> </child> <child> @@ -85,10 +82,9 @@ <property name="vexpand">True</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> </packing> </child> <child> @@ -99,55 +95,9 @@ <property name="vexpand">True</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkButton" id="extension1"> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkButton" id="extension2"> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkButton" id="extension3"> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="left_attach">2</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> </packing> </child> </object> @@ -199,6 +149,73 @@ <property name="position">3</property> </packing> </child> + <child> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Or, select from the personas installed via extensions</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkButton" id="extension1"> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="extension2"> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="extension3"> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">5</property> + </packing> + </child> </object> </child> </object> diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index ebaa4eb..730c80f 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -2152,13 +2152,13 @@ static void setupPersonaHeaderFooter( WhichPersona eWhich, OUString& rHeaderFoot { OUString gallery(""); // try the gallery first, then the program path: - if ( aPersona == "own") + if ( aPersona == "own" && !aPersonaSettings.startsWith( "vnd.sun.star.expand" ) ) { gallery = "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE( "bootstrap") "::UserInstallation}"; rtl::Bootstrap::expandMacros( gallery ); gallery += "/user/gallery/personas/"; } - else if ( aPersona == "default" && !aPersonaSettings.startsWith( "vnd.sun.star.expand" ) ) + else if ( aPersona == "default" ) { gallery = "$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER; gallery += "/gallery/personas/"; commit 7b57ab7a98912a86d6131a79c81a1a1d857ed1c1 Author: Rachit Gupta <[email protected]> Date: Tue Jul 1 13:34:39 2014 +0530 Fixed Bug: Persona info is deleted if No Persona is selected. If the user selects 'Plain look..' and clicks OK, the previous persona information is removed from the registry so that if the user selects either of the other option and clicks OK, the previous theme is not applied. Change-Id: I5f6a707e5f2724d2a3c39965d155cf47c898d392 diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 7e03250..6074eaf 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -285,6 +285,8 @@ bool SvxPersonalizationTabPage::FillItemSet( SfxItemSet * ) // write boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() ); + if( aPersona == "no" ) + m_aPersonaSettings = ""; officecfg::Office::Common::Misc::Persona::set( aPersona, batch ); officecfg::Office::Common::Misc::PersonaSettings::set( m_aPersonaSettings, batch ); batch->commit(); commit b1824cfd16dcc1f8fa5563b737d95fb4767a5640 Author: Rachit Gupta <[email protected]> Date: Mon Jun 30 18:46:47 2014 +0530 Dropped 'Persona' from the properties in PersonasEntry template. Change-Id: Ic662f59c084eacc7e99762c3e94fbcc191629557 diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index c2fe00c..7e03250 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -376,7 +376,7 @@ void SvxPersonalizationTabPage::LoadDefaultImages() { Reference< XPropertySet > xPropertySet( officecfg::Office::Common::Misc::PersonasList::get()->getByName( installedPersonas[nIndex] ), UNO_QUERY_THROW ); OUString aPersonaName, aPreviewFile, aHeaderFile, aFooterFile, aTextColor, aAccentColor, aPersonaSettings; - Any aValue = xPropertySet->getPropertyValue( "PersonaPreview" ); + Any aValue = xPropertySet->getPropertyValue( "Preview" ); aValue >>= aPreviewFile; INetURLObject aURLObj( aPreviewFile ); aFilter.ImportGraphic( aGraphic, aURLObj ); @@ -384,19 +384,19 @@ void SvxPersonalizationTabPage::LoadDefaultImages() m_vExtensionPersonas[nCount]->Show(); m_vExtensionPersonas[nCount++]->SetModeImage( Image( aBmp ) ); - aValue = xPropertySet->getPropertyValue( "PersonaName" ); + aValue = xPropertySet->getPropertyValue( "Name" ); aValue >>= aPersonaName; - aValue = xPropertySet->getPropertyValue( "PersonaHeader" ); + aValue = xPropertySet->getPropertyValue( "Header" ); aValue >>= aHeaderFile; - aValue = xPropertySet->getPropertyValue( "PersonaFooter" ); + aValue = xPropertySet->getPropertyValue( "Footer" ); aValue >>= aFooterFile; - aValue = xPropertySet->getPropertyValue( "PersonaTextColor" ); + aValue = xPropertySet->getPropertyValue( "TextColor" ); aValue >>= aTextColor; - aValue = xPropertySet->getPropertyValue( "PersonaAccentColor" ); + aValue = xPropertySet->getPropertyValue( "AccentColor" ); aValue >>= aAccentColor; aPersonaSettings = aHeaderFile + ";" + aFooterFile + ";" + aTextColor + ";" + aAccentColor; diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 6548445..408874f 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -810,35 +810,35 @@ <info> <desc>Stores the details of the installed personas.</desc> </info> - <prop oor:name="PersonaName" oor:type="xs:string" oor:nillable="false"> + <prop oor:name="Name" oor:type="xs:string" oor:nillable="false"> <info> <desc>The Persona's name</desc> </info> </prop> - <prop oor:name="PersonaPreview" oor:type="xs:string" oor:nillable="false"> + <prop oor:name="Preview" oor:type="xs:string" oor:nillable="false"> <info> <desc>Name of the preview file for the Persona to show in the UI</desc> </info> </prop> - <prop oor:name="PersonaHeader" oor:type="xs:string" oor:nillable="false"> + <prop oor:name="Header" oor:type="xs:string" oor:nillable="false"> <info> <desc>Name of the header file for the Persona</desc> </info> <value/> </prop> - <prop oor:name="PersonaFooter" oor:type="xs:string" oor:nillable="false"> + <prop oor:name="Footer" oor:type="xs:string" oor:nillable="false"> <info> <desc>Name of the footer file for the Persona</desc> </info> <value/> </prop> - <prop oor:name="PersonaTextColor" oor:type="xs:string" oor:nillable="false"> + <prop oor:name="TextColor" oor:type="xs:string" oor:nillable="false"> <info> <desc>Value of the text color for the Persona</desc> </info> <value/> </prop> - <prop oor:name="PersonaAccentColor" oor:type="xs:string" oor:nillable="false"> + <prop oor:name="AccentColor" oor:type="xs:string" oor:nillable="false"> <info> <desc>Value of the accent color for the Persona</desc> </info> commit 49b08326e3ac2a805373f255b3b0fd2c6fa165fa Author: Rachit Gupta <[email protected]> Date: Mon Jun 30 15:28:05 2014 +0530 Changed application of personas through extensions procedure. The PersonasEntry template in the registry now stores the setting as splitted values rather than ';' separated terms. The corresponding ';' separated setting is prepared and stored. Change-Id: I154d519c475a48763a75b5c35ad20f170c1d7996 diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 4c9781c..c2fe00c 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -375,8 +375,8 @@ void SvxPersonalizationTabPage::LoadDefaultImages() for( ; nIndex < nLength; nIndex++ ) { Reference< XPropertySet > xPropertySet( officecfg::Office::Common::Misc::PersonasList::get()->getByName( installedPersonas[nIndex] ), UNO_QUERY_THROW ); + OUString aPersonaName, aPreviewFile, aHeaderFile, aFooterFile, aTextColor, aAccentColor, aPersonaSettings; Any aValue = xPropertySet->getPropertyValue( "PersonaPreview" ); - OUString aPreviewFile; aValue >>= aPreviewFile; INetURLObject aURLObj( aPreviewFile ); aFilter.ImportGraphic( aGraphic, aURLObj ); @@ -384,11 +384,24 @@ void SvxPersonalizationTabPage::LoadDefaultImages() m_vExtensionPersonas[nCount]->Show(); m_vExtensionPersonas[nCount++]->SetModeImage( Image( aBmp ) ); - aValue = xPropertySet->getPropertyValue( "PersonaSettings" ); - OUString sPersonaSettings; - aValue >>= sPersonaSettings; - rtl::Bootstrap::expandMacros( sPersonaSettings ); - m_vExtensionPersonaSettings.push_back( sPersonaSettings ); + aValue = xPropertySet->getPropertyValue( "PersonaName" ); + aValue >>= aPersonaName; + + aValue = xPropertySet->getPropertyValue( "PersonaHeader" ); + aValue >>= aHeaderFile; + + aValue = xPropertySet->getPropertyValue( "PersonaFooter" ); + aValue >>= aFooterFile; + + aValue = xPropertySet->getPropertyValue( "PersonaTextColor" ); + aValue >>= aTextColor; + + aValue = xPropertySet->getPropertyValue( "PersonaAccentColor" ); + aValue >>= aAccentColor; + + aPersonaSettings = aHeaderFile + ";" + aFooterFile + ";" + aTextColor + ";" + aAccentColor; + rtl::Bootstrap::expandMacros( aPersonaSettings ); + m_vExtensionPersonaSettings.push_back( aPersonaSettings ); } } diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index d5e926b..6548445 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -810,16 +810,37 @@ <info> <desc>Stores the details of the installed personas.</desc> </info> + <prop oor:name="PersonaName" oor:type="xs:string" oor:nillable="false"> + <info> + <desc>The Persona's name</desc> + </info> + </prop> <prop oor:name="PersonaPreview" oor:type="xs:string" oor:nillable="false"> <info> <desc>Name of the preview file for the Persona to show in the UI</desc> </info> </prop> - <prop oor:name="PersonaSettings" oor:type="xs:string" oor:nillable="false"> + <prop oor:name="PersonaHeader" oor:type="xs:string" oor:nillable="false"> <info> - <desc>Names of the header and footer images, and colors for text and - accent. When set, the value has form - "header.jpg;footer.jpg;#RGBTXT;#RGBACC".</desc> + <desc>Name of the header file for the Persona</desc> + </info> + <value/> + </prop> + <prop oor:name="PersonaFooter" oor:type="xs:string" oor:nillable="false"> + <info> + <desc>Name of the footer file for the Persona</desc> + </info> + <value/> + </prop> + <prop oor:name="PersonaTextColor" oor:type="xs:string" oor:nillable="false"> + <info> + <desc>Value of the text color for the Persona</desc> + </info> + <value/> + </prop> + <prop oor:name="PersonaAccentColor" oor:type="xs:string" oor:nillable="false"> + <info> + <desc>Value of the accent color for the Persona</desc> </info> <value/> </prop> commit 4017908018a0ccc771247f09c47798dd20644db3 Author: Rachit Gupta <[email protected]> Date: Fri Jun 27 23:52:42 2014 +0530 The Personas can be install through oxt extensions. The user can install an oxt extension and choose his/her theme from the Personalization page. * Created a template in Common.xcs registry to hold the values for the PersonasList set. * Added 3 buttons to personalization_tab.ui to incorporate the latest 3 personas installed through extensions. * Currently, only 3 installed personas are shown alongwith the default available personas. Change-Id: I30a40ae48d17f4ed8caef33854ef88afcbec5a54 diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 022472e..4c9781c 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -14,6 +14,8 @@ #include <comphelper/processfactory.hxx> #include <officecfg/Office/Common.hxx> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> #include <osl/file.hxx> #include <rtl/bootstrap.hxx> #include <tools/urlobj.hxx> @@ -31,6 +33,7 @@ using namespace com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::ucb; +using namespace ::com::sun::star::beans; SelectPersonaDialog::SelectPersonaDialog( Window *pParent ) : ModalDialog( pParent, "SelectPersonaDialog", "cui/ui/select_persona_dialog.ui" ) @@ -241,6 +244,15 @@ SvxPersonalizationTabPage::SvxPersonalizationTabPage( Window *pParent, const Sfx get( m_vDefaultPersonaImages[2], "default3" ); m_vDefaultPersonaImages[2]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); + get( m_vExtensionPersonas[0], "extension1" ); + m_vExtensionPersonas[0]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); + + get( m_vExtensionPersonas[1], "extension2" ); + m_vExtensionPersonas[1]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); + + get( m_vExtensionPersonas[2], "extension3" ); + m_vExtensionPersonas[2]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); + LoadDefaultImages(); } @@ -273,7 +285,6 @@ bool SvxPersonalizationTabPage::FillItemSet( SfxItemSet * ) // write boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() ); - officecfg::Office::Common::Misc::Persona::set( aPersona, batch ); officecfg::Office::Common::Misc::PersonaSettings::set( m_aPersonaSettings, batch ); batch->commit(); @@ -316,6 +327,8 @@ void SvxPersonalizationTabPage::SetPersonaSettings( const OUString aPersonaSetti void SvxPersonalizationTabPage::LoadDefaultImages() { + // Load the pre saved personas + OUString gallery( "" ); gallery = "$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER; gallery += "/gallery/personas/"; @@ -345,6 +358,38 @@ void SvxPersonalizationTabPage::LoadDefaultImages() m_vDefaultPersonaImages[nIndex]->Show(); m_vDefaultPersonaImages[nIndex++]->SetModeImage( Image( aBmp ) ); } + + // See if any extensions are used to install personas. If yes, load them. + + css::uno::Sequence<OUString> installedPersonas( officecfg::Office::Common::Misc::PersonasList::get()->getElementNames() ); + sal_Int32 nLength = installedPersonas.getLength(); + sal_Int32 nCount = 0; + nIndex = 0; + + if( nLength == 0 ) + return; + + if( nLength > 3 ) + nIndex = nLength - 3; + + for( ; nIndex < nLength; nIndex++ ) + { + Reference< XPropertySet > xPropertySet( officecfg::Office::Common::Misc::PersonasList::get()->getByName( installedPersonas[nIndex] ), UNO_QUERY_THROW ); + Any aValue = xPropertySet->getPropertyValue( "PersonaPreview" ); + OUString aPreviewFile; + aValue >>= aPreviewFile; + INetURLObject aURLObj( aPreviewFile ); + aFilter.ImportGraphic( aGraphic, aURLObj ); + Bitmap aBmp = aGraphic.GetBitmap(); + m_vExtensionPersonas[nCount]->Show(); + m_vExtensionPersonas[nCount++]->SetModeImage( Image( aBmp ) ); + + aValue = xPropertySet->getPropertyValue( "PersonaSettings" ); + OUString sPersonaSettings; + aValue >>= sPersonaSettings; + rtl::Bootstrap::expandMacros( sPersonaSettings ); + m_vExtensionPersonaSettings.push_back( sPersonaSettings ); + } } IMPL_LINK( SvxPersonalizationTabPage, SelectPersona, PushButton*, /*pButton*/ ) @@ -381,6 +426,13 @@ IMPL_LINK( SvxPersonalizationTabPage, DefaultPersona, PushButton*, pButton ) if( pButton == m_vDefaultPersonaImages[nIndex] ) m_aPersonaSettings = m_vDefaultPersonaSettings[nIndex]; } + + for( sal_Int32 nIndex = 0; nIndex < 3; nIndex++ ) + { + if( pButton == m_vExtensionPersonas[nIndex] ) + m_aPersonaSettings = m_vExtensionPersonaSettings[nIndex]; + } + return 0; } diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx index 5e2308c..98bff5d 100644 --- a/cui/source/options/personalization.hxx +++ b/cui/source/options/personalization.hxx @@ -30,9 +30,11 @@ private: RadioButton *m_pOwnPersona; ///< Use the user-defined bitmap PushButton *m_pSelectPersona; ///< Let the user select in the 'own' case PushButton *m_vDefaultPersonaImages[3]; ///< Buttons to show the default persona images + PushButton *m_vExtensionPersonas[3]; ///< Buttons to show the last 3 personas installed via extensions OUString m_aPersonaSettings; ///< Header and footer images + color to be set in the settings. std::vector<OUString> m_vDefaultPersonaSettings; + std::vector<OUString> m_vExtensionPersonaSettings; public: ::rtl::Reference< SearchAndParseThread > m_rApplyThread; diff --git a/cui/uiconfig/ui/personalization_tab.ui b/cui/uiconfig/ui/personalization_tab.ui index 677d5fc..e2f4332 100644 --- a/cui/uiconfig/ui/personalization_tab.ui +++ b/cui/uiconfig/ui/personalization_tab.ui @@ -58,24 +58,23 @@ </packing> </child> <child> - <object class="GtkBox" id="box1"> + <object class="GtkGrid" id="grid1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="spacing">6</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> <child> <object class="GtkButton" id="default1"> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <child> - <placeholder/> - </child> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> </packing> </child> <child> @@ -84,14 +83,12 @@ <property name="receives_default">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <child> - <placeholder/> - </child> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> </packing> </child> <child> @@ -100,19 +97,62 @@ <property name="receives_default">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="extension1"> + <property name="can_focus">True</property> + <property name="receives_default">True</property> <child> <placeholder/> </child> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="extension2"> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="extension3"> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> </packing> </child> </object> <packing> - <property name="expand">False</property> + <property name="expand">True</property> <property name="fill">True</property> <property name="position">2</property> </packing> diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 866ad15..d5e926b 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -806,6 +806,24 @@ <value/> </prop> </group> + <group oor:name="PersonasEntry"> + <info> + <desc>Stores the details of the installed personas.</desc> + </info> + <prop oor:name="PersonaPreview" oor:type="xs:string" oor:nillable="false"> + <info> + <desc>Name of the preview file for the Persona to show in the UI</desc> + </info> + </prop> + <prop oor:name="PersonaSettings" oor:type="xs:string" oor:nillable="false"> + <info> + <desc>Names of the header and footer images, and colors for text and + accent. When set, the value has form + "header.jpg;footer.jpg;#RGBTXT;#RGBACC".</desc> + </info> + <value/> + </prop> + </group> </templates> <component> <group oor:name="InternalMSExport"> @@ -5738,6 +5756,11 @@ <desc>List of names of the CMIS servers in the place edition dialog.</desc> </info> </prop> + <set oor:name="PersonasList" oor:node-type="PersonasEntry"> + <info> + <desc>Contains the Personas installed through extensions</desc> + </info> + </set> </group> <group oor:name="Forms"> <info> diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 4278720..ebaa4eb 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -2158,7 +2158,7 @@ static void setupPersonaHeaderFooter( WhichPersona eWhich, OUString& rHeaderFoot rtl::Bootstrap::expandMacros( gallery ); gallery += "/user/gallery/personas/"; } - else if (aPersona == "default") + else if ( aPersona == "default" && !aPersonaSettings.startsWith( "vnd.sun.star.expand" ) ) { gallery = "$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER; gallery += "/gallery/personas/"; commit e7e5ab1683a86de587f2c8b5511d13c334548903 Author: Rachit Gupta <[email protected]> Date: Sat Jun 21 09:16:16 2014 +0530 Fixed Typo. Change-Id: I8d0b34e0c34c349baaa7c9a56fd1e6cfe3ad6934 diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx index 2de2048..5e2308c 100644 --- a/cui/source/options/personalization.hxx +++ b/cui/source/options/personalization.hxx @@ -74,7 +74,7 @@ private: PushButton *m_pSearchButton; ///< The search button FixedText *m_pProgressLabel; ///< The label for showing progress of search PushButton *m_vResultList[9]; ///< List of buttons to show search results - PushButton *m_vSearchSuggestions[9]; ///< List of buttons for the search suggestions + PushButton *m_vSearchSuggestions[5]; ///< List of buttons for the search suggestions PushButton *m_pOkButton; ///< The OK button PushButton *m_pCancelButton; ///< The Cancel button commit 67a6a411e52edc6d839896d02123d92aba3e4b7d Author: Rachit Gupta <[email protected]> Date: Fri Jun 20 21:20:37 2014 +0530 Added some pre-defined search terms. The user can now enter his/her own search term or can use the commonly used search terms to browse for themes. Change-Id: Ife4ad6b820784a6321f5b916a0069a915c114c7e diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index bf04822..022472e 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -38,6 +38,26 @@ SelectPersonaDialog::SelectPersonaDialog( Window *pParent ) get( m_pSearchButton, "search_personas" ); m_pSearchButton->SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) ); + get( m_vSearchSuggestions[0], "suggestion1" ); + m_vSearchSuggestions[0]->SetText( "libreoffice" ); + m_vSearchSuggestions[0]->SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) ); + + get( m_vSearchSuggestions[1], "suggestion2" ); + m_vSearchSuggestions[1]->SetText( "science" ); + m_vSearchSuggestions[1]->SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) ); + + get( m_vSearchSuggestions[2], "suggestion3" ); + m_vSearchSuggestions[2]->SetText( "firefox" ); + m_vSearchSuggestions[2]->SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) ); + + get( m_vSearchSuggestions[3], "suggestion4" ); + m_vSearchSuggestions[3]->SetText( "nasa" ); + m_vSearchSuggestions[3]->SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) ); + + get( m_vSearchSuggestions[4], "suggestion5" ); + m_vSearchSuggestions[4]->SetText( "harry potter" ); + m_vSearchSuggestions[4]->SetClickHdl( LINK( this, SelectPersonaDialog, SearchPersonas ) ); + get( m_pEdit, "search_term" ); m_pEdit->SetPlaceholderText( "Search term..." ); @@ -85,9 +105,23 @@ OUString SelectPersonaDialog::GetSelectedPersona() const return OUString(); } -IMPL_LINK( SelectPersonaDialog, SearchPersonas, PushButton*, /*pButton*/ ) +IMPL_LINK( SelectPersonaDialog, SearchPersonas, PushButton*, pButton ) { - OUString searchTerm = m_pEdit->GetText(); + OUString searchTerm; + if( pButton == m_pSearchButton) + searchTerm = m_pEdit->GetText(); + else + { + for( sal_Int32 nIndex = 0; nIndex < 5; nIndex++ ) + { + if( pButton == m_vSearchSuggestions[nIndex] ) + { + searchTerm = m_vSearchSuggestions[nIndex]->GetDisplayText(); + break; + } + } + } + if( searchTerm.isEmpty( ) ) return 0; diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx index 3fcabf2..2de2048 100644 --- a/cui/source/options/personalization.hxx +++ b/cui/source/options/personalization.hxx @@ -74,6 +74,7 @@ private: PushButton *m_pSearchButton; ///< The search button FixedText *m_pProgressLabel; ///< The label for showing progress of search PushButton *m_vResultList[9]; ///< List of buttons to show search results + PushButton *m_vSearchSuggestions[9]; ///< List of buttons for the search suggestions PushButton *m_pOkButton; ///< The OK button PushButton *m_pCancelButton; ///< The Cancel button diff --git a/cui/uiconfig/ui/select_persona_dialog.ui b/cui/uiconfig/ui/select_persona_dialog.ui index 51d8bcb..7497c5f 100644 --- a/cui/uiconfig/ui/select_persona_dialog.ui +++ b/cui/uiconfig/ui/select_persona_dialog.ui @@ -104,7 +104,6 @@ <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="invisible_char">â</property> - <property name="invisible_char_set">True</property> <property name="primary_icon_activatable">False</property> <property name="secondary_icon_activatable">False</property> </object> @@ -136,9 +135,12 @@ </packing> </child> <child> - <object class="GtkLabel" id="progress_label"> + <object class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Or, use these commonly used terms to _browse themes:</property> + <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> @@ -147,15 +149,113 @@ </packing> </child> <child> + <object class="GtkBox" id="box3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkButton" id="suggestion1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="suggestion2"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="suggestion3"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkButton" id="suggestion4"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkButton" id="suggestion5"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="progress_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + <child> <object class="GtkGrid" id="grid1"> + <property name="width_request">624</property> + <property name="height_request">219</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="row_spacing">6</property> <property name="column_spacing">6</property> - <property name="width_request">624</property> - <property name="height_request">219</property> <property name="row_homogeneous">True</property> <property name="column_homogeneous">True</property> <child> @@ -288,7 +388,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">3</property> + <property name="position">5</property> </packing> </child> </object> commit 8181a7b6089d1b04ef4ee21745b02659917e9f24 Author: Rachit Gupta <[email protected]> Date: Fri Jun 20 15:38:26 2014 +0530 Improved search: the images are displayed as they are downloaded. Previously, all the search result images were displayed in one go, but now the images are shown as they are downloaded. Change-Id: I95990f36c242a0c90bd2b2fd65fd76953f46bcc2 diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 65a312a..bf04822 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -166,15 +166,10 @@ void SelectPersonaDialog::SetProgress( OUString& rProgress ) } } -void SelectPersonaDialog::SetImages( std::vector<Image> &rImageList ) +void SelectPersonaDialog::SetImages( Image aImage, sal_Int32 nIndex ) { - sal_Int32 nCount = 0; - for( std::vector<Image>::iterator it=rImageList.begin(); it!=rImageList.end(); ++it ) - { - m_vResultList[nCount]->Show(); - m_vResultList[nCount]->SetModeImage( *it ); - nCount++; - } + m_vResultList[nIndex]->Show(); + m_vResultList[nIndex]->SetModeImage( aImage ); } void SelectPersonaDialog::AddPersonaSetting( OUString& rPersonaSetting ) @@ -465,7 +460,7 @@ void SearchAndParseThread::execute() std::vector<OUString> vLearnmoreURLs = pHandler->getLearnmoreURLs(); std::vector<OUString>::iterator it; - std::vector<Image> vResultList; + sal_Int32 nIndex = 0; GraphicFilter aFilter; Graphic aGraphic; @@ -476,14 +471,16 @@ void SearchAndParseThread::execute() INetURLObject aURLObj( sPreviewFile ); aFilter.ImportGraphic( aGraphic, aURLObj ); Bitmap aBmp = aGraphic.GetBitmap(); - vResultList.push_back( Image( aBmp ) ); + + // for VCL to be able to do visual changes in the thread + SolarMutexGuard aGuard; + m_pPersonaDialog->SetImages( Image( aBmp ), nIndex++ ); + m_pPersonaDialog->setOptimalLayoutSize(); m_pPersonaDialog->AddPersonaSetting( aPersonaSetting ); } - // for VCL to be able to do visual changes in the thread SolarMutexGuard aGuard; - m_pPersonaDialog->SetImages( vResultList ); sProgress = ""; m_pPersonaDialog->SetProgress( sProgress ); m_pPersonaDialog->setOptimalLayoutSize(); diff --git a/cui/source/options/personalization.hxx b/cui/source/options/personalization.hxx index 0d211ed..3fcabf2 100644 --- a/cui/source/options/personalization.hxx +++ b/cui/source/options/personalization.hxx @@ -87,7 +87,7 @@ public: OUString GetSelectedPersona() const; void SetProgress( OUString& ); - void SetImages( std::vector<Image>&); + void SetImages( Image, sal_Int32 ); void AddPersonaSetting( OUString& ); void ClearSearchResults(); void SetAppliedPersonaSetting( OUString& ); diff --git a/cui/uiconfig/ui/select_persona_dialog.ui b/cui/uiconfig/ui/select_persona_dialog.ui index cf551dc..51d8bcb 100644 --- a/cui/uiconfig/ui/select_persona_dialog.ui +++ b/cui/uiconfig/ui/select_persona_dialog.ui @@ -154,6 +154,10 @@ <property name="vexpand">True</property> <property name="row_spacing">6</property> <property name="column_spacing">6</property> + <property name="width_request">624</property> + <property name="height_request">219</property> + <property name="row_homogeneous">True</property> + <property name="column_homogeneous">True</property> <child> <object class="GtkButton" id="result1"> <property name="can_focus">True</property> commit 27f4c752d062df6c3f9c33c62e5de7c541aeca34 Author: Rachit Gupta <[email protected]> Date: Thu Jun 19 18:49:36 2014 +0530 Added functionality to apply default themes. * The themes are stored in the share folder under the personas directory in the gallery. The information is stored in a personas_list.txt which contains the info in the form headerFile;footerFile;textColor;AccentColor for the default themes. * Changed the personalization_tab.ui to include _three_ buttons to show the default images. * Changed the vcl/source/app/settings.cxx to read the persona information properly in the case of default personas. * Some variable name changes. Change-Id: Ib5f2167729a5fb7eb8061925679560accb934a44 diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 928e32c..65a312a 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -202,6 +202,17 @@ SvxPersonalizationTabPage::SvxPersonalizationTabPage( Window *pParent, const Sfx get( m_pSelectPersona, "select_persona" ); m_pSelectPersona->SetClickHdl( LINK( this, SvxPersonalizationTabPage, SelectPersona ) ); + + get( m_vDefaultPersonaImages[0], "default1" ); + m_vDefaultPersonaImages[0]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); + + get( m_vDefaultPersonaImages[1], "default2" ); + m_vDefaultPersonaImages[1]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); + + get( m_vDefaultPersonaImages[2], "default3" ); + m_vDefaultPersonaImages[2]->SetClickHdl( LINK( this, SvxPersonalizationTabPage, DefaultPersona ) ); + + LoadDefaultImages(); } SvxPersonalizationTabPage::~SvxPersonalizationTabPage() @@ -268,6 +279,45 @@ void SvxPersonalizationTabPage::Reset( const SfxItemSet * ) m_pDefaultPersona->Check(); } +void SvxPersonalizationTabPage::SetPersonaSettings( const OUString aPersonaSettings ) +{ + m_aPersonaSettings = aPersonaSettings; + m_pOwnPersona->Check(); +} + +void SvxPersonalizationTabPage::LoadDefaultImages() +{ + OUString gallery( "" ); + gallery = "$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER; + gallery += "/gallery/personas/"; + rtl::Bootstrap::expandMacros( gallery ); + OUString aPersonasList = gallery + "personas_list.txt"; ... etc. - the rest is truncated
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
