[haiku-commits] BRANCH axeld-github.imap - src/add-ons/mail_daemon/inbound_protocols/imap

  • From: axeld-github.imap <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 18 Jan 2013 11:15:54 +0100 (CET)

added 2 changesets to branch 'refs/remotes/axeld-github/imap'
old head: 637d9274475e51fbd807b58623954c5a8e37436e
new head: 9f59320a95d055e53d866fc0709f532e2c14a56a
overview: https://github.com/axeld/haiku/compare/637d927...9f59320

----------------------------------------------------------------------------

05cdc8b: IMAP: fixed folder configuration.
  
  * Store the settings, don't archive the view; removed leftovers of the
    old settings API.

9f59320: IMAP: close folder config window on error, show message.

                                   [ Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

2 files changed, 20 insertions(+), 6 deletions(-)
.../inbound_protocols/imap/ConfigView.cpp          |  8 +++++---
.../inbound_protocols/imap/FolderConfigWindow.cpp  | 18 +++++++++++++++---

############################################################################

Commit:      05cdc8b8c497eebc0a8d5bee239b9492bc323960
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Fri Jan 18 10:00:12 2013 UTC

IMAP: fixed folder configuration.

* Store the settings, don't archive the view; removed leftovers of the
  old settings API.

----------------------------------------------------------------------------

diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/ConfigView.cpp 
b/src/add-ons/mail_daemon/inbound_protocols/imap/ConfigView.cpp
index 6cfaf45..745642d 100644
--- a/src/add-ons/mail_daemon/inbound_protocols/imap/ConfigView.cpp
+++ b/src/add-ons/mail_daemon/inbound_protocols/imap/ConfigView.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2012, Haiku, Inc. All rights reserved.
+ * Copyright 2001-2013, Haiku, Inc. All rights reserved.
  * Copyright 2001-2002 Dr. Zoidberg Enterprises. All rights reserved.
  * Copyright 2011, Clemens Zeidler <haiku@xxxxxxxxxxxxxxxxxx>
  *
@@ -110,8 +110,10 @@ ConfigView::MessageReceived(BMessage* message)
        switch (message->what) {
                case kMsgOpenIMAPFolder:
                {
-                       BMessage settings;
-                       Archive(&settings);
+                       // Retrieve current settings
+                       BMailAddOnSettings settings;
+                       SaveInto(settings);
+
                        BWindow* window = new 
FolderConfigWindow(Window()->Frame(),
                                settings);
                        window->Show();

############################################################################

Commit:      9f59320a95d055e53d866fc0709f532e2c14a56a
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Fri Jan 18 10:02:11 2013 UTC

IMAP: close folder config window on error, show message.

----------------------------------------------------------------------------

diff --git 
a/src/add-ons/mail_daemon/inbound_protocols/imap/FolderConfigWindow.cpp 
b/src/add-ons/mail_daemon/inbound_protocols/imap/FolderConfigWindow.cpp
index 7e52032..ded5472 100644
--- a/src/add-ons/mail_daemon/inbound_protocols/imap/FolderConfigWindow.cpp
+++ b/src/add-ons/mail_daemon/inbound_protocols/imap/FolderConfigWindow.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011, Haiku, Inc. All rights reserved.
+ * Copyright 2011-2013, Haiku, Inc. All rights reserved.
  * Copyright 2011, Clemens Zeidler <haiku@xxxxxxxxxxxxxxxxxx>
  * Distributed under the terms of the MIT License.
  */
@@ -7,6 +7,7 @@
 
 #include "FolderConfigWindow.h"
 
+#include <Alert.h>
 #include <Button.h>
 #include <Catalog.h>
 #include <ControlLook.h>
@@ -202,7 +203,6 @@ EditListView::EditListView(const char* name, list_view_type 
type, uint32 flags)
        BListView(name, type, flags),
        fLastMouseDown(NULL)
 {
-
 }
 
 
@@ -315,7 +315,19 @@ FolderConfigWindow::_LoadFolders()
        status_t status = fProtocol.Connect(fSettings.ServerAddress(),
                fSettings.Username(), fSettings.Password(), fSettings.UseSSL());
        if (status != B_OK) {
-               // TODO: show error message
+               statusWindow->PostMessage(B_QUIT_REQUESTED);
+
+               // Show error message on screen
+               BString message = B_TRANSLATE("Could not connect to server "
+                       "\"%server%\":\n%error%");
+               message.ReplaceFirst("%server%", fSettings.Server());
+               message.ReplaceFirst("%error%", strerror(status));
+               BAlert* alert = new BAlert("IMAP error", message.String(),
+                       B_TRANSLATE("Ok"), NULL, NULL, B_WIDTH_AS_USUAL, 
B_STOP_ALERT);
+               alert->Go();
+
+               PostMessage(B_QUIT_REQUESTED);
+               return;
        }
 
        // TODO: don't get all of them at once, but retrieve them level by level


Other related posts: