~vcs-imports/amigu/svn-trunk

« back to all changes in this revision

Viewing changes to amigu/apps/win/mail.py

  • Committer: fruiz
  • Date: 2009-05-05 15:48:52 UTC
  • Revision ID: vcs-imports@canonical.com-20090505154852-bk7r7o7uwh0hq3aj


M    amigu/apps/base.py
M    amigu/apps/win/settings.py
M    amigu/apps/win/webbrowser.py
M    amigu/apps/win/mail.py
M    amigu/gui/amigugtk.py
M    amigu/__init__.py
M    amigu/util/folder.py
M    amigu/computer/users/mswin.py
M    bin/amigu

Show diffs side-by-side

added added

removed removed

Lines of Context:
311
311
    def config_EVOLUTION_calendar(self):
312
312
        vcal = os.path.join(self.dest.path, _("Calendario"))
313
313
        old = None
 
314
        dates = []
314
315
        if os.path.exists(vcal):
315
316
            evo_cal = os.path.join(os.path.expanduser('~'),'.evolution','calendar','local','system','calendar.ics')
316
317
            folder(os.path.dirname(evo_cal))
322
323
                    for l in old_cal.readlines():
323
324
                        if l.find('END:VCALENDAR') == -1:
324
325
                            new_cal.write(l)
 
326
                        if l.find('DTSTART') != -1:
 
327
                            dates.append(l.replace('DTSTART:', ''))
325
328
                    old_cal.close()
326
329
            orig = open(vcal,"r")
327
330
            events = False
330
333
                new_cal.write('BEGIN:VCALENDAR\n')
331
334
                new_cal.write('CALSCALE:GREGORIAN\n')
332
335
                new_cal.write('VERSION:2.0\n')
 
336
            buffer = ''
333
337
            for l in orig.readlines():
 
338
                buffer += l
334
339
                if l.find('BEGIN:VEVENT') != -1:
335
 
                    events = True
336
 
                if events:
337
 
                    new_cal.write(l)
 
340
                    buffer = l
 
341
                    repeated = False
 
342
                elif l.find('END:VEVENT') != -1:
 
343
                    if not repeated:
 
344
                        new_cal.write(buffer)
 
345
                elif l.find('DTSTART') != -1:
 
346
                    repeated = l.replace('DTSTART:', '') in dates
 
347
                elif l.find('SUMMARY') != -1:
 
348
                    #repeated = l.replace('SUMMARY:', '') in dates
 
349
                    pass
 
350
                
338
351
            new_cal.write('END:VCALENDAR\n')
339
352
            orig.close()
340
353
            os.remove(vcal)
602
615
                continue
603
616
            else:
604
617
                configs.append(c)
605
 
            mb = folder(os.path.join(os.path.dirname(key), 'Inbox'), False)
 
618
            mb = folder(os.path.dirname(key), False)
606
619
            if mb.path:
607
620
                self.mailboxes.append(mb)
608
621
        return configs
609
622
 
610
623
    def convert_mailbox(self, mb):
611
 
        eml2mbox(mb.path, os.path.join(self.dest.path, mb.path.split('/')[-2]))
 
624
        eml2mbox(mb.path, os.path.join(self.dest.path, mb.path.split('/')[-1]))
612
625
        
613
626
    def import_calendar(self):
614
627
        pass
748
761
    except: 
749
762
        return 0
750
763
    for e in os.listdir(emlpath):
751
 
        if os.path.splitext(e)[-1] == '.eml':
 
764
        if os.path.isdir(os.path.join(emlpath, e)):
 
765
            new = folder(mbxpath+'.sbd')
 
766
            eml2mbox(os.path.join(emlpath, e), os.path.join(new.path, e))
 
767
        elif os.path.splitext(e)[-1] == '.eml':
752
768
            try:
753
769
                m = open(os.path.join(emlpath, e),'r')
754
770
                content = m.readlines()