diff --git a/.gitignore b/.gitignore
index db36b94..17921b0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,3 @@
logs
bin
*.syso
-icon/*.ico
\ No newline at end of file
diff --git a/icon/open.ico b/icon/open.ico
new file mode 100644
index 0000000..bbde4d3
Binary files /dev/null and b/icon/open.ico differ
diff --git a/resources.rc b/resources.rc
index b221430..e038bb3 100644
--- a/resources.rc
+++ b/resources.rc
@@ -9,6 +9,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST manifest.xml
11 ICON icon/app.ico
21 ICON icon/dot.ico
+22 ICON icon/open.ico
VS_VERSION_INFO VERSIONINFO \
FILEVERSION FRPMGR_VERSION_ARRAY \
diff --git a/ui/aboutpage.go b/ui/aboutpage.go
index 94aab86..e7f4435 100644
--- a/ui/aboutpage.go
+++ b/ui/aboutpage.go
@@ -103,7 +103,7 @@ func (t *AboutPage) View() TabPage {
Alignment: AlignHNearVCenter,
Text: `https://github.com/koho/frpmgr`,
OnLinkActivated: func(link *walk.LinkLabelLink) {
- t.openURL(link.URL())
+ openPath(link.URL())
},
},
VSpacer{Size: 6},
@@ -112,7 +112,7 @@ func (t *AboutPage) View() TabPage {
Alignment: AlignHNearVCenter,
Text: `https://github.com/fatedier/frp`,
OnLinkActivated: func(link *walk.LinkLabelLink) {
- t.openURL(link.URL())
+ openPath(link.URL())
},
},
},
@@ -132,7 +132,7 @@ func (t *AboutPage) View() TabPage {
Label{AssignTo: &t.newVersionTag},
Label{AssignTo: &t.newVersionDate},
PushButton{AssignTo: &t.newVersionDownloadBtn, Text: "下载", OnClicked: func() {
- t.openURL(t.newVersionDownloadBtn.Name())
+ openPath(t.newVersionDownloadBtn.Name())
}},
HSpacer{},
},
@@ -144,11 +144,11 @@ func (t *AboutPage) View() TabPage {
}
}
-func (t *AboutPage) openURL(url string) {
- if url == "" {
+func openPath(path string) {
+ if path == "" {
return
}
- openCmd := exec.Command("cmd", "/c", "start", url)
+ openCmd := exec.Command("cmd", "/c", "start", path)
openCmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
openCmd.Start()
}
diff --git a/ui/detailview.go b/ui/detailview.go
index 58dd2fd..59dffaf 100644
--- a/ui/detailview.go
+++ b/ui/detailview.go
@@ -9,6 +9,7 @@ import (
"github.com/lxn/walk"
. "github.com/lxn/walk/declarative"
"golang.org/x/sys/windows"
+ "path/filepath"
"time"
)
@@ -225,7 +226,7 @@ func (t *ConfSectionView) View() Widget {
Action{
AssignTo: &t.webAction,
Text: "Web",
- Image: loadSysIcon("shell32", 14, 16),
+ Image: loadSysIcon("shell32", 13, 16),
OnTriggered: func() {
t.onQuickAddSection(NewSimpleSectionDialog("Web", "web", []string{"tcp"}, 80))
},
@@ -248,6 +249,18 @@ func (t *ConfSectionView) View() Widget {
Enabled: Bind("section.Selected"),
OnTriggered: t.onDeleteSection,
},
+ Action{
+ Image: loadResourceIcon(22, 16),
+ Text: "打开配置文件",
+ OnTriggered: func() {
+ if !t.mustSelectConf() {
+ return
+ }
+ if path, err := filepath.Abs(t.model.conf.Path); err == nil {
+ openPath(path)
+ }
+ },
+ },
},
},
TableView{
diff --git a/ui/icon.go b/ui/icon.go
index 224bf16..9c81591 100644
--- a/ui/icon.go
+++ b/ui/icon.go
@@ -42,7 +42,7 @@ func iconForState(state config.ServiceState, size int) (icon *walk.Icon) {
case config.StateStarted:
icon = loadSysIcon("imageres", 101, size)
case config.StateStopped:
- icon, _ = walk.NewIconFromResourceIdWithSize(21, walk.Size{size, size})
+ icon = loadResourceIcon(21, size)
default:
icon = loadSysIcon("shell32", 238, size)
}
@@ -71,3 +71,8 @@ func loadNewVersionIcon(size int) (icon *walk.Icon) {
}
return
}
+
+func loadResourceIcon(id int, size int) (icon *walk.Icon) {
+ icon, _ = walk.NewIconFromResourceIdWithSize(id, walk.Size{size, size})
+ return
+}