Changeset 160

Show
Ignore:
Timestamp:
02/03/08 20:17:26 (10 months ago)
Author:
cyrusdaboo
Message:

Add check calendar command/toolbar button to do fast checks of all active/open calendars.

Location:
Mulberry/branches/v4.1d1
Files:
10 modified

Legend:

Unmodified
Added
Removed
  • Mulberry/branches/v4.1d1/MacOS/Sources/Application/Calendar/Calendar_View/Calendar_Store_View/CCalendarStoreTable.cp

    r97 r160  
    177177                break; 
    178178 
     179        case cmd_CheckCalendar: 
     180        case cmd_ToolbarCheckMailboxBtn: 
     181                OnCheckCalendar(); 
     182                break; 
     183 
    179184        case cmd_RefreshCalendarList: 
    180185                OnRefreshList(); 
     
    326331        case cmd_FreeBusyCalendar: 
    327332        case cmd_SendCalendar: 
    328                 // Only if calendar selection; 
     333                // Only if calendar selection 
    329334                outEnabled = TestSelectionAnd((TestSelectionPP) &CCalendarStoreTable::TestSelectionCanChangeCalendar); 
    330335                break; 
    331336 
     337        case cmd_CheckCalendar: 
     338        case cmd_ToolbarCheckMailboxBtn: 
     339                // Always enabled 
     340                outEnabled = true; 
     341                break; 
     342 
    332343        case cmd_RefreshCalendarList: 
    333                 // Only if single selection; 
     344                // Only if single selection 
    334345                outEnabled = IsSingleSelection(); 
    335346                break; 
  • Mulberry/branches/v4.1d1/MacOS/Sources/Application/Calendar/Calendar_View/Calendar_Store_View/CCalendarStoreTable.h

    r97 r160  
    134134                        bool            RenameCalendar(TableIndexT row); 
    135135                        void            OnDeleteCalendar(); 
     136                        void            OnCheckCalendar(); 
     137                        bool            CheckCalendar(TableIndexT row); 
    136138                        void            OnRefreshList(); 
    137139                        void            OnFreeBusyCalendar(); 
  • Mulberry/branches/v4.1d1/MacOS/Sources/Application/Calendar/Calendar_View/Calendar_Window/CCalendarView.cp

    r97 r160  
    211211                break; 
    212212 
     213        case cmd_CheckCalendar: 
     214        case cmd_ToolbarCheckMailboxBtn: 
     215                OnCheckCalendar(); 
     216                break; 
     217 
    213218        default: 
    214219                cmdHandled = CBaseView::ObeyCommand(inCommand, ioParam); 
     
    306311        case cmd_ToolbarShowTodayBtn: 
    307312                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; 
    308319                break; 
    309320 
  • Mulberry/branches/v4.1d1/MacOS/Sources/Application/Calendar/Calendar_View/Calendar_Window/CCalendarView.h

    r97 r160  
    175175                        void            OnFileSave(); 
    176176 
     177                        void            OnCheckCalendar(); 
     178 
    177179private: 
    178180        bool mIgnoreValueFieldChanged; 
  • Mulberry/branches/v4.1d1/MacOS/Sources/Application/General/CCommands.h

    r97 r160  
    422422const   CommandT        cmd_UploadWebCalendar = 9512; 
    423423const   CommandT        cmd_FreeBusyCalendar = 9513; 
     424const   CommandT        cmd_CheckCalendar = 9514; 
    424425 
    425426// Calendar Window 
  • Mulberry/branches/v4.1d1/Sources_Common/Application/Calendar/Calendar_View/Calendar_Store_View/CCalendarStoreTableCommon.cp

    r86 r160  
    834834} 
    835835 
     836void 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 
     857bool 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 
    836872void CCalendarStoreTable::OnRefreshList() 
    837873{ 
  • Mulberry/branches/v4.1d1/Sources_Common/Application/Calendar/Calendar_View/Calendar_Window/CCalendarViewCommon.cp

    r86 r160  
    318318} 
    319319 
     320void 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  
    813813bool CCalendarProtocol::CheckCalendar(const CCalendarStoreNode& node, iCal::CICalendar& cal) 
    814814{ 
    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); 
    825834                } 
    826835                else 
    827836                { 
    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 
    876844        return result; 
    877845} 
     
    10411009                cdstrmap comps; 
    10421010                bool server_changed = mClient->_CalendarChanged(node, cal); 
     1011                bool changes_made = false; 
    10431012                if (server_changed) 
    10441013                        mClient->_GetComponentInfo(node, cal, comps); 
     
    10621031                                        // Add component to server 
    10631032                                        mClient->_AddComponent(node, cal, *comp); 
     1033                                        changes_made = true; 
    10641034 
    10651035                                        // Add to added cache 
     
    10761046                                        // Remove component from server 
    10771047                                        mClient->_RemoveComponent(node, cal, (*iter).second.GetRURL()); 
     1048                                        changes_made = true; 
    10781049                                         
    10791050                                        // Remove from server component info 
     
    10921063                                        const iCal::CICalendarComponent* comp = cal.GetComponentByKey((*iter).first); 
    10931064                                        mClient->_ChangeComponent(node, cal, *comp); 
     1065                                        changes_made = true; 
    10941066                                        cache_changed.insert(cdstrmap::value_type((*iter).second.GetRURL(), (*iter).second.GetETag())); 
    10951067                                } 
     
    11471119                                                // Write changed cache component to server 
    11481120                                                mClient->_ChangeComponent(node, cal, *cache_comp); 
     1121                                                changes_made = true; 
    11491122                                        } 
    11501123                                         
     
    11651138                                                                // Cache is newer than server - cache overwrites to server 
    11661139                                                                mClient->_ChangeComponent(node, cal, *cache_comp); 
     1140                                                                changes_made = true; 
    11671141                                                        } 
    11681142                                                        else if (result == -1) 
     
    12301204                cal.ClearRecording(); 
    12311205                 
    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); 
    12341209 
    12351210                // Now write back cache 
  • Mulberry/branches/v4.1d1/Sources_Common/Support/Toolbars/CToolbarManager.cp

    r86 r160  
    432432        CToolbarManager::eToolbar_CalendarSummary, 
    433433        CToolbarManager::eToolbar_CalendarToDo, 
     434        CToolbarManager::eToolbar_Check, 
    434435        CToolbarManager::eToolbar_Details, 
    435436        CToolbarManager::eToolbar_Print, 
     
    599600        CToolbarManager::eToolbar_Login, 
    600601        CToolbarManager::eToolbar_NewCalendar, 
     602        CToolbarManager::eToolbar_Check, 
    601603        CToolbarManager::eToolbar_Details, 
    602604        CToolbarManager::eToolbar_Print, 
     
    622624        CToolbarManager::eToolbar_CalendarSummary, 
    623625        CToolbarManager::eToolbar_CalendarToDo, 
     626        CToolbarManager::eToolbar_Check, 
    624627        CToolbarManager::eToolbar_Details, 
    625628        CToolbarManager::eToolbar_Print, 
     
    713716        CToolbarManager::eToolbar_CalendarToDo, 
    714717        CToolbarManager::eToolbar_Separator, 
     718        CToolbarManager::eToolbar_Check, 
    715719        CToolbarManager::eToolbar_ShowToday, 
    716720        CToolbarManager::eToolbar_GoToDate, 
     
    845849        CToolbarManager::eToolbar_Login, 
    846850        CToolbarManager::eToolbar_NewCalendar, 
     851        CToolbarManager::eToolbar_Separator, 
     852        CToolbarManager::eToolbar_Check, 
    847853        CToolbarManager::eToolbar_Separator, 
    848854        CToolbarManager::eToolbar_Details, 
     
    866872        CToolbarManager::eToolbar_CalendarToDo, 
    867873        CToolbarManager::eToolbar_Separator, 
     874        CToolbarManager::eToolbar_Check, 
    868875        CToolbarManager::eToolbar_ShowToday, 
    869876        CToolbarManager::eToolbar_GoToDate,