X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2FfrmMain.cpp;h=aeffdbaa0f2843b96464cea0d59fb7442022da7d;hb=e1671cb64809ba0fd4ccc4645f22a83a2c0c5928;hp=3d54720e9ec64e7201844c65979a0e2637c317f5;hpb=e8efcf96e52c4d8d82ded85327070dcb7a4e3609;p=xestiaab%2F.git diff --git a/source/frmMain.cpp b/source/frmMain.cpp index 3d54720..aeffdba 100644 --- a/source/frmMain.cpp +++ b/source/frmMain.cpp @@ -390,17 +390,11 @@ void frmMain::QuitApp() { // Function to run when quitting. - - //Go through the windows and close each one (be it search - //or contact editor). Abort if user wants to cancel. - - // Close the contact editor windows. - - // Close the contact windows. - - // Close the search windows. - + // Write out the ETag databases. + + ETagProcTimer.Stop(); + ETagProcTimer.Notify(); // Save Preferences: Save the window position if that option is enabled. @@ -483,6 +477,13 @@ void frmMain::ShowAboutWindow( wxCommandEvent& event ) void frmMain::OpenPreferences( wxCommandEvent& event) { + // Close all windows first. + + if (CloseAllWindows() == false) + { + return; + } + // Open the preferences window. ReloadAccounts = FALSE; @@ -1109,7 +1110,7 @@ void frmMain::ShowContactInfo( wxListEvent& event ) OldSessionID = SessionID; SessionID = wxString::Format(wxT("%i"), rand() % 32768); - LoadContactData(&Person, htmContactData, SessionID, OldSessionID, &MemoryFileList); + LoadContactData(&Person, htmContactData, SessionID, OldSessionID, &MemoryFileList, ContactBackgroundColour.GetAsString(wxC2S_CSS_SYNTAX)); ActiveFilename = ContactsFileIndex[ContactSeekNum]; } @@ -1355,6 +1356,7 @@ void frmMain::OpenContactInfoList( wxListEvent& event ) wxPostEvent(this, addevent); Contact->SetupPointers(&MemoryFileList); + Contact->SetBackgroundColour(ContactBackgroundColour.GetAsString(wxC2S_CSS_SYNTAX)); Contact->SetupContactData(&Person); Contact->SetIcon(contacticon); @@ -1412,6 +1414,7 @@ void frmMain::OpenContactInfo( wxCommandEvent& event ) wxPostEvent(this, addevent); Contact->SetupPointers(&MemoryFileList); + Contact->SetBackgroundColour(ContactBackgroundColour.GetAsString(wxC2S_CSS_SYNTAX)); Contact->SetupContactData(&Person); Contact->SetIcon(contacticon); @@ -1441,13 +1444,20 @@ void frmMain::LoadPreferences(){ bool SaveWindowPos = preferences.GetBoolData(wxT("SaveWindowPosition")); bool HideLocalABs = preferences.GetBoolData(wxT("HideLocalAddressBooks")); + bool UseBackgroundContactColour = preferences.GetBoolData(wxT("UseBackgroundContactColour")); - if (SaveWindowPos == TRUE){ + if (SaveWindowPos == true){ this->SetSize(preferences.GetMainWindowData()); } + if (UseBackgroundContactColour == true){ + + ContactBackgroundColour = preferences.GetBackgroundContactColourData(); + + } + treAccounts->DeleteAllItems(); wxTreeItemId RootNode = treAccounts->AddRoot(wxT("Root Item"), AccountNoneID); @@ -1500,7 +1510,7 @@ void frmMain::LoadPreferences(){ for (int i = 0; i < preferences.accounts.GetCount(); i++){ if ((preferences.accounts.GetAccountType(i) == wxT("Local") || - preferences.accounts.GetAccountType(i) == wxT("local")) && HideLocalABs == TRUE){ + preferences.accounts.GetAccountType(i) == wxT("local")) && HideLocalABs == true){ continue; @@ -1640,7 +1650,7 @@ void frmMain::ConflictResolution(wxCommandEvent& event){ vCardConflictObj *vCardConfObj = (vCardConflictObj*)event.GetClientData(); vCard *ClientDataPtr = vCardConfObj->vCardLocalData; vCard *ServerDataPtr = vCardConfObj->vCardServerData; - frameCR->LoadData(ClientDataPtr, ServerDataPtr, &MemoryFileList); + frameCR->LoadData(ClientDataPtr, ServerDataPtr, &MemoryFileList, ContactBackgroundColour.GetAsString(wxC2S_CSS_SYNTAX)); frameCR->ShowModal(); int FinalConflictResult = frameCR->GetResult(); @@ -1750,6 +1760,7 @@ void frmMain::UpdateContactList(wxCommandEvent& event){ vCard UpdatedPerson; UpdatedPerson.LoadFile(ucd->ContactFilename); + frmContactPtr->SetBackgroundColour(ContactBackgroundColour.GetAsString(wxC2S_CSS_SYNTAX)); frmContactPtr->SetupContactData(&UpdatedPerson); } @@ -3188,4 +3199,29 @@ void frmMain::ResetContactInfo(){ htmContactData->SetPage(EmptyPage); AccCtrl->SetValue(""); +} + +bool frmMain::CloseAllWindows() +{ + // Attempt to close all windows. + + if (WindowListPointersMenu.size() == 0) + { + return true; + } + + if (wxMessageBox(_("Before preforming the action, all windows that are open will need to close. Do you wish to continue?"), _("Close All Windowss"), wxYES_NO) == wxYES) + { + for(std::map::iterator windowIter = WindowListPointers.begin(); + windowIter != WindowListPointers.end(); windowIter++) + { + wxWindow *windowPointer = static_cast(windowIter->second); + windowPointer->Close(); + } + return true; + } + else + { + return false; + } } \ No newline at end of file