void CTDLFindResultsListCtrl::RefreshUserPreferences() { CPreferences prefs; // update user completed tasks colour if (prefs.GetProfileInt(_T("Preferences"), _T("SpecifyDoneColor"), FALSE)) m_crDone = (COLORREF)prefs.GetProfileInt(_T("Preferences\\Colors"), _T("TaskDone"), -1); else m_crDone = CLR_NONE; // update user reference tasks colour if (prefs.GetProfileInt(_T("Preferences"), _T("ReferenceColor"), FALSE)) m_crRef = (COLORREF)prefs.GetProfileInt(_T("Preferences\\Colors"), _T("Reference"), -1); else m_crRef = CLR_NONE; // update strike thru font BOOL bWasStrikeThru = m_bStrikeThruDone; m_bStrikeThruDone = prefs.GetProfileInt(_T("Preferences"), _T("StrikethroughDone"), FALSE); // clear the font cache if 'strike thru' has changed if (m_bStrikeThruDone != bWasStrikeThru) m_fonts.Clear(); if (IsWindowVisible()) Invalidate(); }
void CTDLFindResultsListCtrl::RefreshUserPreferences() { CPreferences prefs; // update user completed tasks colour if (prefs.GetProfileInt(_T("Preferences"), _T("SpecifyDoneColor"), FALSE)) { m_crDone = (COLORREF)prefs.GetProfileInt(_T("Preferences\\Colors"), _T("TaskDone"), -1); } else { m_crDone = (COLORREF)-1; } // update strike thru font if (prefs.GetProfileInt(_T("Preferences"), _T("StrikethroughDone"), FALSE)) { if (!m_fontStrike.GetSafeHandle()) { GraphicsMisc::CreateFont(m_fontStrike, (HFONT)SendMessage(WM_GETFONT), MFS_STRIKETHRU); } } else { m_fontStrike.DeleteObject(); } if (IsWindowVisible()) { Invalidate(); } }
CTDLImportDialog::CTDLImportDialog(const CImportExportMgr& mgr, CWnd* pParent /*=NULL*/) : CDialog(CTDLImportDialog::IDD, pParent), m_mgrImportExport(mgr), m_sizeMin(0, 0) { //{{AFX_DATA_INIT(CTDLImportDialog) //}}AFX_DATA_INIT CPreferences prefs; m_bFromClipboard = prefs.GetProfileInt(_T("Importing"), _T("ImportOption"), FALSE); m_sFromFilePath = prefs.GetProfileString(_T("Importing"), _T("ImportFilePath")); m_nImportTo = prefs.GetProfileInt(_T("Importing"), _T("ImportToWhere"), TDIT_SELECTEDTASK); m_nFormatOption = prefs.GetProfileInt(_T("Importing"), _T("ImportFormat"), 0); m_nFormatOption = min(m_nFormatOption, mgr.GetNumImporters()); }
void CTDLImportOutlookObjectsDlg::BuildMasterMapping() { // restore last state from preferences CString sSection; sSection.Format(_T("OutlookFieldMapping\\%s"), COutlookHelper::GetItemClass(m_refItem)); CPreferences prefs; m_bHideUnmapped = prefs.GetProfileInt(sSection, _T("HideUnmapped"), TRUE); m_bHideConfidential = prefs.GetProfileInt(sSection, _T("HideConfidential"), TRUE); // initialize the mapped reference data COutlookHelper::GetItemData(m_refItem, m_mapRefData, !m_bHideConfidential); // recheck the confidential status because the call to COutlookHelper::GetItemData // may have been denied if (!m_bHideConfidential) m_bHideConfidential = COutlookHelper::HasDenyConfidential(); // build the master mapping first time only if (m_aMasterMapping.GetSize() == 0) { for (int nField = 0; nField < NUM_FIELDS; nField++) { const OUTLOOK_FIELD& oaField = FIELDS[nField]; CEnString sFieldAndData = FormatFieldAndData(oaField); m_aMasterMapping.Add(CSVCOLUMNMAPPING(sFieldAndData, oaField.nTDCAttrib, oaField.nFieldType)); } } ASSERT(m_aMasterMapping.GetSize() == NUM_FIELDS); // restore last state from preferences for (int nField = 0; nField < NUM_FIELDS; nField++) { CString sKey = Misc::MakeKey(_T("Field%d"), nField); OUTLOOK_FIELDTYPE nFieldType = (OUTLOOK_FIELDTYPE)prefs.GetProfileInt(sSection, sKey, -1); sKey = Misc::MakeKey(_T("Attrib%d"), nField); TDC_ATTRIBUTE nAttrib = (TDC_ATTRIBUTE)prefs.GetProfileInt(sSection, sKey, TDCA_NONE); if (nFieldType != -1) m_aMasterMapping[nField].nTDCAttrib = nAttrib; } }
BOOL CToDoCtrlReminders::ToDoCtrlHasReminders(const CString& sFilePath) { if (sFilePath.IsEmpty()) return FALSE; CPreferences prefs; CString sFileKey = CFilteredToDoCtrl::GetPreferencesKey(sFilePath, _T("Reminders")); return (!sFileKey.IsEmpty() && prefs.GetProfileInt(sFileKey, _T("NumReminders")) > 0); }
void CPreferencesToolPage::LoadPreferences(const CPreferences& prefs) { // load tools int nToolCount = prefs.GetProfileInt(_T("Tools"), _T("ToolCount"), 0); for (int nTool = 1; nTool <= nToolCount; nTool++) { CString sKey = Misc::MakeKey(_T("Tools\\Tool%d"), nTool); USERTOOL ut; ut.sToolName = prefs.GetProfileString(sKey, _T("Name"), _T("")); ut.sToolPath = prefs.GetProfileString(sKey, _T("Path"), _T("")); ut.sCmdline = prefs.GetProfileString(sKey, _T("CmdLine"), _T("")); ut.bRunMinimized = prefs.GetProfileInt(sKey, _T("RunMinimized"), FALSE); ut.sIconPath = prefs.GetProfileString(sKey, _T("IconPath"), _T("")); // replace safe quotes with real quotes ut.sCmdline.Replace(SAFEQUOTE, REALQUOTE); m_aTools.Add(ut); } }
void CPreferencesDlgBase::LoadPreferences(CPreferences& prefs) { // cycle the page loading the preferences for each one int nPage = m_pphost.GetPageCount(); while (nPage--) { CPreferencesPageBase* pPage = (CPreferencesPageBase*)m_pphost.GetPage(nPage); if (pPage->IsKindOf(RUNTIME_CLASS(CPreferencesPageBase))) pPage->LoadPreferences(prefs); } // initial page if (m_nInitPage < 0 || m_nInitPage >= m_pphost.GetPageCount()) m_nInitPage = prefs.GetProfileInt(_T("Preferences\\DialogState"), _T("StartPage"), 0); }
void CPreferencesExportPage::LoadPreferences(const CPreferences& prefs) { m_sHtmlFont = prefs.GetProfileString(_T("Preferences"), _T("HtmlFont"), _T("Verdana")); m_bPreviewExport = prefs.GetProfileInt(_T("Preferences"), _T("PreviewSaveAs"), TRUE); m_nHtmlFontSize = prefs.GetProfileInt(_T("Preferences"), _T("HtmlFontSize"), 2); m_nTextIndent = prefs.GetProfileInt(_T("Preferences"), _T("TextIndent"), 2); m_nLineSpaces = prefs.GetProfileInt(_T("Preferences"), _T("LineSpaces"), 8); m_bExportVisibleOnly = prefs.GetProfileInt(_T("Preferences"), _T("ExportVisibleOnly"), FALSE); m_bExportParentTitleCommentsOnly = prefs.GetProfileInt(_T("Preferences"), _T("ExportParentTitleCommentsOnly"), FALSE); m_bExportSpaceForNotes = prefs.GetProfileInt(_T("Preferences"), _T("ExportSpaceForNotes"), FALSE); m_bUseSpaceIndents = prefs.GetProfileInt(_T("Preferences"), _T("UseSpaceIndents"), TRUE); CString sDefCharset = "Windows-" + Misc::GetDefCharset(); m_sHtmlCharSet = prefs.GetProfileString(_T("Preferences"), _T("HtmlCharSet"), sDefCharset); // m_b = prefs.GetProfileInt(_T("Preferences"), _T(""), FALSE); }
COffsetDatesDlg::COffsetDatesDlg(CWnd* pParent /*=NULL*/): CDialog(COffsetDatesDlg::IDD, pParent) { //{{AFX_DATA_INIT(COffsetDatesDlg) m_bOffsetSubtasks = FALSE; //}}AFX_DATA_INIT // restore state CPreferences prefs; m_bOffsetStartDate = prefs.GetProfileInt(_T("OffsetDates"), _T("StartDate"), FALSE); m_bOffsetDueDate = prefs.GetProfileInt(_T("OffsetDates"), _T("DueDate"), FALSE); m_bOffsetDoneDate = prefs.GetProfileInt(_T("OffsetDates"), _T("DoneDate"), FALSE); m_bForward = prefs.GetProfileInt(_T("OffsetDates"), _T("Forward"), 1); m_nOffsetBy = prefs.GetProfileInt(_T("OffsetDates"), _T("Amount"), 1); m_nOffsetByUnits = prefs.GetProfileInt(_T("OffsetDates"), _T("AmountUnits"), 0); m_bOffsetSubtasks = prefs.GetProfileInt(_T("OffsetDates"), _T("Subtasks"), 1); }
void CToDoCtrlReminders::LoadReminders(const CFilteredToDoCtrl& tdc) { CPreferences prefs; CString sFileKey = tdc.GetPreferencesKey(_T("Reminders")); int nRemCount = prefs.GetProfileInt(sFileKey, _T("NumReminders")); for (int nRem = 0; nRem < nRemCount; nRem++) { CString sKey = Misc::MakeKey(_T("\\Reminder%d"), nRem, sFileKey); TDCREMINDER rem; rem.pTDC = &tdc; rem.Load(&prefs, sKey); m_aReminders.Add(rem); } // start timer if some reminders and not using Stickies if (!m_stickies.IsValid()) StartTimer(); }
CTDLTransformDialog::CTDLTransformDialog(LPCTSTR szTitle, FTC_VIEW nView, CWnd* pParent /*=NULL*/) : CDialog(IDD_TRANSFORM_DIALOG, pParent), m_taskSel(_T("Transform"), nView), m_sTitle(szTitle), m_eStylesheet(FES_COMBOSTYLEBTN | FES_RELATIVEPATHS, CEnString(IDS_XSLFILEFILTER)) { //{{AFX_DATA_INIT(CTDLTransformDialog) //}}AFX_DATA_INIT // see what we had last time CPreferences prefs; // init the stylesheet folder to point to the resource folder CString sFolder = FileMisc::GetAppResourceFolder() + _T("\\Stylesheets"); m_eStylesheet.SetCurrentFolder(sFolder); m_eStylesheet.SetBrowseTitle(CEnString(IDS_SELECTSTYLESHEET_TITLE)); m_sStylesheet = prefs.GetProfileString(_T("Transform"), _T("Stylesheet")); m_sStylesheet = FileMisc::GetRelativePath(m_sStylesheet, sFolder, FALSE); m_bDate = prefs.GetProfileInt(_T("Transform"), _T("WantDate"), TRUE); // share same title history as print dialog m_cbTitle.Load(&prefs, _T("Print")); }
void CPreferencesShortcutsPage::LoadPreferences(const CPreferences& prefs) { m_bShowCommandIDs = prefs.GetProfileInt(_T("KeyboardShortcuts"), _T("ShowCommandIDs"), FALSE); }
void CPreferencesUIPage::LoadPreferences(const CPreferences& prefs) { // load settings m_bShowEditMenuAsColumns = prefs.GetProfileInt(_T("Preferences"), _T("ShowEditMenuAsColumns"), FALSE); m_bShowCommentsAlways = prefs.GetProfileInt(_T("Preferences"), _T("ShowCommentsAlways"), FALSE); m_bAutoReposCtrls = prefs.GetProfileInt(_T("Preferences"), _T("AutoReposCtrls"), TRUE); m_bSpecifyToolbarImage = prefs.GetProfileInt(_T("Preferences"), _T("SpecifyToolbarImage"), FALSE); m_bSharedCommentsHeight = prefs.GetProfileInt(_T("Preferences"), _T("SharedCommentsHeight"), TRUE); m_bAutoHideTabbar = prefs.GetProfileInt(_T("Preferences"), _T("AutoHideTabbar"), TRUE); m_bStackTabbarItems = prefs.GetProfileInt(_T("Preferences"), _T("StackTabbarItems"), FALSE); m_bFocusTreeOnEnter = prefs.GetProfileInt(_T("Preferences"), _T("FocusTreeOnEnter"), FALSE); m_nNewTaskPos = (PUIP_NEWTASKPOS)prefs.GetProfileInt(_T("Preferences"), _T("NewTaskPos"), PUIP_BELOW); m_nNewSubtaskPos = (PUIP_NEWTASKPOS)prefs.GetProfileInt(_T("Preferences"), _T("NewSubtaskPos"), PUIP_BOTTOM); m_bKeepTabsOrdered = prefs.GetProfileInt(_T("Preferences"), _T("KeepTabsOrdered"), FALSE); m_bShowTasklistCloseButton = prefs.GetProfileInt(_T("Preferences"), _T("ShowTasklistCloseButton"), TRUE); m_bSortDoneTasksAtBottom = prefs.GetProfileInt(_T("Preferences"), _T("SortDoneTasksAtBottom"), TRUE); m_bRTLComments = prefs.GetProfileInt(_T("Preferences"), _T("RTLComments"), FALSE); m_nCommentsPos = (PUIP_LOCATION)prefs.GetProfileInt(_T("Preferences"), _T("VertComments"), PUIP_LOCATERIGHT); m_nCtrlsPos = (PUIP_LOCATION)prefs.GetProfileInt(_T("Preferences"), _T("VertControls"), PUIP_LOCATEBOTTOM); m_bMultiSelFilters = prefs.GetProfileInt(_T("Preferences"), _T("MultiSelFilters"), TRUE); m_bRestoreTasklistFilters = prefs.GetProfileInt(_T("Preferences"), _T("RestoreTasklistFilters"), TRUE); m_bAutoRefilter = prefs.GetProfileInt(_T("Preferences"), _T("AutoRefilter"), TRUE); m_bAutoResort = prefs.GetProfileInt(_T("Preferences"), _T("AutoResort"), TRUE); m_bUseUITheme = CThemed::IsAppThemed() && prefs.GetProfileInt(_T("Preferences"), _T("UseUITheme"), TRUE); m_sUIThemeFile = prefs.GetProfileString(_T("Preferences"), _T("UIThemeFile"), _T(".\\ThemeBlue.xml")); m_nTitleFilterOption = (PUIP_MATCHTITLE)prefs.GetProfileInt(_T("Preferences"), _T("TitleFilterOption"), PUIP_MATCHONTITLECOMMENTS); m_bShowDefaultTaskIcons = prefs.GetProfileInt(_T("Preferences"), _T("ShowDefaultTaskIcons"), TRUE); m_bShowDefaultFilters = prefs.GetProfileInt(_T("Preferences"), _T("ShowDefaultFilters"), TRUE); m_bEnableColumnHeaderSorting = prefs.GetProfileInt(_T("Preferences"), _T("EnableColumnHeaderSorting"), TRUE); m_bStackEditFieldsAndComments = prefs.GetProfileInt(_T("Preferences"), _T("StackEditFieldsAndComments"), TRUE); // m_b = prefs.GetProfileInt(_T("Preferences"), _T(""), FALSE); // light-boxing not available on linux and disabled by default m_bEnableLightboxMgr = ((COSVersion() == OSV_LINUX) ? FALSE : prefs.GetProfileInt(_T("Preferences"), _T("EnableLightboxMgr"), FALSE)); // set default theme to blue if (CThemed::IsAppThemed()) { CString sResFolder = FileMisc::GetAppResourceFolder() + "\\Themes"; m_eUITheme.SetCurrentFolder(sResFolder); m_sUIThemeFile = FileMisc::GetRelativePath(m_sUIThemeFile, sResFolder, FALSE); } else m_sUIThemeFile.Empty(); // comments format if (m_cbCommentsFmt.IsInitialized()) { m_cfDefault = prefs.GetProfileString(_T("Preferences"), _T("DefaultCommentsFormatID")); m_nDefaultCommentsFormat = m_cbCommentsFmt.SetSelectedFormat(m_cfDefault); // fallback if (m_nDefaultCommentsFormat == CB_ERR) m_nDefaultCommentsFormat = prefs.GetProfileInt(_T("Preferences"), _T("DefaultCommentsFormat"), -1); if (m_nDefaultCommentsFormat == CB_ERR || m_nDefaultCommentsFormat >= m_cbCommentsFmt.GetCount()) { ASSERT (m_cbCommentsFmt.GetCount()); m_nDefaultCommentsFormat = 0; } m_cbCommentsFmt.SetCurSel(m_nDefaultCommentsFormat); m_cbCommentsFmt.GetSelectedFormat(m_cfDefault); } // task view visibility CStringArray aViews; int nView = prefs.GetProfileInt(_T("Preferences\\ViewVisibility"), _T("Count"), -1); if (nView > 0) { while (nView--) { CString sKey = Misc::MakeKey(_T("View%d"), nView); CString sView = prefs.GetProfileString(_T("Preferences\\ViewVisibility"), sKey); ASSERT(!sView.IsEmpty()); aViews.Add(sView); } m_lbTaskViews.SetVisibleViews(aViews); } }
CExportDlg::CExportDlg(const CImportExportMgr& mgr, BOOL bSingleTaskList, BOOL bShowSubtaskCheckbox, BOOL bVisibleColumnsOnly, LPCTSTR szFilePath, LPCTSTR szFolderPath, CWnd* pParent /*=NULL*/): CDialog(IDD_EXPORT_DIALOG, pParent), m_mgrImportExport(mgr), m_bSingleTaskList(bSingleTaskList), m_sFilePath(szFilePath), m_sOrgFilePath(szFilePath), m_sFolderPath(szFolderPath), m_sOrgFolderPath(szFolderPath), m_taskSel(_T("Exporting"), bShowSubtaskCheckbox, bVisibleColumnsOnly), m_eExportPath(FES_COMBOSTYLEBTN | FES_SAVEAS) { CPreferences prefs; //{{AFX_DATA_INIT(CExportDlg) m_sPathLabel = _T(""); //}}AFX_DATA_INIT m_bExportOneFile = FALSE; if (m_bSingleTaskList) { m_nExportOption = ACTIVETASKLIST; } else { m_nExportOption = prefs.GetProfileInt(_T("Exporting"), _T("ExportOption"), ACTIVETASKLIST); } if (m_sFolderPath.IsEmpty()) { m_sFolderPath = prefs.GetProfileString(_T("Exporting"), _T("LastFolder")); } if (m_bSingleTaskList || m_nExportOption == ACTIVETASKLIST || m_bExportOneFile) { m_sExportPath = m_sFilePath; // default if ((m_sFilePath.IsEmpty() || PathIsRelative(m_sFilePath)) && !m_sFolderPath.IsEmpty()) { CString sFName; FileMisc::SplitPath(m_sFilePath, NULL, NULL, &sFName); // handle empty filename if (sFName.IsEmpty()) { sFName.LoadString(IDS_TDC_UNTITLEDFILE); } FileMisc::MakePath(m_sExportPath, NULL, m_sFolderPath, sFName); } ReplaceExtension(m_sExportPath, s_nFormatOption); m_sPathLabel.LoadString(IDS_ED_FILEPATH); } else // multiple files { if (!m_sFolderPath.IsEmpty()) { m_sExportPath = m_sFolderPath; } else if (!m_sFilePath.IsEmpty()) { CString sDrive, sPath; FileMisc::SplitPath(m_sFilePath, &sDrive, &sPath); FileMisc::MakePath(m_sExportPath, sDrive, sPath); } m_sPathLabel.LoadString(IDS_ED_FOLDER); } }
void CPreferencesUIVisibilityPage::LoadPreferences(const CPreferences& prefs) { TDCCOLEDITFILTERVISIBILITY vis; // columns CTDCColumnIDArray aColumns; int nCol = prefs.GetProfileInt(_T("Preferences\\ColumnVisibility"), _T("Count"), -1); if (nCol >= 0) { while (nCol--) { CString sKey = Misc::MakeKey(_T("Col%d"), nCol); TDC_COLUMN col = (TDC_COLUMN)prefs.GetProfileInt(_T("Preferences\\ColumnVisibility"), sKey, TDCC_NONE); if (col != TDCC_NONE) aColumns.Add(col); } } else // first time => backwards compatibility { // same order as enum aColumns.Add(TDCC_PRIORITY); aColumns.Add(TDCC_PERCENT); aColumns.Add(TDCC_TIMEEST); aColumns.Add(TDCC_TIMESPENT); aColumns.Add(TDCC_TRACKTIME); aColumns.Add(TDCC_DUEDATE); aColumns.Add(TDCC_ALLOCTO); aColumns.Add(TDCC_STATUS); aColumns.Add(TDCC_CATEGORY); aColumns.Add(TDCC_FILEREF); aColumns.Add(TDCC_RECURRENCE); aColumns.Add(TDCC_REMINDER); aColumns.Add(TDCC_TAGS); } vis.SetVisibleColumns(aColumns); // backwards compatibility if (prefs.GetProfileInt(_T("Preferences"), _T("ShowSubtaskCompletion"), FALSE)) vis.SetColumnVisible(TDCC_SUBTASKDONE); // attrib CTDCAttributeArray aAttrib; int nEdit = prefs.GetProfileInt(_T("Preferences\\EditVisibility"), _T("Count"), -1); if (nEdit >= 0) { // show attributes mode TDL_SHOWATTRIB nShow = (TDL_SHOWATTRIB)prefs.GetProfileInt(_T("Preferences"), _T("ShowAttributes"), TDLSA_ASCOLUMN); vis.SetShowEditsAndFilters(nShow); if (nShow == TDLSA_ANY) { // edit fields while (nEdit--) { CString sKey = Misc::MakeKey(_T("Edit%d"), nEdit); TDC_ATTRIBUTE att = (TDC_ATTRIBUTE)prefs.GetProfileInt(_T("Preferences\\EditVisibility"), sKey, TDCA_NONE); if (att != TDCA_NONE) aAttrib.Add(att); } vis.SetVisibleEditFields(aAttrib); // filter fields int nFilter = prefs.GetProfileInt(_T("Preferences\\FilterVisibility"), _T("Count"), -1); while (nFilter--) { CString sKey = Misc::MakeKey(_T("Filter%d"), nFilter); TDC_ATTRIBUTE att = (TDC_ATTRIBUTE)prefs.GetProfileInt(_T("Preferences\\FilterVisibility"), sKey, TDCA_NONE); if (att != TDCA_NONE) aAttrib.Add(att); } vis.SetVisibleFilterFields(aAttrib); } } else // first time => backwards compatibility { BOOL bShowCtrlsAsColumns = prefs.GetProfileInt(_T("Preferences"), _T("ShowCtrlsAsColumns"), FALSE); vis.SetShowEditsAndFilters(bShowCtrlsAsColumns ? TDLSA_ASCOLUMN : TDLSA_ALL); // if any time field is hidden we must enable 'any' attribute // and remove those fields BOOL bHideDueTimeField = prefs.GetProfileInt(_T("Preferences"), _T("HideDueTimeField"), FALSE); BOOL bHideStartTimeField = prefs.GetProfileInt(_T("Preferences"), _T("HideStartTimeField"), FALSE); BOOL bHideDoneTimeField = prefs.GetProfileInt(_T("Preferences"), _T("HideDoneTimeField"), FALSE); if (bHideDoneTimeField || bHideDueTimeField || bHideStartTimeField) { vis.SetShowEditsAndFilters(TDLSA_ANY); if (bHideStartTimeField) vis.SetEditFieldVisible(TDCA_STARTTIME, FALSE); if (bHideDueTimeField) vis.SetEditFieldVisible(TDCA_DUETIME, FALSE); if (bHideDoneTimeField) vis.SetEditFieldVisible(TDCA_DONETIME, FALSE); vis.SetVisibleEditFields(aAttrib); } } m_lcVisibility.SetVisibility(vis); m_nAttribShow = vis.GetShowEditsAndFilters(); }