13 from PyQt4.QtGui import QDialog, QDialogButtonBox, QTreeWidgetItem |
13 from PyQt4.QtGui import QDialog, QDialogButtonBox, QTreeWidgetItem |
14 |
14 |
15 from E5Gui import E5MessageBox |
15 from E5Gui import E5MessageBox |
16 |
16 |
17 from .Ui_IrcNetworkEditDialog import Ui_IrcNetworkEditDialog |
17 from .Ui_IrcNetworkEditDialog import Ui_IrcNetworkEditDialog |
18 |
|
19 from .IrcNetworkManager import IrcIdentity, IrcNetwork, IrcChannel |
|
20 from .IrcChannelEditDialog import IrcChannelEditDialog |
|
21 from .IrcServerEditDialog import IrcServerEditDialog |
|
22 from .IrcIdentitiesEditDialog import IrcIdentitiesEditDialog |
|
23 |
18 |
24 import UI.PixmapCache |
19 import UI.PixmapCache |
25 |
20 |
26 |
21 |
27 class IrcNetworkEditDialog(QDialog, Ui_IrcNetworkEditDialog): |
22 class IrcNetworkEditDialog(QDialog, Ui_IrcNetworkEditDialog): |
50 self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) |
45 self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) |
51 |
46 |
52 if networkName: |
47 if networkName: |
53 self.__network = copy.deepcopy(self.__manager.getNetwork(networkName)) |
48 self.__network = copy.deepcopy(self.__manager.getNetwork(networkName)) |
54 else: |
49 else: |
|
50 from .IrcNetworkManager import IrcNetwork |
55 self.__network = IrcNetwork("") |
51 self.__network = IrcNetwork("") |
56 |
52 |
57 # network name |
53 # network name |
58 self.networkEdit.setText(networkName) |
54 self.networkEdit.setText(networkName) |
59 |
55 |
100 |
96 |
101 @param currentIdentity name of the identity to select (string) |
97 @param currentIdentity name of the identity to select (string) |
102 """ |
98 """ |
103 self.identityCombo.clear() |
99 self.identityCombo.clear() |
104 |
100 |
|
101 from .IrcNetworkManager import IrcIdentity |
105 identities = list(sorted(self.__manager.getIdentityNames())) |
102 identities = list(sorted(self.__manager.getIdentityNames())) |
106 identities[identities.index(IrcIdentity.DefaultIdentityName)] = \ |
103 identities[identities.index(IrcIdentity.DefaultIdentityName)] = \ |
107 IrcIdentity.DefaultIdentityDisplay |
104 IrcIdentity.DefaultIdentityDisplay |
108 self.identityCombo.addItems(identities) |
105 self.identityCombo.addItems(identities) |
109 if currentIdentity == IrcIdentity.DefaultIdentityName: |
106 if currentIdentity == IrcIdentity.DefaultIdentityName: |
118 """ |
115 """ |
119 Private slot to handle the selection of an identity. |
116 Private slot to handle the selection of an identity. |
120 |
117 |
121 @param identity selected entity (string) |
118 @param identity selected entity (string) |
122 """ |
119 """ |
|
120 from .IrcNetworkManager import IrcIdentity |
123 if identity == IrcIdentity.DefaultIdentityDisplay: |
121 if identity == IrcIdentity.DefaultIdentityDisplay: |
124 identity = IrcIdentity.DefaultIdentityName |
122 identity = IrcIdentity.DefaultIdentityName |
125 self.__network.setIdentityName(identity) |
123 self.__network.setIdentityName(identity) |
126 |
124 |
127 @pyqtSlot() |
125 @pyqtSlot() |
128 def on_editIdentitiesButton_clicked(self): |
126 def on_editIdentitiesButton_clicked(self): |
129 """ |
127 """ |
130 Private slot to edit the identities. |
128 Private slot to edit the identities. |
131 """ |
129 """ |
|
130 from .IrcIdentitiesEditDialog import IrcIdentitiesEditDialog |
132 currentIdentity = self.identityCombo.currentText() |
131 currentIdentity = self.identityCombo.currentText() |
133 dlg = IrcIdentitiesEditDialog(self.__manager, currentIdentity, self) |
132 dlg = IrcIdentitiesEditDialog(self.__manager, currentIdentity, self) |
134 dlg.exec_() |
133 dlg.exec_() |
135 self.__refreshIdentityCombo(currentIdentity) |
134 self.__refreshIdentityCombo(currentIdentity) |
136 |
135 |
146 @pyqtSlot() |
145 @pyqtSlot() |
147 def on_editServerButton_clicked(self): |
146 def on_editServerButton_clicked(self): |
148 """ |
147 """ |
149 Private slot to edit the server configuration. |
148 Private slot to edit the server configuration. |
150 """ |
149 """ |
|
150 from .IrcServerEditDialog import IrcServerEditDialog |
151 dlg = IrcServerEditDialog(self.__network.getServer()) |
151 dlg = IrcServerEditDialog(self.__network.getServer()) |
152 if dlg.exec_() == QDialog.Accepted: |
152 if dlg.exec_() == QDialog.Accepted: |
153 self.__network.setServer(dlg.getServer()) |
153 self.__network.setServer(dlg.getServer()) |
154 self.serverEdit.setText(self.__network.getServerName()) |
154 self.serverEdit.setText(self.__network.getServerName()) |
155 |
155 |
225 # add a new channel |
225 # add a new channel |
226 name = "" |
226 name = "" |
227 key = "" |
227 key = "" |
228 autoJoin = False |
228 autoJoin = False |
229 |
229 |
|
230 from .IrcChannelEditDialog import IrcChannelEditDialog |
230 dlg = IrcChannelEditDialog(name, key, autoJoin, itm is not None, self) |
231 dlg = IrcChannelEditDialog(name, key, autoJoin, itm is not None, self) |
231 if dlg.exec_() == QDialog.Accepted: |
232 if dlg.exec_() == QDialog.Accepted: |
|
233 from .IrcNetworkManager import IrcChannel |
232 name, key, autoJoin = dlg.getData() |
234 name, key, autoJoin = dlg.getData() |
233 channel = IrcChannel(name) |
235 channel = IrcChannel(name) |
234 channel.setKey(key) |
236 channel.setKey(key) |
235 channel.setAutoJoin(autoJoin) |
237 channel.setAutoJoin(autoJoin) |
236 if itm: |
238 if itm: |