X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2FfrmMain.cpp;h=03f8cd97f2b67d80a4f972393828efe74e472f24;hb=7144da5e7c93db0df978e028fe79c41b7445cd10;hp=4dc43f6d90f1837155cf24e5886edaece88f4da9;hpb=25716f74ecdac6cd5879b659ebc8aaa668261880;p=xestiaab%2F.git diff --git a/source/frmMain.cpp b/source/frmMain.cpp index 4dc43f6..03f8cd9 100644 --- a/source/frmMain.cpp +++ b/source/frmMain.cpp @@ -477,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; @@ -1103,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]; } @@ -1349,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); @@ -1406,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); @@ -1435,13 +1444,24 @@ 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(); + + } else { + + ContactBackgroundColour = wxTransparentColour; + + } + treAccounts->DeleteAllItems(); wxTreeItemId RootNode = treAccounts->AddRoot(wxT("Root Item"), AccountNoneID); @@ -1494,7 +1514,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; @@ -1634,7 +1654,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(); @@ -1744,6 +1764,7 @@ void frmMain::UpdateContactList(wxCommandEvent& event){ vCard UpdatedPerson; UpdatedPerson.LoadFile(ucd->ContactFilename); + frmContactPtr->SetBackgroundColour(ContactBackgroundColour.GetAsString(wxC2S_CSS_SYNTAX)); frmContactPtr->SetupContactData(&UpdatedPerson); } @@ -3162,7 +3183,10 @@ void frmMain::ShowContactMenu( wxMouseEvent& event ){ bool EnableRefresh = FALSE; - if (!ActiveAccount.IsEmpty() && (ActiveAccountType == "CardDAV" || ActiveAccountType == "carddav")){ + if (!ActiveAccount.IsEmpty() && (ActiveAccountType == "CardDAV" || + ActiveAccountType == "carddav" || + ActiveAccountType == "Local" || + ActiveAccountType == "local")){ EnableRefresh = TRUE; @@ -3182,4 +3206,29 @@ void frmMain::ResetContactInfo(){ htmContactData->SetPage(EmptyPage); AccCtrl->SetValue(""); -} \ No newline at end of file +} + +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; + } +}