Show
Ignore:
Timestamp:
07/09/07 22:13:35 (2 years ago)
Author:
daboo
Message:

More v4.1 code. Includes experiment, though non-functioning WebKit? message
display option.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Mulberry/branches/v4.1d1/MacOS/Sources/Application/General/CMulberryApp.cp

    r74 r97  
    3434#include "CAdbkManagerWindow.h" 
    3535#include "CAdbkSearchWindow.h" 
    36 #include "CAddressBookDoc.h" 
    3736#include "CAddressBookWindow.h" 
    3837#include "CAdminLock.h" 
     
    5251#include "CICSupport.h" 
    5352#include "CLetterWindow.h" 
    54 #include "CLocalAddressBook.h" 
    5553#include "CMacroEditDialog.h" 
    5654#include "CMailAccountManager.h" 
     
    423421        else if (CAdminLock::sAdminLock.mNoQuit) 
    424422        { 
    425                 // Look for option key 
    426                 KeyMap km; 
    427                 ::GetKeys(km);                  // Get keyboard state 
    428423                // Check for option key 
    429                 bool optionKey = (( ((unsigned char*) km)[0x3A>>3] >> (0x3A & 7) ) & 1); 
    430                 bool shiftKey = (( ((unsigned char*) km)[0x38>>3] >> (0x38 & 7) ) & 1); 
    431                 bool cmdKey = (( ((unsigned char*) km)[0x37>>3] >> (0x37 & 7) ) & 1); 
     424                UInt32 modifiers = ::GetCurrentKeyModifiers(); 
     425                bool option_key = modifiers & optionKey; 
     426                bool shift_key = modifiers & shiftKey; 
     427                bool cmd_key = modifiers & cmdKey; 
    432428 
    433429                // See if allowed to quit by existing docs 
    434                 if ((!optionKey || !shiftKey || !cmdKey) && AttemptQuit(inSaveOption)) 
     430                if ((!option_key || !shift_key || !cmd_key) && AttemptQuit(inSaveOption)) 
    435431                { 
    436432                        // First close it 
     
    607603 
    608604                // Look for option key 
    609                 KeyMap km; 
    610                 ::GetKeys(km);                  // Get keyboard state 
    611                 bool cmdKey = (( ((unsigned char*) km)[0x37>>3] >> (0x37 & 7) ) & 1); 
     605                bool cmd_key = ::GetCurrentKeyModifiers() & cmdKey; 
    612606                 
    613607                // Possible disconnect prompt 
    614608                if (!prefs.mDisconnected.GetValue() && prefs.mPromptDisconnected.GetValue() && CTCPSocket::WillDial() || 
    615                         cmdKey) 
     609                        cmd_key) 
    616610                { 
    617611                        CErrorDialog::EDialogResult result = CErrorDialog::PoseDialog(CErrorDialog::eErrDialog_Caution, 
     
    792786 
    793787                // Force manager to update all accounts 
    794                 CAddressBookManager::sAddressBookManager->StartLocal(); 
    795                 CAddressBookManager::sAddressBookManager->SyncAccounts(CPreferences::sPrefs->mAddressAccounts.GetValue()); 
     788                CAddressBookManager::sAddressBookManager->SyncAccounts(); 
    796789        } 
    797790        else 
    798791        { 
    799792                // Force manager to update all accounts 
    800                 CAddressBookManager::sAddressBookManager->SyncAccounts(CPreferences::sPrefs->mAddressAccounts.GetValue()); 
     793                CAddressBookManager::sAddressBookManager->SyncAccounts(); 
    801794        } 
    802795} 
     
    982975                case cmd_Preferences: 
    983976                        { 
    984                                 // Look for option key 
    985                                 KeyMap km; 
    986                                 ::GetKeys(km);                  // Get keyboard state 
    987977                                // Check for option key 
    988                                 bool optionKey = (( ((unsigned char*) km)[0x3A>>3] >> (0x3A & 7) ) & 1); 
     978                                bool option_key = ::GetCurrentKeyModifiers() & optionKey; 
    989979 
    990980                                // If option key and logging allowed then do log prefs 
    991                                 if (optionKey && CAdminLock::sAdminLock.mAllowLogging) 
     981                                if (option_key && CAdminLock::sAdminLock.mAllowLogging) 
    992982                                { 
    993983                                        CLog::DoLoggingOptions(); 
     
    10341024 
    10351025                case cmd_NewAddressBook: 
    1036                         // Do local new if only local address books 
    1037                         if (CAddressBookManager::sAddressBookManager->GetProtocolList().empty()) 
    1038                                 MakeNewAddressBookDoc(); 
    1039                         else if (CPreferences::sPrefs->mUse3Pane.GetValue()) 
     1026                        if (CPreferences::sPrefs->mUse3Pane.GetValue()) 
    10401027                        { 
    10411028                                // Show three pane window and force to contacts tab 
     
    10461033                                } 
    10471034                        } 
    1048                         else if (CPreferences::sPrefs->mUse3Pane.GetValue()) 
     1035                        else 
    10491036                        { 
    10501037                                // Show address book manager 
     
    10541041 
    10551042                case cmd_OpenAddressBook: 
    1056                         // Do local open if only local address books 
    1057                         if (CAddressBookManager::sAddressBookManager->GetProtocolList().empty()) 
    1058                                 ChooseAddressBookDoc(); 
    1059                         else if (CPreferences::sPrefs->mUse3Pane.GetValue()) 
     1043                        if (CPreferences::sPrefs->mUse3Pane.GetValue()) 
    10601044                        { 
    10611045                                // Show three pane window and force to contacts tab 
     
    10661050                                } 
    10671051                        } 
    1068                         else if (CPreferences::sPrefs->mUse3Pane.GetValue()) 
     1052                        else 
    10691053                        { 
    10701054                                // Show address book manager 
     
    18231807                                // Sync address books 
    18241808                                if (!stopped_adbk && CAddressBookManager::sAddressBookManager) 
    1825                                         CAddressBookManager::sAddressBookManager->SyncAccounts(CPreferences::sPrefs->mAddressAccounts.GetValue()); 
     1809                                        CAddressBookManager::sAddressBookManager->SyncAccounts(); 
    18261810 
    18271811                                // Sync calendars 
     
    21902174                break; 
    21912175 
    2192         case kAddressBookDocType: 
    2193                 // Make sure prefs exists - force if not 
    2194                 if (!mPrefsLoaded) StartUp(); 
    2195  
    2196                 if (CAdminLock::sAdminLock.mNoLocalAdbks) 
    2197                 { 
    2198                         ::SysBeep(1); 
    2199                         break; 
    2200                 } 
    2201  
    2202                 // Only open if not quitting 
    2203                 if (mState != programState_Quitting) 
    2204                 { 
    2205                         // Check for existing file 
    2206                         CAddressBook* adbk = (CAddressBook*) CAddressBookManager::sAddressBookManager->CheckLocalOpen(inMacFSSpec); 
    2207  
    2208                         // Does window already exist? 
    2209                         if (adbk) 
    2210                         { 
    2211                                 CAddressBookWindow* theWindow = CAddressBookWindow::FindWindow(adbk); 
    2212  
    2213                                 if (theWindow) 
    2214                                         // Found existing window so select 
    2215                                         FRAMEWORK_WINDOW_TO_TOP(theWindow) 
    2216  
    2217                                 adbk = NULL; 
    2218                         } 
    2219                         else 
    2220                         { 
    2221                                 try 
    2222                                 { 
    2223                                         // Create address book 
    2224                                         adbk = new CLocalAddressBook(inMacFSSpec); 
    2225  
    2226                                         // Open it 
    2227                                         adbk->Open(); 
    2228                                 } 
    2229                                 catch (...) 
    2230                                 { 
    2231                                         CLOG_LOGCATCH(...); 
    2232  
    2233                                         // Remove from manager 
    2234                                         if (adbk) 
    2235                                                 adbk->Close(); 
    2236                                         delete adbk; 
    2237                                 } 
    2238                         } 
    2239                 } 
    2240                 break; 
    22412176        } 
    22422177 
     
    22672202 
    22682203} // CMulberryApp::ChooseLetterDoc 
    2269  
    2270 // Create address book doc 
    2271 void CMulberryApp::MakeNewAddressBookDoc() 
    2272 { 
    2273         CLocalAddressBook* adbk = NULL; 
    2274         try 
    2275         { 
    2276                 // Create address book 
    2277                 adbk = new CLocalAddressBook(NULL); 
    2278  
    2279                 // New it 
    2280                 adbk->New(); 
    2281         } 
    2282         catch (...) 
    2283         { 
    2284                 CLOG_LOGCATCH(...); 
    2285  
    2286                 // Remove from manager 
    2287                 if (adbk) 
    2288                         adbk->Close(); 
    2289                 delete adbk; 
    2290         } 
    2291 } 
    2292  
    2293 // Choose an address book document 
    2294 void CMulberryApp::ChooseAddressBookDoc() 
    2295 { 
    2296         // Send AE for recording 
    2297         PPx::FSObject fspec; 
    2298         if (PP_StandardDialogs::AskOpenOneFile(kAddressBookDocType, fspec, kNavDefaultNavDlogOptions | kNavAllowPreviews | kNavAllFilesInPopup)) 
    2299                 OpenDocument(&fspec); 
    2300  
    2301 } // CMulberryApp::ChooseAddressBookDoc 
    23022204 
    23032205//      Respond to an AppleEvent