diff options
Diffstat (limited to 'evolution/account-setup.py')
-rw-r--r-- | evolution/account-setup.py | 209 |
1 files changed, 119 insertions, 90 deletions
diff --git a/evolution/account-setup.py b/evolution/account-setup.py index 1075ae0..39d216c 100644 --- a/evolution/account-setup.py +++ b/evolution/account-setup.py @@ -1,9 +1,10 @@ #!/usr/bin/python # -# Linux Desktop Testing Project http://www.gnomebangalore.org/ldtp +# Linux Desktop Testing Project http://ldtp.freedesktop.org # # Author: # A. Nagappan <anagappan@novell.com> +# Prashanth Mohan <prashmohan@gmail.com> # # Copyright 2004 - 2005, Novell, Inc. # @@ -25,24 +26,18 @@ from ldtp import * from ldtputils import * +from evoutils import * from evoutils.password import * import time + class EvolutionAccountSetup: def create_new_account (self): """ Create a new account This function is applicable only when already some accounts are configured """ - window_id = '' - if guiexist ('frmEvolution-Mail') == 1: - window_id = 'frmEvolution-Mail' - elif guiexist ('frmEvolution-Calendars') == 1: - window_id = 'frmEvolution-Calendars' - elif guiexist ('frmEvolution-Tasks') == 1: - window_id = 'frmEvolution-Tasks' - elif guiexist ('frmEvolution-Contacts') == 1: - window_id = 'frmEvolution-Contacts' + window_id = get_window() if window_id != '': selectmenuitem (window_id, 'mnuEdit;mnuPreferences') else: @@ -50,10 +45,10 @@ class EvolutionAccountSetup: raise LdtpExecutionError (0) # Wait till the gui appears - waittillguiexist ('dlgEvolutionSettings') + waittillguiexist ('dlgEvolutionPreferences') # Select mail accounts tab - selecttab ('dlgEvolutionSettings', 'ptl0', 'Mail Accounts') - click ('dlgEvolutionSettings', 'btnAdd') + selecttab ('dlgEvolutionPreferences', 'ptl0', 'Mail Accounts') + click ('dlgEvolutionPreferences', 'btnAdd') def enter_identify_info (self, xmlfilename): account_setup_xml = LdtpDataFileParser (xmlfilename) @@ -90,27 +85,27 @@ class EvolutionAccountSetup: log ('Forward button not enabled', 'error') raise LdtpExecutionError (0) - def configure_imap_receiving_mail (self, xmlfilename): + def configure_receiving_mail (self, xmlfilename): receiving_mail_xml = LdtpDataFileParser (xmlfilename) - server_name = receiving_mail_xml.gettagvalue ('imapserver') + server_name = receiving_mail_xml.gettagvalue ('mailserver') if server_name != []: settextvalue ('frmEvolutionAccountAssistant', 'txtServer', server_name[0]) else: log ('Imap server name missing', 'error') raise LdtpExecutionError (0) - user_name = receiving_mail_xml.gettagvalue ('imapusername') + user_name = receiving_mail_xml.gettagvalue ('username') if user_name != []: settextvalue ('frmEvolutionAccountAssistant', 'txtUsername', user_name[0]) else: log ('Username missing', 'error') raise LdtpExecutionError (0) - secure_connection = receiving_mail_xml.gettagvalue ('imapsecureconnection') + secure_connection = receiving_mail_xml.gettagvalue ('secureconnection') if secure_connection != []: comboselect ('frmEvolutionAccountAssistant', 'cboUseSecureConnection', secure_connection[0]) - password_type = receiving_mail_xml.gettagvalue ('imappasswordtype') - if password_type != []: - comboselect ('frmEvolutionAccountAssistant', 'cboPassword', password_type[0]) - remember_password = receiving_mail_xml.gettagvalue ('imaprememberpassword') + auth_type = receiving_mail_xml.gettagvalue ('authtype') + if auth_type != []: + comboselect ('frmEvolutionAccountAssistant', 'cboPassword', auth_type[0]) + remember_password = receiving_mail_xml.gettagvalue ('rememberpassword') if remember_password != []: if remember_password[0] == '1': check ('frmEvolutionAccountAssistant', 'chkRememberpassword') @@ -124,6 +119,41 @@ class EvolutionAccountSetup: log ('Forward button not enabled', 'error') raise LdtpExecutionError (0) + def pop_receiving_options (self, xmlfilename): + receiving_options_xml = LdtpDataFileParser (xmlfilename) + check_mail = receiving_options_xml.gettagvalue ('checkmail') + if check_mail != []: + if check_mail[0] == '1': + check ('frmEvolutionAccountAssistant', 'chkAutomaticallycheckfornewmailevery') + mail_check_interval = receiving_options_xml.gettagvalue ('mailcheckinterval') + if mail_check_interval != []: + setvalue ('frmEvolutionAccountAssistant', 'sbtn0', mail_check_interval[0]) + else: + uncheck ('frmEvolutionAccountAssistant', 'chkAutomaticallycheckfornewmailevery') + + leave_msg = receiving_options_xml.gettagvalue ('leavemessageonserver') + if leave_msg != []: + if leave_msg[0] == '1': + check ('frmEvolutionAccountAssistant', 'chkLeavemessagesonserver') + else: + uncheck ('frmEvolutionAccountAssistant', 'chkLeavemessagesonserver') + + time.sleep (1) + disable_extn = receiving_options_xml.gettagvalue ('disablesupportforextn') + if disable_extn != []: + if disable_extn[0] == '1': + check ('frmEvolutionAccountAssistant', 'chkDisablesupportforallPOP3extensions') + else: + uncheck ('frmEvolutionAccountAssistant', 'chkDisablesupportforallPOP3extensions') + time.sleep (1) + # click forward button to move to next page + if stateenabled ('frmEvolutionAccountAssistant', 'btnForward') == 1: + click ('frmEvolutionAccountAssistant', 'btnForward') + else: + log ('Forward button not enabled', 'error') + raise LdtpExecutionError (0) + + def imap_receiving_options (self, xmlfilename): receiving_options_xml = LdtpDataFileParser (xmlfilename) check_mail = receiving_options_xml.gettagvalue ('checkmail') @@ -144,9 +174,9 @@ class EvolutionAccountSetup: use_custom_cmd = receiving_options_xml.gettagvalue ('usecustomcommand') if use_custom_cmd != []: if use_custom_cmd[0] == '1': - check ('frmEvolutionAccountAssistant', 'chkUsecustomtoconnecttoserver') + check ('frmEvolutionAccountAssistant', 'chkUsecustomcommandtoconnecttoserver') else: - uncheck ('frmEvolutionAccountAssistant', 'chkUsecustomtoconnecttoserver') + uncheck ('frmEvolutionAccountAssistant', 'chkUsecustomcommandtoconnecttoserver') custom_cmd = receiving_options_xml.gettagvalue ('customcommand') if custom_cmd != []: settextvalue ('frmEvolutionAccountAssistant', 'txt0', custom_cmd[0]) @@ -219,7 +249,7 @@ class EvolutionAccountSetup: if secure_connection != []: comboselect ('frmEvolutionAccountAssistant', 'cboUseSecureConnection1', secure_connection[0]) - password_type = sending_mail_xml.gettagvalue ('stmppasswordtype') + password_type = sending_mail_xml.gettagvalue ('stmpauthtype') if password_type != []: comboselect ('frmEvolutionAccountAssistant', 'cboType', password_type[0]) @@ -395,7 +425,7 @@ class EvolutionAccountSetup: raise LdtpExecutionError (0) # Script execution starts here... -first_time_acct_setup = False +#first_time_acct_setup = False try: try: @@ -404,118 +434,117 @@ try: AcctSetup = EvolutionAccountSetup () # First time account setup dialog title name is different - setcontext ('Evolution Account Assistant', 'Evolution Setup Assistant') - if guiexist ('frmEvolutionAccountAssistant') == 1: - #do remap - remap ('evolution', 'frmEvolutionAccountAssistant') - first_time_acct_setup = True - else: - releasecontext () - - # Needs to be done only when we have already accounts configured - AcctSetup.create_new_account () - time.sleep (1) + #setcontext ('Evolution Account Assistant', 'Evolution Setup Assistant') + +# if guiexist ('frmEvolutionAccountAssistant') == 1: +# #do remap +# #remap ('evolution', 'frmEvolutionAccountAssistant') +# first_time_acct_setup = True +# else: +# # Needs to be done only when we have already accounts configured + AcctSetup.create_new_account () + time.sleep (1) AcctSetup.enter_identify_info (datafilename) time.sleep (1) - if first_time_acct_setup == True: - # Undo remap - undoremap ('evolution', 'frmEvolutionAccountAssistant') - + remap ('evolution','frmEvolutionAccountAssistant') recv_type = config_acct_xml.gettagvalue ('recvservertype') if recv_type != []: comboselect ('frmEvolutionAccountAssistant', 'cboServerType', recv_type[0]) - if recv_type[0] == 'IMAP': - time.sleep (2) - # do remap - remap ('evolution', 'frmEvolutionAccountAssistant') - log ('Executing imap receiving mail configuration', 'info') - AcctSetup.configure_imap_receiving_mail (datafilename) - time.sleep (1) + remap ('evolution','frmEvolutionAccountAssistant') + #if recv_type[0] == 'IMAP' or recv_type[0] == 'POP': + time.sleep (2) + log ('Executing receiving mail configuration', 'info') + AcctSetup.configure_receiving_mail (datafilename) + time.sleep (1) + + log ('Executing receiving options configuration', 'info') + AcctSetup.imap_receiving_options (datafilename) + time.sleep (1) - log ('Executing imap receiving options configuration', 'info') - AcctSetup.imap_receiving_options (datafilename) - time.sleep (1) + # Undo remap - # Undo remap - undoremap ('evolution', 'frmEvolutionAccountAssistant') - elif recv_type[0] == 'Microsoft Exchange': - time.sleep (2) - # do remap - remap ('evolution', 'frmEvolutionAccountAssistant') - log ('Executing Microsoft Exchange receiving mail configuration', 'info') - AcctSetup.configure_exchange_receiving_mail (datafilename) - time.sleep (1) +# elif recv_type[0] == 'Microsoft Exchange': +# time.sleep (2) +# # do remap +# remap ('evolution', 'frmEvolutionAccountAssistant') +# log ('Executing Microsoft Exchange receiving mail configuration', 'info') +# AcctSetup.configure_exchange_receiving_mail (datafilename) +# time.sleep (1) - log ('Executing Microsoft Exchange receiving options configuration', 'info') - AcctSetup.exchange_receiving_options (datafilename) - time.sleep (1) +# log ('Executing Microsoft Exchange receiving options configuration', 'info') +# AcctSetup.exchange_receiving_options (datafilename) +# time.sleep (1) - # Undo remap - undoremap ('evolution', 'frmEvolutionAccountAssistant') +# # Undo remap +# undoremap ('evolution', 'frmEvolutionAccountAssistant') time.sleep (1) # do remap remap ('evolution', 'frmEvolutionAccountAssistant') - send_type = config_acct_xml.gettagvalue ('sendservertype') if send_type != []: comboselect ('frmEvolutionAccountAssistant', 'cboServerType1', send_type[0]) if send_type[0] == 'SMTP': AcctSetup.configure_smtp (datafilename) time.sleep (1) - + AcctSetup.set_account_name (datafilename) time.sleep (1) - if first_time_acct_setup == True: - AcctSetup.select_time_zone (datafilename) +# if first_time_acct_setup == True: +# AcctSetup.select_time_zone (datafilename) AcctSetup.apply_changes () + waittillguinotexist ('frmEvolutionAccountAssistant') # Undo remap - undoremap ('evolution', 'frmEvolutionAccountAssistant') + #undoremap ('evolution', 'frmEvolutionAccountAssistant') - if first_time_acct_setup == True: - releasecontext () - else: - click ('dlgEvolutionSettings', 'btnClose') +# if first_time_acct_setup == True: +# releasecontext () +# else: + click ('dlgEvolutionPreferences', 'btnClose') + waittillguinotexist ('dlgEvolutionPreferences') except error, msg: log ('' + str (msg), 'error') try: time.sleep (1) click ('frmEvolutionAccountAssistant', 'btnCancel') - if first_time_acct_setup == True: - releasecontext () - else: - click ('dlgEvolutionSettings', 'btnClose') +# if first_time_acct_setup == True: +# releasecontext () +# else: + click ('dlgEvolutionPreferences', 'btnClose') raise LdtpExecutionError (0) except error, msg: log ('' + str (msg), 'error') raise LdtpExecutionError (0) acct_name = config_acct_xml.gettagvalue ('accountname') - setcontext ('Enter password','Enter Password for '+acct_name[0]) - if waittillguiexist ('dlgEnterpassword')!=1: + click ('frmEvolution-*', 'btnSend/Receive') + waittillguiexist ('dlgSend&ReceiveMail') + passwd_dlg = '*EnterPasswordfor*' + if waittillguiexist (passwd_dlg)!=1: log ('Password remainder window did not come up','warning') #raise LdtpExecutionError (0) else: password = config_acct_xml.gettagvalue ('password') if password != []: - settextvalue ('dlgEnterpassword','txt0',password[0]) - check ('dlgEnterpassword','chkRememberthispassword') - click ('dlgEnterpassword','btnOK') + settextvalue (passwd_dlg,'txt0',password[0]) + check (passwd_dlg,'chkRememberthispassword') + click (passwd_dlg,'btnOK') else: - click ('dlgEnterpassword','btnCancel') + click (passwd_dlg,'btnCancel') time.sleep (2) - if guiexist ('dlgEnterpassword')==1: - click ('dlgEnterpassword','btnCancel') - releasecontext() + if guiexist (passwd_dlg)==1: + click (passwd_dlg,'btnCancel') + except LdtpExecutionError: - if first_time_acct_setup == True: - releasecontext () - else: - click ('dlgEvolutionSettings', 'btnClose') +# if first_time_acct_setup == True: +# releasecontext () +# else: + click ('dlgEvolutionPreferences', 'btnClose') + waittillguinotexist ('dlgEvolutionPreferences') log ('Account setup', 'fail') log ('Account setup', 'testend') raise LdtpExecutionError (0) |