summaryrefslogtreecommitdiff
path: root/evolution/change-view.py
blob: c00d3608503e477b26296b42d38a06b79d8998b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#
#  Linux Desktop Testing Project http://www.gnomebangalore.org/ldtp
#
#  Author:
#     Venkateswaran S <wenkat.s@gmail.com>
#
#  Copyright 2004 Novell, Inc.
#
#  This test script is free software; you can redistribute it and/or
#  modify it under the terms of the GNU Library General Public
#  License as published by the Free Software Foundation; either
#  version 2 of the License, or (at your option) any later version.
#
#  This library is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  Library General Public License for more details.
#
#  You should have received a copy of the GNU Library General Public
#  License along with this library; if not, write to the
#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
#  Boston, MA 02111-1307, USA.
#

#To change the properties of the folders

from ldtp import *
from ldtputils import *

def addcontacts(attendee,email,addrbook):
   log ('Add Attendees','teststart')
   try:

       windowname = 'dlgSelectContactsfromAddressBook'
       comboselect (windowname,'cboAddressBook',addrbook)
       remap ('evolution',windowname)
       attendee=attendee[0].split (':')
       email=email[0].split (':')
       if len(attendee)!=len(email):
           log ('Mismatch in contacts name and email','error')
           raise LdtpExecutionError (0)
       for ind in range(len(attendee)):
           try:
	       att=attendee[ind] + ' <'+ email[ind] + '>'
               selectrow (windowname,'tblContacts',att)
               time.sleep(2)
               click (windowname, 'btnAdd')
               time.sleep (1)
           except:
               log ('User not found','cause')
               raise LdtpExceptionError(0)
       click (windowname, 'btnClose')
       undoremap ('evolution',windowname)
   except:
       log ('Attendee Addition failed','error')
       log ('Add Attendees','testend')
       raise LdtpExecutionError (0)
   log ('Add Attendees','testend')


def read_data():

	data_object = LdtpDataFileParser (datafilename)
	
	#Extracting imput data from xml file
	read_msg_body_data = data_object.gettagvalue ('read_msg_body_data')[0]
	fldr = data_object.gettagvalue ('fldr')[0]
	share_type = data_object.gettagvalue ('share_type')[0]
	addr_book = data_object.gettagvalue ('addr_book')[0]
	contacts = data_object.gettagvalue ('contacts')
	emails = data_object.gettagvalue ('emails')
	#print read_msg_body_data, fldr, share_type, addr_book, contacts, emails
	return read_msg_body_data, fldr, share_type, addr_book, contacts, emails


log('Change Properties','teststart')
try:
	read_msg_body_data, fldr, share_type, addr_book, contacts, emails = read_data()
	windowname = 'dlgFolderProperties'
	#remap('evolution','frmEvolution-Mail')
	if selectrow ('frmEvolution-*','ttblMailFolderTree',fldr) == 1:
		time.sleep (3)
		selectmenuitem('frmEvolution-*','mnuFolder;mnuProperties')
		time.sleep(3)
		waittillguiexist (windowname)	
	
		if read_msg_body_data == 'uncheck':
			uncheck (windowname, 'chkCopyfoldercontentlocallyforofflineoperation')
		elif read_msg_body_data == 'check':
			check (windowname, 'chkCopyfoldercontentlocallyforofflineoperation')
		else:
			print 'Data not relevant'
			log('Check box status not set properly')
	
		if selecttab (windowname,'ptl0','Sharing') == 1:
			if share_type == 'shared_with':
				click (windowname, 'rbtnSharedWith')
				time.sleep(2)
				click(windowname,'btnContacts')		
				waittillguiexist('dlgSelectContactsfromAddressBook')
				time.sleep(2)
				addcontacts(contacts,emails,addr_book)				
				time.sleep(3)
				click(windowname,'btnAdd')
		time.sleep(3)
		click(windowname,'btnOK')
	else:
		print 'Unable to select the specified folder'

except:	
		print 'Unable to modify the properties'
		log('Unable to modify the properties of the folder'+fldr,'error')
		log('Change Properties','testend')
		raise LdtpExecutionError (0)
log('Change Properties','testend')