Changeset 160
- Timestamp:
- 02/03/08 20:17:26 (10 months ago)
- Location:
- Mulberry/branches/v4.1d1
- Files:
-
- 10 modified
-
MacOS/Resources/Mulberry.PPob (modified) (previous)
-
MacOS/Sources/Application/Calendar/Calendar_View/Calendar_Store_View/CCalendarStoreTable.cp (modified) (2 diffs)
-
MacOS/Sources/Application/Calendar/Calendar_View/Calendar_Store_View/CCalendarStoreTable.h (modified) (1 diff)
-
MacOS/Sources/Application/Calendar/Calendar_View/Calendar_Window/CCalendarView.cp (modified) (2 diffs)
-
MacOS/Sources/Application/Calendar/Calendar_View/Calendar_Window/CCalendarView.h (modified) (1 diff)
-
MacOS/Sources/Application/General/CCommands.h (modified) (1 diff)
-
Sources_Common/Application/Calendar/Calendar_View/Calendar_Store_View/CCalendarStoreTableCommon.cp (modified) (1 diff)
-
Sources_Common/Application/Calendar/Calendar_View/Calendar_Window/CCalendarViewCommon.cp (modified) (1 diff)
-
Sources_Common/Calendar_Store/Protocols/CCalendarProtocol.cpp (modified) (8 diffs)
-
Sources_Common/Support/Toolbars/CToolbarManager.cp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Mulberry/branches/v4.1d1/MacOS/Sources/Application/Calendar/Calendar_View/Calendar_Store_View/CCalendarStoreTable.cp
r97 r160 177 177 break; 178 178 179 case cmd_CheckCalendar: 180 case cmd_ToolbarCheckMailboxBtn: 181 OnCheckCalendar(); 182 break; 183 179 184 case cmd_RefreshCalendarList: 180 185 OnRefreshList(); … … 326 331 case cmd_FreeBusyCalendar: 327 332 case cmd_SendCalendar: 328 // Only if calendar selection ;333 // Only if calendar selection 329 334 outEnabled = TestSelectionAnd((TestSelectionPP) &CCalendarStoreTable::TestSelectionCanChangeCalendar); 330 335 break; 331 336 337 case cmd_CheckCalendar: 338 case cmd_ToolbarCheckMailboxBtn: 339 // Always enabled 340 outEnabled = true; 341 break; 342 332 343 case cmd_RefreshCalendarList: 333 // Only if single selection ;344 // Only if single selection 334 345 outEnabled = IsSingleSelection(); 335 346 break; -
Mulberry/branches/v4.1d1/MacOS/Sources/Application/Calendar/Calendar_View/Calendar_Store_View/CCalendarStoreTable.h
r97 r160 134 134 bool RenameCalendar(TableIndexT row); 135 135 void OnDeleteCalendar(); 136 void OnCheckCalendar(); 137 bool CheckCalendar(TableIndexT row); 136 138 void OnRefreshList(); 137 139 void OnFreeBusyCalendar(); -
Mulberry/branches/v4.1d1/MacOS/Sources/Application/Calendar/Calendar_View/Calendar_Window/CCalendarView.cp
r97 r160 211 211 break; 212 212 213 case cmd_CheckCalendar: 214 case cmd_ToolbarCheckMailboxBtn: 215 OnCheckCalendar(); 216 break; 217 213 218 default: 214 219 cmdHandled = CBaseView::ObeyCommand(inCommand, ioParam); … … 306 311 case cmd_ToolbarShowTodayBtn: 307 312 mCurrentView->GetTable()->FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName); 313 break; 314 315 case cmd_CheckCalendar: 316 case cmd_ToolbarCheckMailboxBtn: 317 // Always enabled 318 outEnabled = true; 308 319 break; 309 320 -
Mulberry/branches/v4.1d1/MacOS/Sources/Application/Calendar/Calendar_View/Calendar_Window/CCalendarView.h
r97 r160 175 175 void OnFileSave(); 176 176 177 void OnCheckCalendar(); 178 177 179 private: 178 180 bool mIgnoreValueFieldChanged; -
Mulberry/branches/v4.1d1/MacOS/Sources/Application/General/CCommands.h
r97 r160 422 422 const CommandT cmd_UploadWebCalendar = 9512; 423 423 const CommandT cmd_FreeBusyCalendar = 9513; 424 const CommandT cmd_CheckCalendar = 9514; 424 425 425 426 // Calendar Window -
Mulberry/branches/v4.1d1/Sources_Common/Application/Calendar/Calendar_View/Calendar_Store_View/CCalendarStoreTableCommon.cp
r86 r160 834 834 } 835 835 836 void CCalendarStoreTable::OnCheckCalendar() 837 { 838 // If no selection, check all subscribed calendars 839 if (!IsSelectionValid()) 840 { 841 const iCal::CICalendarList& cals = calstore::CCalendarStoreManager::sCalendarStoreManager->GetSubscribedCalendars(); 842 for(iCal::CICalendarList::const_iterator iter = cals.begin(); iter != cals.end(); iter++) 843 { 844 calstore::CCalendarStoreNode* node = const_cast<calstore::CCalendarStoreNode*>(calstore::CCalendarStoreManager::sCalendarStoreManager->GetNode(*iter)); 845 node->GetProtocol()->CheckCalendar(*node, *node->GetCalendar()); 846 } 847 } 848 else 849 { 850 DoToSelection((DoToSelectionPP) &CCalendarStoreTable::CheckCalendar); 851 } 852 853 // Reset all views 854 CCalendarView::ResetAll(); 855 } 856 857 bool CCalendarStoreTable::CheckCalendar(TableIndexT row) 858 { 859 // Get calendar for hit cell 860 calstore::CCalendarStoreNode* node = GetCellNode(row); 861 862 // Only do those that are active calendars 863 if ((node == NULL) || !node->IsViewableCalendar() || !node->IsActive()) 864 return false; 865 866 if (node->GetCalendar() != NULL) 867 return node->GetProtocol()->CheckCalendar(*node, *node->GetCalendar()); 868 869 return false; 870 } 871 836 872 void CCalendarStoreTable::OnRefreshList() 837 873 { -
Mulberry/branches/v4.1d1/Sources_Common/Application/Calendar/Calendar_View/Calendar_Window/CCalendarViewCommon.cp
r86 r160 318 318 } 319 319 320 void CCalendarView::OnCheckCalendar() 321 { 322 // If no selection, check all subscribed calendars 323 if (mSingleCalendar) 324 { 325 calstore::CCalendarStoreNode* node = const_cast<calstore::CCalendarStoreNode*>(calstore::CCalendarStoreManager::sCalendarStoreManager->GetNode(GetCalendar())); 326 node->GetProtocol()->CheckCalendar(*node, *node->GetCalendar()); 327 } 328 else 329 { 330 const iCal::CICalendarList& cals = calstore::CCalendarStoreManager::sCalendarStoreManager->GetSubscribedCalendars(); 331 for(iCal::CICalendarList::const_iterator iter = cals.begin(); iter != cals.end(); iter++) 332 { 333 calstore::CCalendarStoreNode* node = const_cast<calstore::CCalendarStoreNode*>(calstore::CCalendarStoreManager::sCalendarStoreManager->GetNode(*iter)); 334 node->GetProtocol()->CheckCalendar(*node, *node->GetCalendar()); 335 } 336 } 337 338 // Reset all views 339 CCalendarView::ResetAll(); 340 } -
Mulberry/branches/v4.1d1/Sources_Common/Calendar_Store/Protocols/CCalendarProtocol.cpp
r113 r160 813 813 bool CCalendarProtocol::CheckCalendar(const CCalendarStoreNode& node, iCal::CICalendar& cal) 814 814 { 815 bool result = mClient->_CheckCalendar(node, cal); 816 817 // Always keep disconnected cache in sync with server 818 if (result && (mCacheClient != NULL)) 819 { 820 // If cache does not exist, create it 821 if (!mCacheClient->_TestCalendar(node)) 822 { 823 mCacheClient->_CreateCalendar(node); 824 mCacheClient->_WriteFullCalendar(node, cal); 815 bool result = false; 816 817 // See if offline or disconnected 818 if (IsOffline() || IsDisconnected()) 819 { 820 // Nothing to do here. We will assume that local files are always 821 // up to date. 822 } 823 else 824 { 825 // Look for local cache first 826 if ((mCacheClient != NULL) && !mCacheIsPrimary) 827 { 828 // Read in the calendar cache if it exists 829 if (mCacheClient->_TestCalendar(node)) 830 mCacheClient->_ReadFullCalendar(node, cal); 831 832 // Sync cache with server doing playback if needed 833 SyncFromServer(node, cal); 825 834 } 826 835 else 827 836 { 828 // Get temp copy of cached calendar 829 iCal::CICalendar temp; 830 mCacheClient->_ReadFullCalendar(node, temp); 831 832 // Sync changes in cache 833 bool server_changed = false; 834 if (temp.GetETag() == cal.GetETag()) 835 { 836 if (temp.NeedsSync()) 837 { 838 // Local overwrites server 839 cal.Clear(); 840 mCacheClient->_ReadFullCalendar(node, cal); 841 cal.ClearRecording(); 842 server_changed = true; 843 } 844 } 845 else 846 { 847 if (!temp.NeedsSync()) 848 { 849 // Server overwrites local - nothing to do just fall through to write 850 } 851 else 852 { 853 // Sync the two 854 iCal::CICalendarSync sync(temp, cal); 855 sync.Sync(); 856 857 // Local overwrites server 858 cal.Clear(); 859 mCacheClient->_ReadFullCalendar(node, cal); 860 cal.ClearRecording(); 861 } 862 } 863 864 // Update the server if needed 865 if (server_changed) 866 { 867 mClient->_WriteFullCalendar(node, cal); 868 } 869 870 // Now write out the new cache data, this will overwrite any recorded 871 // changes that have been sync'd so they will not be sync'd again 872 mCacheClient->_WriteFullCalendar(node, cal); 873 } 874 } 875 837 // Just read full calendar from server 838 result = mClient->_CalendarChanged(node, cal); 839 if (result) 840 ReadFullCalendar(node, cal); 841 } 842 } 843 876 844 return result; 877 845 } … … 1041 1009 cdstrmap comps; 1042 1010 bool server_changed = mClient->_CalendarChanged(node, cal); 1011 bool changes_made = false; 1043 1012 if (server_changed) 1044 1013 mClient->_GetComponentInfo(node, cal, comps); … … 1062 1031 // Add component to server 1063 1032 mClient->_AddComponent(node, cal, *comp); 1033 changes_made = true; 1064 1034 1065 1035 // Add to added cache … … 1076 1046 // Remove component from server 1077 1047 mClient->_RemoveComponent(node, cal, (*iter).second.GetRURL()); 1048 changes_made = true; 1078 1049 1079 1050 // Remove from server component info … … 1092 1063 const iCal::CICalendarComponent* comp = cal.GetComponentByKey((*iter).first); 1093 1064 mClient->_ChangeComponent(node, cal, *comp); 1065 changes_made = true; 1094 1066 cache_changed.insert(cdstrmap::value_type((*iter).second.GetRURL(), (*iter).second.GetETag())); 1095 1067 } … … 1147 1119 // Write changed cache component to server 1148 1120 mClient->_ChangeComponent(node, cal, *cache_comp); 1121 changes_made = true; 1149 1122 } 1150 1123 … … 1165 1138 // Cache is newer than server - cache overwrites to server 1166 1139 mClient->_ChangeComponent(node, cal, *cache_comp); 1140 changes_made = true; 1167 1141 } 1168 1142 else if (result == -1) … … 1230 1204 cal.ClearRecording(); 1231 1205 1232 // Get the current server sync token 1233 mClient->_UpdateSyncToken(node, cal); 1206 // Get the current server sync token if changes were made or it was differemt 1207 if (server_changed || changes_made) 1208 mClient->_UpdateSyncToken(node, cal); 1234 1209 1235 1210 // Now write back cache -
Mulberry/branches/v4.1d1/Sources_Common/Support/Toolbars/CToolbarManager.cp
r86 r160 432 432 CToolbarManager::eToolbar_CalendarSummary, 433 433 CToolbarManager::eToolbar_CalendarToDo, 434 CToolbarManager::eToolbar_Check, 434 435 CToolbarManager::eToolbar_Details, 435 436 CToolbarManager::eToolbar_Print, … … 599 600 CToolbarManager::eToolbar_Login, 600 601 CToolbarManager::eToolbar_NewCalendar, 602 CToolbarManager::eToolbar_Check, 601 603 CToolbarManager::eToolbar_Details, 602 604 CToolbarManager::eToolbar_Print, … … 622 624 CToolbarManager::eToolbar_CalendarSummary, 623 625 CToolbarManager::eToolbar_CalendarToDo, 626 CToolbarManager::eToolbar_Check, 624 627 CToolbarManager::eToolbar_Details, 625 628 CToolbarManager::eToolbar_Print, … … 713 716 CToolbarManager::eToolbar_CalendarToDo, 714 717 CToolbarManager::eToolbar_Separator, 718 CToolbarManager::eToolbar_Check, 715 719 CToolbarManager::eToolbar_ShowToday, 716 720 CToolbarManager::eToolbar_GoToDate, … … 845 849 CToolbarManager::eToolbar_Login, 846 850 CToolbarManager::eToolbar_NewCalendar, 851 CToolbarManager::eToolbar_Separator, 852 CToolbarManager::eToolbar_Check, 847 853 CToolbarManager::eToolbar_Separator, 848 854 CToolbarManager::eToolbar_Details, … … 866 872 CToolbarManager::eToolbar_CalendarToDo, 867 873 CToolbarManager::eToolbar_Separator, 874 CToolbarManager::eToolbar_Check, 868 875 CToolbarManager::eToolbar_ShowToday, 869 876 CToolbarManager::eToolbar_GoToDate,