[haiku-commits] r40978 - haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap

  • From: clemens.zeidler@xxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 16 Mar 2011 21:01:28 +0100 (CET)

Author: czeidler
Date: 2011-03-16 21:01:28 +0100 (Wed, 16 Mar 2011)
New Revision: 40978
Changeset: http://dev.haiku-os.org/changeset/40978
Ticket: http://dev.haiku-os.org/ticket/7258

Modified:
   
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolderConfig.cpp
   haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolderConfig.h
   haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/Jamfile
Log:
Hacked in a "used storage on server" status string in the IMAP folder window.

The complete window need some love so do not complain at this stage, feel free 
to fix it, though :-) (Main problem is to add a cancel button to abort the 
folder fetch and show an error message, see #7258).



Modified: 
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolderConfig.cpp
===================================================================
--- 
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolderConfig.cpp 
    2011-03-16 19:50:53 UTC (rev 40977)
+++ 
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolderConfig.cpp 
    2011-03-16 20:01:28 UTC (rev 40978)
@@ -12,7 +12,8 @@
 #include <SpaceLayoutItem.h>
 #include <StringView.h>
 
-#include "ALMLayout.h"
+#include <ALMLayout.h>
+#include <StringForSize.h>
 
 #include <crypt.h>
 
@@ -229,7 +230,7 @@
 
 FolderConfigWindow::FolderConfigWindow(BRect parent, const BMessage& settings)
        :
-       BWindow(BRect(0, 0, 250, 300), "IMAP Folders", B_TITLED_WINDOW_LOOK,
+       BWindow(BRect(0, 0, 300, 300), "IMAP Folders", B_TITLED_WINDOW_LOOK,
                B_MODAL_APP_WINDOW_FEEL, B_NO_WORKSPACE_ACTIVATION | 
B_NOT_ZOOMABLE
                        | B_AVOID_FRONT),
        fSettings(settings)
@@ -248,12 +249,17 @@
                B_SIZE_UNLIMITED));
        fApplyButton = new BButton("Apply", "Apply", new 
BMessage(kMsgApplyButton));
 
+       fQuotaView = new BStringView("quota view",
+               "Failed to fetch available storage.");
+       fQuotaView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
+               B_ALIGN_VERTICAL_CENTER));
+
        layout->AddView(fFolderListView, layout->Left(), layout->Top(),
                layout->Right(), layout->Bottom());
 
-       GroupItem item = GroupItem(fFolderListView)
-                       / (GroupItem(BSpaceLayoutItem::CreateGlue())
-                               | GroupItem(fApplyButton));
+       GroupItem item = GroupItem(fQuotaView) / GroupItem(fFolderListView)
+               / (GroupItem(BSpaceLayoutItem::CreateGlue())
+                       | GroupItem(fApplyButton));
        layout->BuildLayout(item);
 
        PostMessage(kMsgInit);
@@ -311,6 +317,7 @@
        }
 
        fIMAPFolders.Connect(server, username, password, useSSL);
+       fFolderList.clear();
        fIMAPFolders.GetFolders(fFolderList);
        for (unsigned int i = 0; i < fFolderList.size(); i++) {
                FolderInfo& info = fFolderList[i];
@@ -318,6 +325,18 @@
                fFolderListView->AddItem(item);
                item->SetListView(fFolderListView);
        }
+
+       double used, total;
+       if (fIMAPFolders.GetQuota(used, total) == B_OK) {
+               char buffer[256];
+               BString quotaString = "Server storage: ";
+               quotaString += string_for_size(used, buffer, 256);
+               quotaString += " / ";
+               quotaString += string_for_size(total, buffer, 256);
+               quotaString += " used.";
+               fQuotaView->SetText(quotaString);
+       }
+
        status->PostMessage(B_QUIT_REQUESTED);
 }
 

Modified: 
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolderConfig.h
===================================================================
--- 
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolderConfig.h   
    2011-03-16 19:50:53 UTC (rev 40977)
+++ 
haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolderConfig.h   
    2011-03-16 20:01:28 UTC (rev 40978)
@@ -9,6 +9,7 @@
 
 #include <Button.h>
 #include <ListView.h>
+#include <StringView.h>
 #include <Window.h>
 
 #include <MailSettings.h>
@@ -32,6 +33,8 @@
                        BButton*                        fApplyButton;
        const   BMessage                        fSettings;
                        FolderList                      fFolderList;
+
+                       BStringView*            fQuotaView;
 };
 
 

Modified: haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/Jamfile
===================================================================
--- haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/Jamfile  
2011-03-16 19:50:53 UTC (rev 40977)
+++ haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/Jamfile  
2011-03-16 20:01:28 UTC (rev 40978)
@@ -47,7 +47,7 @@
        $(sources)
        :
        be libmail.so $(TARGET_NETWORK_LIBS) $(HAIKU_OPENSSL_LIBS) libalm.so
-               $(TARGET_LIBSUPC++) $(TARGET_LIBSTDC++)
+               libshared.a $(TARGET_LIBSUPC++) $(TARGET_LIBSTDC++)
 ;
 
 SEARCH on [ FGristFiles IMAPFolders.cpp IMAPHandler.cpp IMAPMailbox.cpp


Other related posts:

  • » [haiku-commits] r40978 - haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap - clemens . zeidler