Add option to remember last opened tag tab
Closes #5936 Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -42,6 +42,17 @@ public interface BankTagsConfig extends Config
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "rememberTab",
|
||||||
|
name = "Remember last Tag Tab",
|
||||||
|
description = "Enable the ability to remember last Tag Tab when closing/opening the bank.",
|
||||||
|
position = 2
|
||||||
|
)
|
||||||
|
default boolean rememberTab()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "position",
|
keyName = "position",
|
||||||
name = "",
|
name = "",
|
||||||
@@ -59,4 +70,22 @@ public interface BankTagsConfig extends Config
|
|||||||
description = ""
|
description = ""
|
||||||
)
|
)
|
||||||
void position(int idx);
|
void position(int idx);
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "tab",
|
||||||
|
name = "",
|
||||||
|
description = "",
|
||||||
|
hidden = true
|
||||||
|
)
|
||||||
|
default String tab()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "tab",
|
||||||
|
name = "",
|
||||||
|
description = ""
|
||||||
|
)
|
||||||
|
void tab(String tab);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,6 +190,11 @@ public class TabInterface
|
|||||||
tabManager.getAllTabs().forEach(this::loadTab);
|
tabManager.getAllTabs().forEach(this::loadTab);
|
||||||
activateTab(null);
|
activateTab(null);
|
||||||
scrollTab(0);
|
scrollTab(0);
|
||||||
|
|
||||||
|
if (config.rememberTab() && !Strings.isNullOrEmpty(config.tab()))
|
||||||
|
{
|
||||||
|
openTag(TAG_SEARCH + config.tab());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroy()
|
public void destroy()
|
||||||
@@ -221,6 +226,23 @@ public class TabInterface
|
|||||||
config.position(currentTabIndex);
|
config.position(currentTabIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do the same for last active tab
|
||||||
|
if (config.rememberTab())
|
||||||
|
{
|
||||||
|
if (activeTab == null && !Strings.isNullOrEmpty(config.tab()))
|
||||||
|
{
|
||||||
|
config.tab("");
|
||||||
|
}
|
||||||
|
else if (activeTab != null && !activeTab.getTag().equals(config.tab()))
|
||||||
|
{
|
||||||
|
config.tab(activeTab.getTag());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!Strings.isNullOrEmpty(config.tab()))
|
||||||
|
{
|
||||||
|
config.tab("");
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -790,7 +812,7 @@ public class TabInterface
|
|||||||
private void openTag(String tag)
|
private void openTag(String tag)
|
||||||
{
|
{
|
||||||
doSearch(InputType.SEARCH, tag);
|
doSearch(InputType.SEARCH, tag);
|
||||||
activateTab(tabManager.find(tag.substring(4)));
|
activateTab(tabManager.find(tag.substring(TAG_SEARCH.length())));
|
||||||
|
|
||||||
// When tab is selected with search window open, the search window closes but the search button
|
// When tab is selected with search window open, the search window closes but the search button
|
||||||
// stays highlighted, this solves that issue
|
// stays highlighted, this solves that issue
|
||||||
|
|||||||
Reference in New Issue
Block a user