void CPreferencesUIPage::SavePreferences(CPreferences& prefs)
{
	// save settings
	prefs.WriteProfileInt(_T("Preferences"), _T("ShowEditMenuAsColumns"), m_bShowEditMenuAsColumns);
	prefs.WriteProfileInt(_T("Preferences"), _T("ShowCommentsAlways"), m_bShowCommentsAlways);
	prefs.WriteProfileInt(_T("Preferences"), _T("AutoReposCtrls"), m_bAutoReposCtrls);
	prefs.WriteProfileInt(_T("Preferences"), _T("SpecifyToolbarImage"), m_bSpecifyToolbarImage);
	prefs.WriteProfileInt(_T("Preferences"), _T("SharedCommentsHeight"), m_bSharedCommentsHeight);
	prefs.WriteProfileInt(_T("Preferences"), _T("AutoHideTabbar"), m_bAutoHideTabbar);
	prefs.WriteProfileInt(_T("Preferences"), _T("StackTabbarItems"), m_bStackTabbarItems);
	prefs.WriteProfileInt(_T("Preferences"), _T("FocusTreeOnEnter"), m_bFocusTreeOnEnter);
	prefs.WriteProfileInt(_T("Preferences"), _T("NewTaskPos"), m_nNewTaskPos);
	prefs.WriteProfileInt(_T("Preferences"), _T("NewSubtaskPos"), m_nNewSubtaskPos);
	prefs.WriteProfileInt(_T("Preferences"), _T("KeepTabsOrdered"), m_bKeepTabsOrdered);
	prefs.WriteProfileInt(_T("Preferences"), _T("ShowTasklistCloseButton"), m_bShowTasklistCloseButton);
	prefs.WriteProfileInt(_T("Preferences"), _T("SortDoneTasksAtBottom"), m_bSortDoneTasksAtBottom);
	prefs.WriteProfileInt(_T("Preferences"), _T("RTLComments"), m_bRTLComments);
	prefs.WriteProfileInt(_T("Preferences"), _T("VertComments"), m_nCommentsPos);
	prefs.WriteProfileInt(_T("Preferences"), _T("VertControls"), m_nCtrlsPos);
	prefs.WriteProfileInt(_T("Preferences"), _T("MultiSelFilters"), m_bMultiSelFilters);
	prefs.WriteProfileInt(_T("Preferences"), _T("RestoreTasklistFilters"), m_bRestoreTasklistFilters);
	prefs.WriteProfileInt(_T("Preferences"), _T("AutoRefilter"), m_bAutoRefilter);
	prefs.WriteProfileInt(_T("Preferences"), _T("AutoResort"), m_bAutoResort);
	prefs.WriteProfileString(_T("Preferences"), _T("UIThemeFile"), m_sUIThemeFile);
	prefs.WriteProfileInt(_T("Preferences"), _T("UseUITheme"), m_bUseUITheme);
	prefs.WriteProfileInt(_T("Preferences"), _T("EnableLightboxMgr"), m_bEnableLightboxMgr);
	prefs.WriteProfileInt(_T("Preferences"), _T("TitleFilterOption"), m_nTitleFilterOption);
	prefs.WriteProfileInt(_T("Preferences"), _T("ShowDefaultTaskIcons"), m_bShowDefaultTaskIcons);
	prefs.WriteProfileInt(_T("Preferences"), _T("ShowDefaultFilters"), m_bShowDefaultFilters);
	prefs.WriteProfileInt(_T("Preferences"), _T("EnableColumnHeaderSorting"), m_bEnableColumnHeaderSorting);
	prefs.WriteProfileInt(_T("Preferences"), _T("StackEditFieldsAndComments"), m_bStackEditFieldsAndComments);
//	prefs.WriteProfileInt(_T("Preferences"), _T(""), m_b);

	// comments format
	if (m_pMgrContent)
	{
		prefs.WriteProfileInt(_T("Preferences"), _T("DefaultCommentsFormat"), m_nDefaultCommentsFormat);
		prefs.WriteProfileString(_T("Preferences"), _T("DefaultCommentsFormatID"), m_cfDefault);
	}

	// task views
	CStringArray aViews;
	int nView = m_lbTaskViews.GetVisibleViews(aViews);

	prefs.WriteProfileInt(_T("Preferences\\ViewVisibility"), _T("Count"), nView);

	while (nView--)
	{
		CString sKey = Misc::MakeKey(_T("View%d"), nView);
		prefs.WriteProfileString(_T("Preferences\\ViewVisibility"), sKey, aViews[nView]);
	}
}
void CPreferencesExportPage::SavePreferences(CPreferences& prefs)
{
	// save settings
	prefs.WriteProfileString(_T("Preferences"), _T("HtmlFont"), m_sHtmlFont);
	prefs.WriteProfileInt(_T("Preferences"), _T("HtmlFontSize"), m_nHtmlFontSize);
	prefs.WriteProfileInt(_T("Preferences"), _T("PreviewSaveAs"), m_bPreviewExport);
	prefs.WriteProfileInt(_T("Preferences"), _T("TextIndent"), m_nTextIndent);
	prefs.WriteProfileInt(_T("Preferences"), _T("LineSpaces"), m_nLineSpaces);
	prefs.WriteProfileInt(_T("Preferences"), _T("ExportVisibleOnly"), m_bExportVisibleOnly);
	prefs.WriteProfileInt(_T("Preferences"), _T("ExportParentTitleCommentsOnly"), m_bExportParentTitleCommentsOnly);
	prefs.WriteProfileInt(_T("Preferences"), _T("ExportSpaceForNotes"), m_bExportSpaceForNotes);
	prefs.WriteProfileString(_T("Preferences"), _T("HtmlCharSet"), m_sHtmlCharSet);
	prefs.WriteProfileInt(_T("Preferences"), _T("UseSpaceIndents"), m_bUseSpaceIndents);
//	prefs.WriteProfileInt(_T("Preferences"), _T(""), m_b);
}
void CTDLTransformDialog::OnOK() 
{
	CDialog::OnOK();

	CPreferences prefs;

	prefs.WriteProfileString(_T("Transform"), _T("Stylesheet"), m_sStylesheet);
	prefs.WriteProfileInt(_T("Transform"), _T("WantDate"), m_bDate);

	// share same title history as print dialog
	m_cbTitle.Save(&prefs, _T("Print"));
}
void CTDLImportDialog::OnOK()
{
	CDialog::OnOK();
	
	CPreferences prefs;
	
	prefs.WriteProfileInt(_T("Importing"), _T("ImportOption"), m_bFromClipboard);
	prefs.WriteProfileString(_T("Importing"), _T("ImportFilePath"), m_sFromFilePath);
	prefs.WriteProfileInt(_T("Importing"), _T("ImportToWhere"), m_nImportTo);
	prefs.WriteProfileInt(_T("Importing"), _T("ImportFormat"), m_nFormatOption);

	// retrieve clipboard text
	if (CurImporterHasFilter())
		GetDlgItem(IDC_FROMCLIPBOARDTEXT)->GetWindowText(m_sClipboardText);
}
void CPreferencesToolPage::SavePreferences(CPreferences& prefs)
{
	// save tools to registry and m_aTools
	int nToolCount = m_aTools.GetSize();

	for (int nTool = 0; nTool < nToolCount; nTool++)
	{
		USERTOOL ut = m_aTools[nTool];

        CString sKey = Misc::MakeKey(_T("Tools\\Tool%d"), nTool + 1);
		
		prefs.WriteProfileString(sKey, _T("Name"), ut.sToolName);
		prefs.WriteProfileString(sKey, _T("Path"), ut.sToolPath);
		prefs.WriteProfileString(sKey, _T("IconPath"), ut.sIconPath);
		prefs.WriteProfileInt(sKey, _T("RunMinimized"), ut.bRunMinimized);
		
		// GetPrivateProfileString strips a leading/trailing quote pairs if 
		// it finds them so we replace quotes with safe quotes
		ut.sCmdline.Replace(REALQUOTE, SAFEQUOTE);
		prefs.WriteProfileString(sKey, _T("Cmdline"), ut.sCmdline);
	}

	prefs.WriteProfileInt(_T("Tools"), _T("ToolCount"), nToolCount);
}
void CTDLTaskIconDlg::OnDestroy()
{
	CDialog::OnDestroy();

	// save off any saved names to the preferences
	CPreferences prefs;

	for (int nImage = 0; nImage < m_ilIcons.GetImageCount(); nImage++)
	{
		CString sImage, sKey, sText;

		// only save the ones thsat have been modified
		sImage.Format(_T("%d"), nImage + 1);
		sText = m_lcIcons.GetItemText(nImage, 0);

		if (sText != sImage)
		{
			sKey.Format(_T("Icon%d"), nImage + 1);
			prefs.WriteProfileString(_T("TaskIcons"), sKey, sText);
		}
	}

}
Exemple #7
0
void CExportDlg::OnOK()
{
	BOOL bExporterHasFileExt = m_mgrImportExport.ExporterHasFileExtension(s_nFormatOption);

	if (bExporterHasFileExt)
	{
		m_sExportPath.TrimLeft();
		m_sExportPath.TrimRight();

		// if the export path is relative we build a path based
		// on the exe path and check with the user
		if (::PathIsRelative(m_sExportPath))
		{
			CString sPath = FileMisc::GetModuleFileName(), sDrive, sFolder;

			FileMisc::SplitPath(sPath, &sDrive, &sFolder);
			FileMisc::MakePath(sPath, sDrive, sFolder, m_sExportPath);

			CString sMessage;

			if (m_nExportOption == ALLTASKLISTS)
			{
				sMessage.Format(IDS_ED_CONFIRMEXPORTPATHMULTI, sPath);
			}
			else
			{
				sMessage.Format(IDS_ED_CONFIRMEXPORTPATH, sPath);
			}

			UINT nRet = MessageBox(sMessage, CEnString(IDS_ED_CONFIRMEXPORTPATH_TITLE), MB_YESNO);

			if (nRet == IDNO)
			{
				// re-display dialog
				m_eExportPath.SetSel(0, -1);
				m_eExportPath.SetFocus();
				return;
			}
			else
			{
				m_sExportPath = sPath;
			}
		}

		// make sure the output folder is valid
		BOOL bBadFolder = (m_nExportOption == ALLTASKLISTS && !m_bExportOneFile) ?
			!FileMisc::CreateFolder(m_sExportPath) :
			!FileMisc::CreateFolderFromFilePath(m_sExportPath);

		if (bBadFolder)
		{
			CEnString sMessage(IDS_ED_NOMAKEEXPORTPATH, m_sExportPath);

			UINT nRet = MessageBox(sMessage, CEnString(IDS_ED_NOMAKEEXPORTPATH_TITLE), MB_OKCANCEL);

			// re-display dialog
			if (nRet == IDOK)
			{
				m_eExportPath.SetSel(0, -1);
				m_eExportPath.SetFocus();
				return;
			}
			else
			{
				EndDialog(IDCANCEL);
				return;
			}
		}
	}

	CDialog::OnOK();

	// make sure extension is right
	if (bExporterHasFileExt)
	{
		if (m_nExportOption == ACTIVETASKLIST || m_bExportOneFile)
		{
			ReplaceExtension(m_sExportPath, s_nFormatOption);
		}
	}

	if (!m_bSingleTaskList)
	{
		CPreferences prefs;
		prefs.WriteProfileInt(_T("Exporting"), _T("ExportOption"), m_nExportOption);

		if (bExporterHasFileExt)
		{
			if (m_nExportOption == ALLTASKLISTS)
			{
				prefs.WriteProfileString(_T("Exporting"), _T("LastFolder"), m_sExportPath);
			}
			else
			{
				prefs.WriteProfileString(_T("Exporting"), _T("LastFolder"), m_sFolderPath);
			}
		}
	}
}