18 |
18 |
19 class GpgProjectHelper(HgExtensionProjectHelper): |
19 class GpgProjectHelper(HgExtensionProjectHelper): |
20 """ |
20 """ |
21 Class implementing the gpg extension project helper. |
21 Class implementing the gpg extension project helper. |
22 """ |
22 """ |
|
23 |
23 def __init__(self): |
24 def __init__(self): |
24 """ |
25 """ |
25 Constructor |
26 Constructor |
26 """ |
27 """ |
27 super().__init__() |
28 super().__init__() |
28 |
29 |
29 def initActions(self): |
30 def initActions(self): |
30 """ |
31 """ |
31 Public method to generate the action objects. |
32 Public method to generate the action objects. |
32 """ |
33 """ |
33 self.hgGpgListAct = EricAction( |
34 self.hgGpgListAct = EricAction( |
34 self.tr('List Signed Changesets'), |
35 self.tr("List Signed Changesets"), |
35 UI.PixmapCache.getIcon("changesetSignList"), |
36 UI.PixmapCache.getIcon("changesetSignList"), |
36 self.tr('List Signed Changesets...'), |
37 self.tr("List Signed Changesets..."), |
37 0, 0, self, 'mercurial_gpg_list') |
38 0, |
38 self.hgGpgListAct.setStatusTip(self.tr( |
39 0, |
39 'List signed changesets' |
40 self, |
40 )) |
41 "mercurial_gpg_list", |
41 self.hgGpgListAct.setWhatsThis(self.tr( |
42 ) |
42 """<b>List Signed Changesets</b>""" |
43 self.hgGpgListAct.setStatusTip(self.tr("List signed changesets")) |
43 """<p>This opens a dialog listing all signed changesets.</p>""" |
44 self.hgGpgListAct.setWhatsThis( |
44 )) |
45 self.tr( |
|
46 """<b>List Signed Changesets</b>""" |
|
47 """<p>This opens a dialog listing all signed changesets.</p>""" |
|
48 ) |
|
49 ) |
45 self.hgGpgListAct.triggered.connect(self.__hgGpgSignatures) |
50 self.hgGpgListAct.triggered.connect(self.__hgGpgSignatures) |
46 self.actions.append(self.hgGpgListAct) |
51 self.actions.append(self.hgGpgListAct) |
47 |
52 |
48 self.hgGpgVerifyAct = EricAction( |
53 self.hgGpgVerifyAct = EricAction( |
49 self.tr('Verify Signatures'), |
54 self.tr("Verify Signatures"), |
50 UI.PixmapCache.getIcon("changesetSignVerify"), |
55 UI.PixmapCache.getIcon("changesetSignVerify"), |
51 self.tr('Verify Signatures'), |
56 self.tr("Verify Signatures"), |
52 0, 0, self, 'mercurial_gpg_verify') |
57 0, |
53 self.hgGpgVerifyAct.setStatusTip(self.tr( |
58 0, |
54 'Verify all signatures there may be for a particular revision' |
59 self, |
55 )) |
60 "mercurial_gpg_verify", |
56 self.hgGpgVerifyAct.setWhatsThis(self.tr( |
61 ) |
57 """<b>Verify Signatures</b>""" |
62 self.hgGpgVerifyAct.setStatusTip( |
58 """<p>This verifies all signatures there may be for a particular""" |
63 self.tr("Verify all signatures there may be for a particular revision") |
59 """ revision.</p>""" |
64 ) |
60 )) |
65 self.hgGpgVerifyAct.setWhatsThis( |
|
66 self.tr( |
|
67 """<b>Verify Signatures</b>""" |
|
68 """<p>This verifies all signatures there may be for a particular""" |
|
69 """ revision.</p>""" |
|
70 ) |
|
71 ) |
61 self.hgGpgVerifyAct.triggered.connect(self.__hgGpgVerifySignatures) |
72 self.hgGpgVerifyAct.triggered.connect(self.__hgGpgVerifySignatures) |
62 self.actions.append(self.hgGpgVerifyAct) |
73 self.actions.append(self.hgGpgVerifyAct) |
63 |
74 |
64 self.hgGpgSignAct = EricAction( |
75 self.hgGpgSignAct = EricAction( |
65 self.tr('Sign Revision'), |
76 self.tr("Sign Revision"), |
66 UI.PixmapCache.getIcon("changesetSign"), |
77 UI.PixmapCache.getIcon("changesetSign"), |
67 self.tr('Sign Revision'), |
78 self.tr("Sign Revision"), |
68 0, 0, self, 'mercurial_gpg_sign') |
79 0, |
69 self.hgGpgSignAct.setStatusTip(self.tr( |
80 0, |
70 'Add a signature for a selected revision' |
81 self, |
71 )) |
82 "mercurial_gpg_sign", |
72 self.hgGpgSignAct.setWhatsThis(self.tr( |
83 ) |
73 """<b>Sign Revision</b>""" |
84 self.hgGpgSignAct.setStatusTip( |
74 """<p>This adds a signature for a selected revision.</p>""" |
85 self.tr("Add a signature for a selected revision") |
75 )) |
86 ) |
|
87 self.hgGpgSignAct.setWhatsThis( |
|
88 self.tr( |
|
89 """<b>Sign Revision</b>""" |
|
90 """<p>This adds a signature for a selected revision.</p>""" |
|
91 ) |
|
92 ) |
76 self.hgGpgSignAct.triggered.connect(self.__hgGpgSign) |
93 self.hgGpgSignAct.triggered.connect(self.__hgGpgSign) |
77 self.actions.append(self.hgGpgSignAct) |
94 self.actions.append(self.hgGpgSignAct) |
78 |
95 |
79 def initMenu(self, mainMenu): |
96 def initMenu(self, mainMenu): |
80 """ |
97 """ |
81 Public method to generate the extension menu. |
98 Public method to generate the extension menu. |
82 |
99 |
83 @param mainMenu reference to the main menu (QMenu) |
100 @param mainMenu reference to the main menu (QMenu) |
84 @return populated menu (QMenu) |
101 @return populated menu (QMenu) |
85 """ |
102 """ |
86 menu = QMenu(self.menuTitle(), mainMenu) |
103 menu = QMenu(self.menuTitle(), mainMenu) |
87 menu.setIcon(UI.PixmapCache.getIcon("changesetSign")) |
104 menu.setIcon(UI.PixmapCache.getIcon("changesetSign")) |
88 menu.setTearOffEnabled(True) |
105 menu.setTearOffEnabled(True) |
89 |
106 |
90 menu.addAction(self.hgGpgListAct) |
107 menu.addAction(self.hgGpgListAct) |
91 menu.addAction(self.hgGpgVerifyAct) |
108 menu.addAction(self.hgGpgVerifyAct) |
92 menu.addAction(self.hgGpgSignAct) |
109 menu.addAction(self.hgGpgSignAct) |
93 |
110 |
94 return menu |
111 return menu |
95 |
112 |
96 def menuTitle(self): |
113 def menuTitle(self): |
97 """ |
114 """ |
98 Public method to get the menu title. |
115 Public method to get the menu title. |
99 |
116 |
100 @return title of the menu (string) |
117 @return title of the menu (string) |
101 """ |
118 """ |
102 return self.tr("GPG") |
119 return self.tr("GPG") |
103 |
120 |
104 def __hgGpgSignatures(self): |
121 def __hgGpgSignatures(self): |
105 """ |
122 """ |
106 Private slot used to list all signed changesets. |
123 Private slot used to list all signed changesets. |
107 """ |
124 """ |
108 self.vcs.getExtensionObject("gpg").hgGpgSignatures() |
125 self.vcs.getExtensionObject("gpg").hgGpgSignatures() |
109 |
126 |
110 def __hgGpgVerifySignatures(self): |
127 def __hgGpgVerifySignatures(self): |
111 """ |
128 """ |
112 Private slot used to verify the signatures of a revision. |
129 Private slot used to verify the signatures of a revision. |
113 """ |
130 """ |
114 self.vcs.getExtensionObject("gpg").hgGpgVerifySignatures() |
131 self.vcs.getExtensionObject("gpg").hgGpgVerifySignatures() |
115 |
132 |
116 def __hgGpgSign(self): |
133 def __hgGpgSign(self): |
117 """ |
134 """ |
118 Private slot used to sign a revision. |
135 Private slot used to sign a revision. |
119 """ |
136 """ |
120 self.vcs.getExtensionObject("gpg").hgGpgSign() |
137 self.vcs.getExtensionObject("gpg").hgGpgSign() |