Sun, 02 Dec 2012 18:52:03 +0100
Continued with the IRC management and added a few more TODOs.
--- a/Network/IRC/IrcChannelWidget.py Sun Dec 02 15:54:15 2012 +0100 +++ b/Network/IRC/IrcChannelWidget.py Sun Dec 02 18:52:03 2012 +0100 @@ -153,6 +153,13 @@ # TODO: add context menu to users list with these entries: # Whois # Private Message + # TODO: add "Auto WHO" functionality (WHO <channel> %nf) + # The possible combinations for this field are listed below: + # H The user is not away. + # G The user is set away. + # * The user is an IRC operator. + # @ The user is a channel op in the channel listed in the first field. + # + The user is voiced in the channel listed. # TODO: add context menu to messages pane with these entries: # Copy # Copy Link Location
--- a/Network/IRC/IrcIdentitiesEditDialog.py Sun Dec 02 15:54:15 2012 +0100 +++ b/Network/IRC/IrcIdentitiesEditDialog.py Sun Dec 02 18:52:03 2012 +0100 @@ -13,7 +13,6 @@ from PyQt4.QtGui import QDialog, QInputDialog, QLineEdit, QItemSelectionModel from E5Gui import E5MessageBox -##from E5Gui.E5Application import e5App from .Ui_IrcIdentitiesEditDialog import Ui_IrcIdentitiesEditDialog @@ -23,7 +22,6 @@ import UI.PixmapCache -# TODO: implement "Away" page class IrcIdentitiesEditDialog(QDialog, Ui_IrcIdentitiesEditDialog): """ Class implementing the identities management dialog. @@ -108,13 +106,22 @@ self.__currentIdentity = self.__identities[identity] - # TODO: update of tab widget not implemented yet + # General Tab self.realnameEdit.setText(self.__currentIdentity.getRealName()) self.nicknamesList.clear() self.nicknamesList.addItems(self.__currentIdentity.getNickNames()) self.serviceEdit.setText(self.__currentIdentity.getServiceName()) self.passwordEdit.setText(self.__currentIdentity.getPassword()) + # Away Tab + self.rememberPosOnAwayCheckBox.setChecked( + self.__currentIdentity.rememberAwayPosition()) + self.awayEdit.setText(self.__currentIdentity.getAwayMessage()) + self.autoAwayGroup.setChecked(self.__currentIdentity.autoAway()) + self.inactivitySpinBox.setValue(self.__currentIdentity.getAutoAwayTimeout()) + self.autoReturnCheckBox.setChecked(self.__currentIdentity.autoReturn()) + + # Advanced Tab self.identEdit.setText(self.__currentIdentity.getIdent()) self.quitEdit.setText(self.__currentIdentity.getQuitMessage()) self.partEdit.setText(self.__currentIdentity.getPartMessage()) @@ -124,18 +131,6 @@ self.__updateNicknameButtons() self.identityTabWidget.setCurrentIndex(0) -## void IdentityDialog::updateIdentity(int index) -## { -## m_insertRememberLineOnAwayChBox->setChecked(m_currentIdentity->getInsertRememberLineOnAway()); -## m_awayMessageEdit->setText(m_currentIdentity->getAwayMessage()); -## m_awayNickEdit->setText(m_currentIdentity->getAwayNickname()); -## awayCommandsGroup->setChecked(m_currentIdentity->getRunAwayCommands()); -## m_awayEdit->setText(m_currentIdentity->getAwayCommand()); -## m_unAwayEdit->setText(m_currentIdentity->getReturnCommand()); -## automaticAwayGroup->setChecked(m_currentIdentity->getAutomaticAway()); -## m_awayInactivitySpin->setValue(m_currentIdentity->getAwayInactivity()); -## m_automaticUnawayChBox->setChecked(m_currentIdentity->getAutomaticUnaway()); -## } def __refreshCurrentIdentity(self): """ @@ -144,29 +139,25 @@ if self.__currentIdentity is None: return + # General Tab self.__currentIdentity.setRealName(self.realnameEdit.text()) self.__currentIdentity.setNickNames([self.nicknamesList.item(row).text() for row in range(self.nicknamesList.count())]) self.__currentIdentity.setServiceName(self.serviceEdit.text()) self.__currentIdentity.setPassword(self.passwordEdit.text()) + # Away Tab + self.__currentIdentity.setRememberAwayPosition( + self.rememberPosOnAwayCheckBox.isChecked()) + self.__currentIdentity.setAwayMessage(self.awayEdit.text()) + self.__currentIdentity.setAutoAway(self.autoAwayGroup.isChecked()) + self.__currentIdentity.setAutoAwayTimeout(self.inactivitySpinBox.value()) + self.__currentIdentity.setAutoReturn(self.autoReturnCheckBox.isChecked()) + + # Advanced Tab self.__currentIdentity.setIdent(self.identEdit.text()) self.__currentIdentity.setQuitMessage(self.quitEdit.text()) self.__currentIdentity.setPartMessage(self.partEdit.text()) -## -## void IdentityDialog::refreshCurrentIdentity() -## { -## m_currentIdentity->setInsertRememberLineOnAway(m_insertRememberLineOnAwayChBox->isChecked()); -## m_currentIdentity->setAwayMessage(m_awayMessageEdit->text()); -## m_currentIdentity->setAwayNickname(m_awayNickEdit->text()); -## m_currentIdentity->setRunAwayCommands(awayCommandsGroup->isChecked()); -## m_currentIdentity->setAwayCommand(m_awayEdit->text()); -## m_currentIdentity->setReturnCommand(m_unAwayEdit->text()); -## m_currentIdentity->setAutomaticAway(automaticAwayGroup->isChecked()); -## m_currentIdentity->setAwayInactivity(m_awayInactivitySpin->value()); -## m_currentIdentity->setAutomaticUnaway(m_automaticUnawayChBox->isChecked()); -## } -## def __checkCurrentIdentity(self): """
--- a/Network/IRC/IrcIdentitiesEditDialog.ui Sun Dec 02 15:54:15 2012 +0100 +++ b/Network/IRC/IrcIdentitiesEditDialog.ui Sun Dec 02 18:52:03 2012 +0100 @@ -209,6 +209,112 @@ <attribute name="title"> <string>Away</string> </attribute> + <layout class="QGridLayout" name="gridLayout_5"> + <item row="0" column="0" colspan="2"> + <widget class="QCheckBox" name="rememberPosOnAwayCheckBox"> + <property name="toolTip"> + <string>Select to mark the current position in the chat with a horizontal line, when you send an AWAY command.</string> + </property> + <property name="whatsThis"> + <string/> + </property> + <property name="text"> + <string>Mark the current position in chat windows when going away</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>Away Message:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="awayEdit"> + <property name="toolTip"> + <string>Enter the message to be sent when going away</string> + </property> + </widget> + </item> + <item row="2" column="0" colspan="2"> + <widget class="QGroupBox" name="autoAwayGroup"> + <property name="toolTip"> + <string>Select to send an AWAY message when inactive</string> + </property> + <property name="title"> + <string>Auto Away</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <layout class="QGridLayout" name="gridLayout_4"> + <item row="0" column="0"> + <widget class="QLabel" name="label_9"> + <property name="text"> + <string>Time of Inactivity:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="inactivitySpinBox"> + <property name="toolTip"> + <string>Enter the time of inactivity to send the automatic AWAY message</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="suffix"> + <string> min</string> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>120</number> + </property> + </widget> + </item> + <item row="0" column="2"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>321</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="0" colspan="3"> + <widget class="QCheckBox" name="autoReturnCheckBox"> + <property name="toolTip"> + <string>Select to return automatically when activity is detected</string> + </property> + <property name="text"> + <string>Automatically return on activity</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="3" column="1"> + <spacer name="verticalSpacer_3"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>219</height> + </size> + </property> + </spacer> + </item> + </layout> </widget> <widget class="QWidget" name="advancedTab"> <attribute name="title"> @@ -302,6 +408,11 @@ <tabstop>nicknameDownButton</tabstop> <tabstop>serviceEdit</tabstop> <tabstop>passwordEdit</tabstop> + <tabstop>rememberPosOnAwayCheckBox</tabstop> + <tabstop>awayEdit</tabstop> + <tabstop>autoAwayGroup</tabstop> + <tabstop>inactivitySpinBox</tabstop> + <tabstop>autoReturnCheckBox</tabstop> <tabstop>identEdit</tabstop> <tabstop>quitEdit</tabstop> <tabstop>partEdit</tabstop>
--- a/Network/IRC/IrcNetworkManager.py Sun Dec 02 15:54:15 2012 +0100 +++ b/Network/IRC/IrcNetworkManager.py Sun Dec 02 18:52:03 2012 +0100 @@ -24,6 +24,7 @@ DefaultIdentityName = "0default" DefaultIdentityDisplay = QCoreApplication.translate("IrcIdentity", "Default Identity") + DefaultAwayMessage = QCoreApplication.translate("IrcIdentity", "Gone away for now.") DefaultQuitMessage = QCoreApplication.translate("IrcIdentity", "IRC for eric5 IDE") DefaultPartMessage = QCoreApplication.translate("IrcIdentity", "IRC for eric5 IDE") @@ -42,7 +43,11 @@ self.__password = "" self.__ident = Utilities.getUserName() - # TODO: add AWAY handling + self.__rememberPosOnAway = True + self.__awayMessage = IrcIdentity.DefaultAwayMessage + self.__autoAway = False + self.__autoAwayTimeout = 1 + self.__autoReturn = False self.__quitMessage = IrcIdentity.DefaultQuitMessage self.__partMessage = IrcIdentity.DefaultPartMessage @@ -61,6 +66,11 @@ settings.setValue("Password", self.__password) settings.setValue("QuitMessage", self.__quitMessage) settings.setValue("PartMessage", self.__partMessage) + settings.setValue("RememberAwayPosition", self.__rememberPosOnAway) + settings.setValue("AwayMessage", self.__awayMessage) + settings.setValue("AutoAway", self.__autoAway) + settings.setValue("AwayTimeout", self.__autoAwayTimeout) + settings.setValue("AutoReturn", self.__autoReturn) def load(self, settings): """ @@ -75,6 +85,12 @@ self.__password = settings.value("Password", "") self.__quitMessage = settings.value("QuitMessage", IrcIdentity.DefaultQuitMessage) self.__partMessage = settings.value("PartMessage", IrcIdentity.DefaultPartMessage) + self.__rememberPosOnAway = Preferences.toBool( + settings.value("RememberAwayPosition", True)) + self.__awayMessage = settings.value("AwayMessage", IrcIdentity.DefaultAwayMessage) + self.__autoAway = Preferences.toBool(settings.value("AutoAway", False)) + self.__autoAwayTimeout = int(settings.value("AwayTimeout", 1)) + self.__autoReturn = Preferences.toBool(settings.value("AutoReturn", False)) def setName(self, name): """ @@ -210,6 +226,89 @@ """ return self.__partMessage + def setRememberAwayPosition(self, remember): + """ + Public method to set to remember the chat position upon AWAY. + + @param remember flag indicating to remember the chat position (boolean) + """ + self.__rememberPosOnAway = remember + + def rememberAwayPosition(self): + """ + Public method to get a flag indicating to remember the chat position upon AWAY. + + @return flag indicating to remember the chat position (boolean) + """ + return self.__rememberPosOnAway + + def setAwayMessage(self, message): + """ + Public method to set the AWAY message. + + @param message AWAY message (string) + """ + if message: + self.__awayMessage = message + else: + self.__awayMessage = IrcIdentity.DefaultAwayMessage + + def getAwayMessage(self): + """ + Public method to get the AWAY message. + + @return AWAY message (string) + """ + return self.__awayMessage + + def setAutoAway(self, on): + """ + Public method to set the auto away function. + + @param on flag indicating to enable the auto away function (boolean) + """ + self.__autoAway = on + + def autoAway(self): + """ + Public method to get the auto away flag. + + @return auto away flag (boolean) + """ + return self.__autoAway + + def setAutoAwayTimeout(self, minutes): + """ + Public method to set the auto away timeout. + + @param minutes auto away timeout in minutes (integer) + """ + self.__autoAwayTimeout = minutes + + def getAutoAwayTimeout(self): + """ + Public method to get the auto away timeout. + + @return auto away timeout in minutes (integer) + """ + return self.__autoAwayTimeout + + def setAutoReturn(self, on): + """ + Public method to set the auto return function. + + @param on flag indicating to enable the auto return function (boolean) + """ + self.__autoReturn = on + + def autoReturn(self): + """ + Public method to get the auto return flag. + + @return auto return flag (boolean) + """ + return self.__autoReturn + @classmethod def createDefaultIdentity(cls): """
--- a/Network/IRC/IrcWidget.py Sun Dec 02 15:54:15 2012 +0100 +++ b/Network/IRC/IrcWidget.py Sun Dec 02 18:52:03 2012 +0100 @@ -39,6 +39,7 @@ ServerConnected = 2 ServerConnecting = 3 + # TODO: Implement the Auto Away functionality def __init__(self, parent=None): """ Constructor @@ -140,7 +141,6 @@ @param connect flag indicating to connect (boolean) """ if connect: - # TODO: support SSL connection network = self.__ircNetworkManager.getNetwork(name) if network: self.__server = network.getServer()
--- a/Preferences/ConfigurationPages/IrcPage.py Sun Dec 02 15:54:15 2012 +0100 +++ b/Preferences/ConfigurationPages/IrcPage.py Sun Dec 02 18:52:03 2012 +0100 @@ -21,6 +21,7 @@ DateFormats = ["yyyy-MM-dd", "dd.MM.yyyy", "MM/dd/yyyy", "yyyy MMM. dd", "dd MMM. yyyy", "MMM. dd, yyyy"] + # TODO: add config entries for auto WHO def __init__(self): """ Constructor