Skip to content

Commit f2f0120

Browse files
authored
Merge pull request #412 from Flow-Launcher/add_api_errormsg
Add API error msg method
2 parents 43d75c9 + 6b118d8 commit f2f0120

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

Flow.Launcher.Plugin/IPublicAPI.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ public interface IPublicAPI
4747
/// </summary>
4848
void CheckForNewUpdate();
4949

50+
/// <summary>
51+
/// Show the error message using Flow's standard error icon.
52+
/// </summary>
53+
/// <param name="title">Message title</param>
54+
/// <param name="subTitle">Optional message subtitle</param>
55+
void ShowMsgError(string title, string subTitle = "");
56+
5057
/// <summary>
5158
/// Show message box
5259
/// </summary>

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ public void SaveAppAllSettings()
8484

8585
public Task ReloadAllPluginData() => PluginManager.ReloadData();
8686

87+
public void ShowMsgError(string title, string subTitle = "") => ShowMsg(title, subTitle, Constant.ErrorIcon, true);
88+
8789
public void ShowMsg(string title, string subTitle = "", string iconPath = "") => ShowMsg(title, subTitle, iconPath, true);
8890

8991
public void ShowMsg(string title, string subTitle, string iconPath, bool useMainWindowAsOwner = true)

Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
184184
{
185185
var message = $"Fail to delete {fileOrFolder} at {record.FullPath}";
186186
LogException(message, e);
187-
Context.API.ShowMsg(message);
187+
Context.API.ShowMsgError(message);
188188
return false;
189189
}
190190

@@ -208,7 +208,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
208208
{
209209
var name = "Plugin: Folder";
210210
var message = $"File not found: {e.Message}";
211-
Context.API.ShowMsg(name, message);
211+
Context.API.ShowMsgError(name, message);
212212
}
213213

214214
return true;
@@ -236,7 +236,7 @@ private Result CreateOpenContainingFolderResult(SearchResult record)
236236
{
237237
var message = $"Fail to open file at {record.FullPath}";
238238
LogException(message, e);
239-
Context.API.ShowMsg(message);
239+
Context.API.ShowMsgError(message);
240240
return false;
241241
}
242242

@@ -267,7 +267,7 @@ private Result CreateOpenWithEditorResult(SearchResult record)
267267
{
268268
var message = $"Failed to open editor for file at {record.FullPath}";
269269
LogException(message, e);
270-
Context.API.ShowMsg(message);
270+
Context.API.ShowMsgError(message);
271271
return false;
272272
}
273273
},
@@ -326,7 +326,7 @@ private Result CreateOpenWindowsIndexingOptions()
326326
{
327327
var message = Context.API.GetTranslation("plugin_explorer_openindexingoptions_errormsg");
328328
LogException(message, e);
329-
Context.API.ShowMsg(message);
329+
Context.API.ShowMsgError(message);
330330
return false;
331331
}
332332
},

Plugins/Flow.Launcher.Plugin.Explorer/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"Name": "Explorer",
88
"Description": "Search and manage files and folders. Explorer utilises Windows Index Search",
99
"Author": "Jeremy Wu",
10-
"Version": "1.7.4",
10+
"Version": "1.7.5",
1111
"Language": "csharp",
1212
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
1313
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",

0 commit comments

Comments
 (0)