Update of /cvsroot/mahogany/M/src/gui
In directory sc8-pr-cvs1:/tmp/cvs-serv18875/src/gui
Modified Files:
wxMainFrame.cpp wxFolderTree.cpp
Log Message:
update command in popup menu now updates the subtree when it makes sense and doesn't
unconditionally stop on errors (bug 764)
Index: wxMainFrame.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxMainFrame.cpp,v
retrieving revision 1.174
retrieving revision 1.175
diff -b -u -2 -r1.174 -r1.175
--- wxMainFrame.cpp 30 Sep 2003 23:45:42 -0000 1.174
+++ wxMainFrame.cpp 4 Oct 2003 01:48:35 -0000 1.175
@@ -88,4 +88,5 @@
extern const MPersMsgBox *M_MSGBOX_SEARCH_AGAIN_IF_NO_MATCH;
+extern const MPersMsgBox *M_MSGBOX_CONT_UPDATE_AFTER_ERROR;
// ----------------------------------------------------------------------------
@@ -95,5 +96,5 @@
// update the status of all folders under the given one in the folder tree,
// returns the number of the folders updated or -1 on error
-static int UpdateFoldersSubtree(const MFolder& folder, wxWindow *parent);
+extern int UpdateFoldersSubtree(const MFolder& folder, wxWindow *parent);
// ----------------------------------------------------------------------------
@@ -1245,4 +1246,5 @@
m_progInfo(parent, _("Folders updated:"), _("Updating folder tree"))
{
+ m_winParent = parent;
m_nCount = 0;
}
@@ -1261,6 +1263,19 @@
if ( !MailFolder::CheckFolder(folder) )
{
- // stop on error as chances are that the other ones could follow
- return false;
+ // ask the user whether we should continue with the others as they
+ // could be inaccessible as well (if server is offline for example)
+ return MDialog_YesNoDialog
+ (
+ wxString::Format
+ (
+ _("Checking status of the folder \"%s\" failed, do you\n"
+ "want to continue updating the other folders?"),
+ folderName.c_str()
+ ),
+ m_winParent,
+ MDIALOG_YESNOTITLE,
+ M_DLG_NO_DEFAULT,
+ M_MSGBOX_CONT_UPDATE_AFTER_ERROR
+ );
}
@@ -1273,4 +1288,7 @@
private:
+ // the parent window for all dialogs &c
+ wxWindow *m_winParent;
+
// the progress indicator
MProgressInfo m_progInfo;
@@ -1280,5 +1298,5 @@
};
-static int UpdateFoldersSubtree(const MFolder& folder, wxWindow *parent)
+int UpdateFoldersSubtree(const MFolder& folder, wxWindow *parent)
{
UpdateFolderVisitor visitor(folder, parent);
Index: wxFolderTree.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxFolderTree.cpp,v
retrieving revision 1.220
retrieving revision 1.221
diff -b -u -2 -r1.220 -r1.221
--- wxFolderTree.cpp 30 Sep 2003 13:46:20 -0000 1.220
+++ wxFolderTree.cpp 4 Oct 2003 01:48:35 -0000 1.221
@@ -492,6 +492,6 @@
{
Append(Close, _("&Close folder"));
- Append(Update, _("&Update status"));
}
+ Append(Update, _("&Update status"));
AppendSeparator();
@@ -837,7 +837,10 @@
}
+ // the only type of folder for which updating status doesn't make sense is a
+ // group without children
if ( menu->FindItem(WXMENU_FOLDER_UPDATE) )
{
- menu->Enable(WXMENU_FOLDER_UPDATE, !isGroup);
+ menu->Enable(WXMENU_FOLDER_UPDATE,
+ !isGroup || folder->GetSubfolderCount());
}
@@ -1187,4 +1190,8 @@
void wxFolderTree::OnUpdate(MFolder *folder)
{
+ // for the folders which can't be opened but have subfolders we should
+ // update their subfolders
+ if ( folder->CanOpen() || !folder->GetSubfolderCount() )
+ {
if ( !MailFolder::CheckFolder(folder) )
{
@@ -1197,4 +1204,22 @@
_("Updated status of the folder '%s'"),
folder->GetFullName().c_str());
+ }
+ }
+ else // update subfolders
+ {
+ // this is from wxMainFrame.cpp (TODO: move somewhere else)
+ extern int UpdateFoldersSubtree(const MFolder& folder, wxWindow *parent);
+
+ int nUpdated = UpdateFoldersSubtree(*folder, m_tree);
+ if ( nUpdated < 0 )
+ {
+ wxLogError(_("Failed to update the status"));
+ }
+ else
+ {
+ wxLogStatus(GetFrame(m_tree->wxWindow::GetParent()),
+ _("Updated status of %d folders."),
+ nUpdated);
+ }
}
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates