root/SettingGeneralOtherDlg.cpp

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. CSettingGeneralOtherDlg
  2. DoDataExchange
  3. BEGIN_MESSAGE_MAP
  4. OnInitDialog
  5. OnOK

/*
 * Copyright (C) 2002-2003 chik, s.hiranaka
 * For license terms, see the file COPYING in this directory.
 */

// SettingGeneralOtherDlg.cpp : インプリメンテーション ファイル
//

#include "stdafx.h"
#include "pochy.h"
#include "SettingGeneralOtherDlg.h"
#include "lib.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSettingGeneralOtherDlg ダイアログ


CSettingGeneralOtherDlg::CSettingGeneralOtherDlg(CWnd* pParent /*=NULL*/)
        : CDialog(CSettingGeneralOtherDlg::IDD, pParent)
{
        //{{AFX_DATA_INIT(CSettingGeneralOtherDlg)
        //}}AFX_DATA_INIT
}


void CSettingGeneralOtherDlg::DoDataExchange(CDataExchange* pDX)
{
        CDialog::DoDataExchange(pDX);
        //{{AFX_DATA_MAP(CSettingGeneralOtherDlg)
        DDX_Control(pDX, IDC_SETTING_GENERAL_AUTOFETCH_MINUTES, m_autofetch_minute);
        DDX_Control(pDX, IDC_SETTING_GENERAL_DEFACCOUNT, m_def_account);
        DDX_Control(pDX, IDC_SETTING_GENERAL_EDITOR_PATH, m_editor_path);
        //}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSettingGeneralOtherDlg, CDialog)
        //{{AFX_MSG_MAP(CSettingGeneralOtherDlg)
        ON_BN_CLICKED(IDC_SETTING_GENERAL_EDITOR_REF, OnEditorRef)
        //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSettingGeneralOtherDlg メッセージ ハンドラ

void CSettingGeneralOtherDlg::OnEditorRef() 
{
        CFileDialog dlg(TRUE, NULL, NULL, OFN_PATHMUSTEXIST, NULL, this);
        dlg.m_ofn.lpstrTitle = _T( "外部エディター" );
        if(dlg.DoModal() == IDOK){
                m_editor_path.SetWindowText(dlg.GetPathName());
        }else{
                return;
        }
}

BOOL CSettingGeneralOtherDlg::OnInitDialog() 
{
        CDialog::OnInitDialog();
        CPochyApp *app = (CPochyApp *)AfxGetApp();

        m_editor_path.SetWindowText(app->GetProfileString("Editor", "Path")); 

        CFileFind ff;
        BOOL b = ff.FindFile(app->m_app_path+"\\*.*");
        int index;
        CString message;

        while(b){
                b = ff.FindNextFile();
                if(ff.IsDirectory() && !ff.IsDots()){
                        if(g_is_there(app->m_app_path+"\\"+ff.GetFileName()+"\\account.ini")){
                                index = m_def_account.AddString(ff.GetFileName());
                                switch(index){
                                case CB_ERR:
                                        message.Format("%sの情報取得中にエラーが発生しました", ff.GetFileName());
                                        AfxMessageBox(message);
                                case CB_ERRSPACE:
                                        message.Format("%dの情報取得中にメモリが足りなくなりました", ff.GetFileName());
                                        AfxMessageBox(message);
                                }
                                if(m_def_account.SetItemData(index, index) == CB_ERR){
                                        message.Format("%sの情報取得中にエラーが発生しました", ff.GetFileName());
                                        AfxMessageBox(message);
                                }else{
                                        m_def_account.SetItemData(index, index);
                                }
                        }
                }
        }
        CString account = app->GetProfileString("DefaultMailBox", "BoxName");
        if(!account.IsEmpty()){
                index = m_def_account.FindStringExact(-1, account);
                m_def_account.SetCurSel(index);
        }

        char buf[10];
        int minute = app->GetProfileInt("AutoFetch", "minute", 0);
        m_autofetch_minute.SetWindowText(itoa(minute, buf, 10));

        return TRUE;  // コントロールにフォーカスを設定しないとき、戻り値は TRUE となります
                      // 例外: OCX プロパティ ページの戻り値は FALSE となります
}

void CSettingGeneralOtherDlg::OnOK() 
{

}

/* [<][>][^][v][top][bottom][index][help] */