Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
antSword
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HuangJunbo
antSword
Commits
1623a1a9
Commit
1623a1a9
authored
Jun 22, 2016
by
antoor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding data movement
添加数据移动功能
parent
183ea101
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
54 deletions
+41
-54
contextmenu.js
source/modules/shellmanager/list/contextmenu.js
+41
-54
No files found.
source/modules/shellmanager/list/contextmenu.js
View file @
1623a1a9
...
...
@@ -6,7 +6,8 @@ const DATA = require('../data');
const
Terminal
=
require
(
'../../terminal/'
);
const
Database
=
require
(
'../../database/'
);
const
FileManager
=
require
(
'../../filemanager/'
);
const
LANG
=
antSword
[
'language'
][
'shellmanager'
][
'contextmenu'
];
const
LANG
=
antSword
[
'language'
][
'shellmanager'
];
const
LANG_T
=
antSword
[
'language'
][
'toastr'
];
class
ContextMenu
{
/**
...
...
@@ -43,7 +44,7 @@ class ContextMenu {
[
'edit'
,
'edit'
,
selectedData
,
this
.
editData
.
bind
(
this
,
id
)],
[
'delete'
,
'remove'
,
selectedMultiData
,
this
.
delData
.
bind
(
this
,
ids
)],
false
,
[
'move'
,
'share-square'
,
selectedMultiData
],
[
'move'
,
'share-square'
,
selectedMultiData
,
null
,
this
.
parseMoveCategoryMenu
(
ids
)
],
[
'search'
,
'search'
,
true
],
false
,
[
'clearCache'
,
'trash-o'
,
selectedMultiData
,
this
.
clearCache
.
bind
(
this
,
ids
)],
...
...
@@ -56,7 +57,7 @@ class ContextMenu {
})
}
let
menuObj
=
{
text
:
LANG
[
menu
[
0
]],
text
:
LANG
[
'contextmenu'
][
menu
[
0
]],
icon
:
`fa fa-
${
menu
[
1
]}
`
,
disabled
:
menu
[
2
]
}
...
...
@@ -72,56 +73,6 @@ class ContextMenu {
});
// 弹出菜单
bmenu
(
menuItems
,
event
);
//
// { divider: true },
// { text: LANG['add'], icon: 'fa fa-plus-circle', action: this.addData.bind(this) },
// {
// text: LANG['edit'], icon: 'fa fa-edit', disabled: selectedData,
// action: this.editData.bind(this, id)
// }, {
// text: LANG['delete'], icon: 'fa fa-remove', disabled: selectedMultiData,
// action: this.delData.bind(this, ids)
// }, {
// divider: true
// }, { text: LANG['move'], icon: 'fa fa-share-square', disabled: selectedMultiData }, //subMenu: (() => {
// // const items = manager.category.sidebar.getAllItems();
// // const category = manager.category.sidebar.getActiveItem();
// // let ret = [];
// // items.map((_) => {
// // ret.push({
// // text: _ === 'default' ? LANG['category']['default'] : _,
// // icon: 'fa fa-folder-o',
// // disabled: category === _,
// // action: ((c) => {
// // return () => {
// // const ret = antSword['ipcRenderer'].sendSync('shell-move', {
// // ids: ids,
// // category: c
// // });
// // if (typeof(ret) === 'number') {
// // toastr.success(LANG['list']['move']['success'](ret), LANG_T['success']);
// // manager.loadData();
// // manager.category.sidebar.callEvent('onSelect', [c]);
// // }else{
// // toastr.error(LANG['list']['move']['error'](ret), LANG_T['error']);
// // }
// // }
// // })(_)
// // });
// // });
// // return ret;
// // })() },
// {
// text: LANG['search'], icon: 'fa fa-search', action: this.searchData.bind(this), disabled: true
// }, {
// divider: true
// }, {
// text: LANG['clearCache'], icon: 'fa fa-trash-o',
// disabled: selectedMultiData, action: this.clearCache.bind(this, ids)
// }, {
// text: LANG['clearAllCache'], icon: 'fa fa-trash', action: this.clearAllCache.bind(this)
// }
// ], event);
}
/**
...
...
@@ -146,7 +97,7 @@ class ContextMenu {
for
(
let
_
in
plugins
)
{
// 0x01 添加分类目录
pluginItems
.
push
({
text
:
antSword
.
noxss
(
_
===
'default'
?
LANG
[
'pluginDefault'
]
:
_
),
text
:
antSword
.
noxss
(
_
===
'default'
?
LANG
[
'
contextmenu'
][
'
pluginDefault'
]
:
_
),
icon
:
'fa fa-folder-open-o'
,
disabled
:
plugins
[
_
].
length
===
0
,
subMenu
:
((
plugs
)
=>
{
...
...
@@ -191,6 +142,42 @@ class ContextMenu {
return
pluginItems
;
}
/**
* 移动数据右键菜单
* @return {array} [description]
*/
parseMoveCategoryMenu
(
ids
)
{
// 获取分类列表
const
items
=
antSword
.
modules
.
shellmanager
.
category
.
sidebar
.
getAllItems
();
// 当前选中分类
const
category
=
antSword
.
modules
.
shellmanager
.
category
.
sidebar
.
getActiveItem
();
// 移动事件
const
moveHandler
=
(
c
)
=>
{
const
ret
=
antSword
[
'ipcRenderer'
].
sendSync
(
'shell-move'
,
{
ids
:
ids
,
category
:
c
});
if
(
typeof
(
ret
)
===
'number'
)
{
toastr
.
success
(
LANG
[
'list'
][
'move'
][
'success'
](
ret
),
LANG_T
[
'success'
]);
antSword
.
modules
.
shellmanager
.
reloadData
();
antSword
.
modules
.
shellmanager
.
category
.
sidebar
.
callEvent
(
'onSelect'
,
[
c
])
}
else
{
toastr
.
error
(
LANG
[
'list'
][
'move'
][
'error'
](
ret
),
LANG_T
[
'error'
]);
}
}
// 解析菜单
let
ret
=
[];
items
.
map
((
_
)
=>
{
ret
.
push
({
text
:
_
===
'default'
?
LANG
[
'category'
][
'default'
]
:
_
,
icon
:
'fa fa-folder-o'
,
disabled
:
category
===
_
,
action
:
moveHandler
.
bind
(
null
,
_
)
});
});
return
ret
;
}
/**
* 添加数据
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment