Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
Expand All @@ -9,7 +9,10 @@
using Flow.Launcher.Plugin.Explorer.Search;
using Flow.Launcher.Plugin.Explorer.Search.FolderLinks;
using System.Linq;
using System.Reflection;
using MessageBox = System.Windows.Forms.MessageBox;
using MessageBoxIcon = System.Windows.Forms.MessageBoxIcon;
using MessageBoxButton = System.Windows.Forms.MessageBoxButtons;
using DialogResult = System.Windows.Forms.DialogResult;

namespace Flow.Launcher.Plugin.Explorer
{
Expand Down Expand Up @@ -101,10 +104,25 @@ public List<Result> LoadContextMenus(Result selectedResult)
{
try
{
if (MessageBox.Show(
string.Format(Context.API.GetTranslation("plugin_explorer_deletefilefolderconfirm"),fileOrFolder),
string.Empty,
MessageBoxButton.YesNo,
MessageBoxIcon.Warning)
== DialogResult.No)
return false;

if (record.Type == ResultType.File)
File.Delete(record.FullPath);
else
Directory.Delete(record.FullPath, true);

Task.Run(() =>
{
Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_deletefilefoldersuccess"),
string.Format(Context.API.GetTranslation("plugin_explorer_deletefilefoldersuccess_detail"), fileOrFolder),
Constants.ExplorerIconImageFullPath);
});
}
catch (Exception e)
{
Expand Down Expand Up @@ -212,15 +230,11 @@ private Result CreateAddToIndexSearchExclusionListResult(SearchResult record)
if(!Settings.IndexSearchExcludedSubdirectoryPaths.Any(x => x.Path == record.FullPath))
Settings.IndexSearchExcludedSubdirectoryPaths.Add(new FolderLink { Path = record.FullPath });

var pluginDirectory = Directory.GetParent(Assembly.GetExecutingAssembly().Location.ToString());

var iconPath = pluginDirectory + "\\" + Constants.ExplorerIconImagePath;

Task.Run(() =>
{
Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_excludedfromindexsearch_msg"),
Context.API.GetTranslation("plugin_explorer_path") +
" " + record.FullPath, iconPath);
" " + record.FullPath, Constants.ExplorerIconImageFullPath);

// so the new path can be persisted to storage and not wait till next ViewModel save.
Context.API.SaveAppAllSettings();
Expand Down
3 changes: 3 additions & 0 deletions Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<!--Dialogues-->
<system:String x:Key="plugin_explorer_select_folder_link_warning">Please select a folder link</system:String>
<system:String x:Key="plugin_explorer_delete_folder_link">Are you sure you want to delete {0}?</system:String>
<system:String x:Key="plugin_explorer_deletefilefolderconfirm">Are you sure you want to permanently delete this {0}?</system:String>
<system:String x:Key="plugin_explorer_deletefilefoldersuccess">Deletion successful</system:String>
<system:String x:Key="plugin_explorer_deletefilefoldersuccess_detail">Successfully deleted the {0}</system:String>

<!--Controls-->
<system:String x:Key="plugin_explorer_delete">Delete</system:String>
Expand Down
7 changes: 5 additions & 2 deletions Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Reflection;

namespace Flow.Launcher.Plugin.Explorer.Search
{
Expand All @@ -25,5 +25,8 @@ internal static class Constants
internal const char DirectorySeperator = '\\';

internal const string WindowsIndexingOptions = "srchadmin.dll";

internal static string ExplorerIconImageFullPath
=> Directory.GetParent(Assembly.GetExecutingAssembly().Location.ToString()) + "\\" + ExplorerIconImagePath;
}
}