[Libreoffice-commits] core.git: 3 commits - include/sfx2 sfx2/source

Zolnai Tamás tamas.zolnai at collabora.com
Fri Mar 7 01:27:39 PST 2014


 include/sfx2/recentdocsview.hxx        |    2 ++
 sfx2/source/control/recentdocsview.cxx |    7 +++++++
 sfx2/source/control/thumbnailview.cxx  |    2 --
 sfx2/source/doc/templatedlg.cxx        |   29 ++++++++---------------------
 4 files changed, 17 insertions(+), 23 deletions(-)

New commits:
commit 3952988da628d87e884168d23a352e4b151bf5ea
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri Mar 7 10:24:10 2014 +0100

    Fix deselection problems of template view
    
    deselectItems() were added to make recent docs
    view work, but it is unneccessary to
    affect template view too.
    
    Change-Id: I0c805774321939991e308e9c8c669604e81dbad5

diff --git a/include/sfx2/recentdocsview.hxx b/include/sfx2/recentdocsview.hxx
index 20f04c3..9d0335d 100644
--- a/include/sfx2/recentdocsview.hxx
+++ b/include/sfx2/recentdocsview.hxx
@@ -65,6 +65,8 @@ protected:
     void OpenItem( const ThumbnailViewItem *pItem );
     virtual void Paint( const Rectangle& rRect );
 
+    virtual void LoseFocus();
+
     bool isAcceptedFile(const OUString &rURL) const;
 
     long    mnItemMaxSize;
diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx
index a97c7e7..e683323 100644
--- a/sfx2/source/control/recentdocsview.cxx
+++ b/sfx2/source/control/recentdocsview.cxx
@@ -321,6 +321,13 @@ void RecentDocsView::Paint( const Rectangle &aRect )
         ThumbnailView::Paint(aRect);
 }
 
+void RecentDocsView::LoseFocus()
+{
+    deselectItems();
+
+    ThumbnailView::LoseFocus();
+}
+
 long RecentDocsView::GetThumbnailSize() const
 {
     return mnItemMaxSize;
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index af0b0ee..b3e59e4 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -910,8 +910,6 @@ void ThumbnailView::GetFocus()
 
 void ThumbnailView::LoseFocus()
 {
-    deselectItems();
-
     Control::LoseFocus();
 
     // Tell the accessible object that we lost the focus.
commit 6235a7261b7a763cbce4e3b2ffd93921008acb02
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri Mar 7 10:17:54 2014 +0100

    Revert "fdo#74787, rhbz#1072553: fix Template Mananger import crash"
    
    This reverts commit 6b6ec280f3d7f35fb9c8c8ba92a31d51ab4dca16.

diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index fc198b0..7551c95 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -901,9 +901,6 @@ void SfxTemplateManagerDlg::OnTemplateImport ()
     aFileDlg.AddFilter( sFilterName, sFilterExt );
     aFileDlg.SetCurrentFilter( sFilterName );
 
-    // fdo#74787 file dialog causes ThumbnailView::LoseFocus() - save selection
-    std::set<const ThumbnailViewItem*,selection_cmp_fn> selFolders(maSelFolders);
-
     ErrCode nCode = aFileDlg.Execute();
 
     if ( nCode == ERRCODE_NONE )
@@ -912,11 +909,11 @@ void SfxTemplateManagerDlg::OnTemplateImport ()
 
         if (aFiles.hasElements())
         {
-            if (!selFolders.empty())
+            if (!maSelFolders.empty())
             {
                 //Import to the selected regions
                 std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter;
-                for (pIter = selFolders.begin(); pIter != selFolders.end(); ++pIter)
+                for (pIter = maSelFolders.begin(); pIter != maSelFolders.end(); ++pIter)
                 {
                     OUString aTemplateList;
                     TemplateContainerItem *pFolder = (TemplateContainerItem*)(*pIter);
commit fa173ce679235e3a8378ccffcff5d767f97375b2
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri Mar 7 10:17:26 2014 +0100

    Revert "fdo#74506 fdo#74291 -Template manager-store selection before calling dialog"
    
    This reverts commit a411bf38da3668094698c06c8424aa9d68c85702.

diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 2741d71..fc198b0 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -987,7 +987,7 @@ void SfxTemplateManagerDlg::OnTemplateExport()
         {
             sal_uInt16 i = 1;
 
-            std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter;
+            std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter = maSelTemplates.begin();
             for (pIter = maSelTemplates.begin(); pIter != maSelTemplates.end(); ++pIter, ++i)
             {
                 const TemplateSearchViewItem *pItem = static_cast<const TemplateSearchViewItem*>(*pIter);
@@ -1161,11 +1161,6 @@ void SfxTemplateManagerDlg::OnTemplateProperties ()
 
 void SfxTemplateManagerDlg::OnTemplateDelete ()
 {
-    // Store selected templates before calling a dialog/QueryBox
-    // which will result in a deselection of all ThumbnailViewItem.
-    // Also avoid invalid iterators
-    std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelTemplates = maSelTemplates;
-
     QueryBox aQueryDlg(this, WB_YES_NO | WB_DEF_YES, SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE).toString());
 
     if ( aQueryDlg.Execute() == RET_NO )
@@ -1175,6 +1170,8 @@ void SfxTemplateManagerDlg::OnTemplateDelete ()
 
     if (mpSearchView->IsVisible())
     {
+        std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelTemplates = maSelTemplates; //Avoids invalid iterators
+
         std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter;
         for (pIter = aSelTemplates.begin(); pIter != aSelTemplates.end(); ++pIter)
         {
@@ -1195,6 +1192,7 @@ void SfxTemplateManagerDlg::OnTemplateDelete ()
     else
     {
         sal_uInt16 nRegionItemId = mpLocalView->getCurRegionItemId();
+        std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelTemplates = maSelTemplates;  //Avoid invalid iterators
 
         std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter;
         for (pIter = aSelTemplates.begin(); pIter != aSelTemplates.end(); ++pIter)
@@ -1248,11 +1246,6 @@ void SfxTemplateManagerDlg::OnFolderNew()
 
 void SfxTemplateManagerDlg::OnFolderDelete()
 {
-    // Store selected folders before calling a dialog/QueryBox
-    // which will result in a deselection of all ThumbnailViewItem.
-    // Also copy to avoid invalidating an iterator
-    std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelFolders = maSelFolders;
-
     QueryBox aQueryDlg(this, WB_YES_NO | WB_DEF_YES, SfxResId(STR_QMSG_SEL_FOLDER_DELETE).toString());
 
     if ( aQueryDlg.Execute() == RET_NO )
@@ -1261,6 +1254,7 @@ void SfxTemplateManagerDlg::OnFolderDelete()
     OUString aFolderList;
 
     std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter;
+    std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelFolders = maSelFolders; //Copy to avoid invalidating an iterator
 
     for (pIter = aSelFolders.begin(); pIter != aSelFolders.end(); ++pIter)
     {
@@ -1295,10 +1289,6 @@ void SfxTemplateManagerDlg::OnRepositoryDelete()
 
 void SfxTemplateManagerDlg::OnTemplateSaveAs()
 {
-    // Store selected folders before calling a dialog/QueryBox
-    // which will result in a deselection of all ThumbnailViewItem
-    std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelFolders = maSelFolders;
-
     assert(m_xModel.is());
 
     if (!mpLocalView->isNonRootRegionVisible() && maSelFolders.empty())
@@ -1338,7 +1328,7 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs()
             else
             {
                 std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter;
-                for (pIter = aSelFolders.begin(); pIter != aSelFolders.end(); ++pIter)
+                for (pIter = maSelFolders.begin(); pIter != maSelFolders.end(); ++pIter)
                 {
                     TemplateContainerItem *pItem = (TemplateContainerItem*)(*pIter);
 


More information about the Libreoffice-commits mailing list