summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authoroguzbalkaya <oguz.balkaya@gmail.com>2022-08-30 23:29:53 +0200
committerHossein <hossein@libreoffice.org>2022-08-31 13:23:53 +0200
commit2839b604af94dbd1ee59dc6d47dc2f4c6ebd8dc6 (patch)
tree84dd01a2ac0a24f8046c01439287333d7bd6ba2b /sfx2/source
parent575081690b894322c771c0a7e3a7beb89eb1aa0b (diff)
tdf#101302: Add option to clear unavailable files in menu/start center
This patch adresses tdf#101302. It essentially adds a menu item to clear unavailable files from the menu and start center. Previously, they were visible as recent documents in the menu and start center, and caused error when selected. Change-Id: I55ee9f663b24c343a90817c438aff11d9230061c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120480 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/control/recentdocsview.cxx13
-rw-r--r--sfx2/source/dialog/backingwindow.cxx3
2 files changed, 16 insertions, 0 deletions
diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx
index 9eea0e1c2488..61b9b55a64a6 100644
--- a/sfx2/source/control/recentdocsview.cxx
+++ b/sfx2/source/control/recentdocsview.cxx
@@ -18,6 +18,7 @@
*/
#include <sal/log.hxx>
+#include <comphelper/DirectoryHelper.hxx>
#include <recentdocsview.hxx>
#include <sfx2/sfxresid.hxx>
#include <unotools/historyoptions.hxx>
@@ -173,6 +174,18 @@ void RecentDocsView::Reload()
Invalidate();
}
+void RecentDocsView::clearUnavailableFiles(){
+ std::vector< SvtHistoryOptions::HistoryItem > aHistoryList = SvtHistoryOptions::GetList( EHistoryType::PickList );
+ for ( size_t i = 0; i < aHistoryList.size(); i++ )
+ {
+ const SvtHistoryOptions::HistoryItem& rPickListEntry = aHistoryList[i];
+ if ( !comphelper::DirectoryHelper::fileExists(rPickListEntry.sURL) ){
+ SvtHistoryOptions::DeleteItem(EHistoryType::PickList,rPickListEntry.sURL);
+ }
+ }
+ Reload();
+}
+
bool RecentDocsView::MouseButtonDown( const MouseEvent& rMEvt )
{
if (rMEvt.IsLeft())
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 163c5c298e4f..6b68370b0bae 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -603,6 +603,9 @@ IMPL_LINK (BackingWindow, MenuSelectHdl, const OString&, rId, void)
mxAllRecentThumbnails->Reload();
return;
}
+ else if(rId == "clear_unavailable"){
+ mxAllRecentThumbnails->clearUnavailableFiles();
+ }
else if (!rId.isEmpty())
{
initializeLocalView();