@@ -350,17 +350,24 @@ private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
350350 {
351351 var hitTestInfo = listView1 . HitTest ( listView1 . PointToClient ( Cursor . Position ) ) ;
352352 int itemIndex = hitTestInfo . Item ? . Index ?? - 1 ;
353+ string themeId = null ;
354+ ThemeConfig theme = null ;
353355
354- if ( itemIndex <= 0 )
356+ if ( itemIndex < 0 )
355357 {
356358 e . Cancel = true ;
357359 return ;
358360 }
361+ else if ( itemIndex > 0 )
362+ {
363+ themeId = ( string ) listView1 . Items [ itemIndex ] . Tag ;
364+ theme = ThemeManager . themeSettings . Find ( t => t . themeId == themeId ) ;
365+ }
359366
360- string themeId = ( string ) listView1 . Items [ itemIndex ] . Tag ;
361- ThemeConfig theme = ThemeManager . themeSettings . Find ( t => t . themeId == themeId ) ;
362367 bool isWindowsTheme = themeId == DefaultThemes . GetWindowsTheme ( ) ? . themeId ;
363- contextMenuStrip1 . Items [ 1 ] . Enabled = ThemeManager . IsThemeDownloaded ( theme ) && ! isWindowsTheme ;
368+ contextMenuStrip1 . Items [ 0 ] . Enabled = itemIndex > 0 ;
369+ contextMenuStrip1 . Items [ 1 ] . Enabled = theme != null && ThemeManager . IsThemeDownloaded ( theme ) &&
370+ ! isWindowsTheme ;
364371
365372 if ( JsonConfig . settings . favoriteThemes == null ||
366373 ! JsonConfig . settings . favoriteThemes . Contains ( themeId ) )
@@ -372,14 +379,17 @@ private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
372379 contextMenuStrip1 . Items [ 0 ] . Text = _ ( "Remove from favorites" ) ;
373380 }
374381
375- if ( ThemeManager . defaultThemes . Contains ( themeId ) || isWindowsTheme )
382+ if ( themeId == null || ThemeManager . defaultThemes . Contains ( themeId ) || isWindowsTheme )
376383 {
377384 contextMenuStrip1 . Items [ 1 ] . Text = _ ( "Delete" ) ;
378385 }
379386 else
380387 {
381388 contextMenuStrip1 . Items [ 1 ] . Text = _ ( "Delete permanently" ) ;
382389 }
390+
391+ contextMenuStrip1 . Items [ 3 ] . Text = _ ( "Show only installed themes" ) ;
392+ ( contextMenuStrip1 . Items [ 3 ] as ToolStripMenuItem ) . Checked = JsonConfig . settings . showInstalledOnly ;
383393 }
384394
385395 private void favoriteThemeMenuItem_Click ( object sender , EventArgs e )
@@ -424,6 +434,11 @@ private void deleteThemeMenuItem_Click(object sender, EventArgs e)
424434 }
425435 }
426436
437+ private void showInstalledMenuItem_Click ( object sender , EventArgs e )
438+ {
439+ ThemeDialogUtils . ToggleShowInstalledOnly ( listView1 , ! JsonConfig . settings . showInstalledOnly ) ;
440+ }
441+
427442 private void OnDownloadDialogClosed ( object sender , FormClosedEventArgs e )
428443 {
429444 if ( e . CloseReason == CloseReason . UserClosing &&
0 commit comments