[Commits] (morgen) You may now load in account settings from an external parcel, and they will over

commits at osafoundation.org commits at osafoundation.org
Mon Oct 25 16:59:44 PDT 2004


Commit by: morgen
Modified files:
chandler/application/dialogs/AccountPreferences.py 1.17 1.18
chandler/parcels/osaf/contentmodel/mail/parcel.xml 1.65 1.66
chandler/parcels/osaf/framework/sharing/Sharing.py 1.26 1.27
chandler/parcels/osaf/framework/webdav/parcel.xml 1.5 1.6
chandler/parcels/osaf/mail/imap.py 1.29 1.30
chandler/parcels/osaf/mail/smtp.py 1.17 1.18
chandler/parcels/osaf/views/main/Main.py 1.88 1.89

Log message:
You may now load in account settings from an external parcel, and they will over
ride the (empty) default accounts.



ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/application/dialogs/AccountPreferences.py.diff?r1=text&tr1=1.17&r2=text&tr2=1.18
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/contentmodel/mail/parcel.xml.diff?r1=text&tr1=1.65&r2=text&tr2=1.66
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/sharing/Sharing.py.diff?r1=text&tr1=1.26&r2=text&tr2=1.27
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/webdav/parcel.xml.diff?r1=text&tr1=1.5&r2=text&tr2=1.6
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/mail/imap.py.diff?r1=text&tr1=1.29&r2=text&tr2=1.30
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/mail/smtp.py.diff?r1=text&tr1=1.17&r2=text&tr2=1.18
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/views/main/Main.py.diff?r1=text&tr1=1.88&r2=text&tr2=1.89

Index: chandler/parcels/osaf/views/main/Main.py
diff -u chandler/parcels/osaf/views/main/Main.py:1.88 chandler/parcels/osaf/views/main/Main.py:1.89
--- chandler/parcels/osaf/views/main/Main.py:1.88	Sun Oct 24 16:17:56 2004
+++ chandler/parcels/osaf/views/main/Main.py	Mon Oct 25 16:59:42 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.88 $"
-__date__ = "$Date: 2004/10/24 23:17:56 $"
+__version__ = "$Revision: 1.89 $"
+__date__ = "$Date: 2004/10/25 23:59:42 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -13,7 +13,7 @@
 import osaf.contentmodel.mail.Mail as Mail
 from application.SplashScreen import SplashScreen
 from application.Parcel import Manager as ParcelManager
-from osaf.mail.imap import IMAPDownloader
+import osaf.mail.imap
 import osaf.contentmodel.contacts.Contacts as Contacts
 import osaf.contentmodel.tests.GenerateItems as GenerateItems
 import osaf.framework.sharing.Sharing as Sharing
@@ -23,7 +23,6 @@
 import osaf.mail.sharing as MailSharing
 
 
-
 class MainView(View):
     """
       Main Chandler view contains event handlers for Chandler
@@ -303,11 +302,10 @@
             else:
                 return
 
-        account = \
-         Globals.repository.findPath('//parcels/osaf/mail/IMAPAccountOne')
+        account = osaf.mail.imap.getIMAPAccount()
 
         Globals.repository.commit()
-        IMAPDownloader (account).getMail()
+        osaf.mail.imap.IMAPDownloader (account).getMail()
         Globals.repository.refresh()
 
     def onLogRepositoryHistoryEvent(self, notification):

Index: chandler/parcels/osaf/mail/imap.py
diff -u chandler/parcels/osaf/mail/imap.py:1.29 chandler/parcels/osaf/mail/imap.py:1.30
--- chandler/parcels/osaf/mail/imap.py:1.29	Sun Oct 24 17:24:07 2004
+++ chandler/parcels/osaf/mail/imap.py	Mon Oct 25 16:59:40 2004
@@ -1,5 +1,5 @@
-__revision__  = "$Revision: 1.29 $"
-__date__      = "$Date: 2004/10/25 00:24:07 $"
+__revision__  = "$Revision: 1.30 $"
+__date__      = "$Date: 2004/10/25 23:59:40 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__   = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -514,7 +514,7 @@
         NotifyUIAsync(self.downloadedStr, self.__printInfo)
         self.downloadedStr = None
 
-        assert self.itsView.isRefCounted(), "not refcounting doesn't make sense"
+        # assert self.itsView.isRefCounted(), "not refcounting doesn't make sense"
         self.account = None
 
     def _expunge(self, result):
@@ -545,7 +545,7 @@
     def __getAccount(self):
 
         self.account = getIMAPAccount(self.accountUUID)
-        assert self.itsView.isRefCounted(), "not refcounting doesn't make sense"
+        # assert self.itsView.isRefCounted(), "not refcounting doesn't make sense"
 
     def __printInfo(self, info):
 
@@ -586,7 +586,8 @@
     else:
         for acc in Query.KindQuery().run([accountKind]):
             account = acc
-            break
+            if account.isDefault:
+                break
 
     if account is None:
         message = _("No IMAP Account exists in Repository")

Index: chandler/parcels/osaf/contentmodel/mail/parcel.xml
diff -u chandler/parcels/osaf/contentmodel/mail/parcel.xml:1.65 chandler/parcels/osaf/contentmodel/mail/parcel.xml:1.66
--- chandler/parcels/osaf/contentmodel/mail/parcel.xml:1.65	Mon Oct 25 16:48:35 2004
+++ chandler/parcels/osaf/contentmodel/mail/parcel.xml	Mon Oct 25 16:59:39 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.65 $ -->
-<!-- $Date: 2004/10/25 23:48:35 $ -->
+<!-- $Revision: 1.66 $ -->
+<!-- $Date: 2004/10/25 23:59:39 $ -->
 <!-- Copyright (c) 2003-2004 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -143,6 +143,12 @@
             <redirectTo value="replyToAddress.fullName" />
         </Attribute>
 
+        <Attribute itsName="isDefault">
+            <issues value="This is a temporary attribute that will be removed once we rethink which item represents the notion of 'Me'." />
+            <type itemref="Boolean" />
+            <initialValue type="Boolean" value="False"/>
+        </Attribute>
+
     </Kind>
 
     <Kind itsName="SMTPAccount">
@@ -176,6 +182,12 @@
             <initialValue />
         </Attribute>
 
+        <Attribute itsName="isDefault">
+            <issues value="This is a temporary attribute that will be removed once we rethink which item represents the notion of 'Me'." />
+            <type itemref="Boolean" />
+            <initialValue type="Boolean" value="False"/>
+        </Attribute>
+
     </Kind>
 
     <Kind itsName="MailDeliveryError">

Index: chandler/parcels/osaf/mail/smtp.py
diff -u chandler/parcels/osaf/mail/smtp.py:1.17 chandler/parcels/osaf/mail/smtp.py:1.18
--- chandler/parcels/osaf/mail/smtp.py:1.17	Sun Oct 24 17:24:07 2004
+++ chandler/parcels/osaf/mail/smtp.py	Mon Oct 25 16:59:40 2004
@@ -1,5 +1,5 @@
-__revision__  = "$Revision: 1.17 $"
-__date__      = "$Date: 2004/10/25 00:24:07 $"
+__revision__  = "$Revision: 1.18 $"
+__date__      = "$Date: 2004/10/25 23:59:40 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__   = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -526,7 +526,8 @@
         """Get the first SMTP Account"""
         for acc in Query.KindQuery().run([accountKind]):
             account = acc
-            break
+            if account.isDefault:
+                break
 
     if account is None:
         raise SMTPException("No SMTP Account found")

Index: chandler/application/dialogs/AccountPreferences.py
diff -u chandler/application/dialogs/AccountPreferences.py:1.17 chandler/application/dialogs/AccountPreferences.py:1.18
--- chandler/application/dialogs/AccountPreferences.py:1.17	Fri Oct 22 14:20:53 2004
+++ chandler/application/dialogs/AccountPreferences.py	Mon Oct 25 16:59:38 2004
@@ -230,10 +230,35 @@
         repo.refresh()
 
         accountIndex = 0 # which account to select first
-        accountKind = application.Globals.parcelManager.lookup(MAIL_MODEL, "AccountBase")
+        imapAccountKind = application.Globals.parcelManager.lookup(MAIL_MODEL, "IMAPAccount")
+        smtpAccountKind = application.Globals.parcelManager.lookup(MAIL_MODEL, "SMTPAccount")
         webDavAccountKind = application.Globals.parcelManager.lookup(WEBDAV_MODEL, "WebDAVAccount")
+
+        accounts = []
+
+        imapAccount = None
+        for item in KindQuery().run([imapAccountKind]):
+            imapAccount = item
+            if item.isDefault:
+                break
+        accounts.append(imapAccount)
+
+        smtpAccount = None
+        for item in KindQuery().run([smtpAccountKind]):
+            smtpAccount = item
+            if item.isDefault:
+                break
+        accounts.append(smtpAccount)
+
+        webdavAccount = None
+        for item in KindQuery().run([webDavAccountKind]):
+            webdavAccount = item
+            if item.isDefault:
+                break
+        accounts.append(webdavAccount)
+
         i = 0
-        for item in KindQuery().run([accountKind, webDavAccountKind]):
+        for item in accounts:
             if account == item:
                 accountIndex = i
             values = { }

Index: chandler/parcels/osaf/framework/sharing/Sharing.py
diff -u chandler/parcels/osaf/framework/sharing/Sharing.py:1.26 chandler/parcels/osaf/framework/sharing/Sharing.py:1.27
--- chandler/parcels/osaf/framework/sharing/Sharing.py:1.26	Wed Oct 20 12:23:05 2004
+++ chandler/parcels/osaf/framework/sharing/Sharing.py	Mon Oct 25 16:59:39 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.26 $"
-__date__ = "$Date: 2004/10/20 19:23:05 $"
+__version__ = "$Revision: 1.27 $"
+__date__ = "$Date: 2004/10/25 23:59:39 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -7,6 +7,7 @@
 import application.Parcel
 import osaf.framework.webdav.Dav
 import osaf.mail.message
+import osaf.mail.imap
 from chandlerdb.util.UUID import UUID
 import application.dialogs.PublishCollection
 from repository.item.Query import KindQuery
@@ -15,6 +16,7 @@
 SHARING = "http://osafoundation.org/parcels/osaf/framework/sharing"
 EVENTS = "http://osafoundation.org/parcels/osaf/framework/blocks/Events"
 CONTENT = "http://osafoundation.org/parcels/osaf/contentmodel"
+WEBDAV_MODEL = "http://osafoundation.org/parcels/osaf/framework/webdav"
 
 class Parcel(application.Parcel.Parcel):
 
@@ -145,24 +147,34 @@
     return None
 
 def getWebDavPath():
-    acct = Globals.parcelManager.lookup(SHARING, 'WebDAVAccount')
-    if acct.host:
+    acct = getWebDavAccount()
+    if acct and acct.host:
         return "http://%s/%s" % (acct.host, acct.path)
     else:
         return None
 
 def getWebDavAccount():
+    webDavAccountKind = application.Globals.parcelManager.lookup(WEBDAV_MODEL,
+     "WebDAVAccount")
+
+    account = None
+    for item in KindQuery().run([webDavAccountKind]):
+        account = item
+        if item.isDefault:
+            break
+    return account
+
     return Globals.parcelManager.lookup(SHARING, 'WebDAVAccount')
 
 def isMailSetUp():
 
     # Find imap account, and make sure email address is valid
-    imap = Globals.repository.findPath("//parcels/osaf/mail/IMAPAccountOne")
+    imap = osaf.mail.imap.getIMAPAccount()
     if not imap.emailAddress:
         return False
 
     # Find smtp account, and make sure server field is set
-    smtp = Globals.repository.findPath("//parcels/osaf/mail/SMTPAccountOne")
+    smtp = imap.defaultSMTPAccount
     if not smtp.host:
         return False
 

Index: chandler/parcels/osaf/framework/webdav/parcel.xml
diff -u chandler/parcels/osaf/framework/webdav/parcel.xml:1.5 chandler/parcels/osaf/framework/webdav/parcel.xml:1.6
--- chandler/parcels/osaf/framework/webdav/parcel.xml:1.5	Thu Sep 23 14:39:18 2004
+++ chandler/parcels/osaf/framework/webdav/parcel.xml	Mon Oct 25 16:59:40 2004
@@ -67,6 +67,13 @@
             <initialValue type="String" value="WebDAV" />
         </Attribute>
 
+        <Attribute itsName="isDefault">
+            <issues value="This is a temporary attribute that will be removed once we rethink which item represents the notion of 'Me'." />
+            <type itemref="Boolean" />
+            <initialValue type="Boolean" value="False"/>
+        </Attribute>
+
+
     </Kind>
 
 </Parcel>



More information about the Commits mailing list