Exemplo n.º 1
0
LRESULT SearchTypeDlg::onAdd(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
    TCHAR buf[512];
    if (ctrlExtensionName.GetWindowTextLength() == 0) {
        MessageBox(CTSTRING(LINE_EMPTY));
        return 0;
    }

    ctrlExtensionName.GetWindowText(buf, 512);

    StringTokenizer<tstring> t(buf, ';');
    for (auto i = t.getTokens().begin(); i != t.getTokens().end(); ++i) {
        if(!i->empty()) {
            if(Util::checkExtension(Text::fromT(*i))) {
                extList.push_back(Text::fromT(buf));
            } else {
                MessageBox(CTSTRING_F(INVALID_EXTENSION, *i));
            }
        }
    }

    fillList();
    ctrlExtensionName.SetWindowText(_T(""));

    return 0;
}
Exemplo n.º 2
0
LRESULT WebServerPage::onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) {
	PropPage::translate((HWND)(*this), texts);

	::SetWindowText(GetDlgItem(IDC_WEBSERVER_PORT_LABEL), CTSTRING_F(WEB_SERVER_PORT, "HTTP"));
	::SetWindowText(GetDlgItem(IDC_WEBSERVER_TLSPORT_LABEL), CTSTRING_F(WEB_SERVER_PORT, "HTTPS"));

	::SetWindowText(GetDlgItem(IDC_WEBSERVER_PORT), Util::toStringW(WEBCFG(PLAIN_PORT).num()).c_str());
	::SetWindowText(GetDlgItem(IDC_WEBSERVER_TLSPORT), Util::toStringW(WEBCFG(TLS_PORT).num()).c_str());

	ctrlTlsPort.Attach(GetDlgItem(IDC_WEBSERVER_TLSPORT));
	ctrlPort.Attach(GetDlgItem(IDC_WEBSERVER_PORT));

	url.SubclassWindow(GetDlgItem(IDC_LINK));
	url.SetHyperLinkExtendedStyle(HLINK_UNDERLINEHOVER);

	// TODO: add better help link
	url.SetHyperLink(_T("http://www.airdcpp.net/component/k2/24-web-server"));
	url.SetLabel(CTSTRING(MORE_INFORMATION));

	ctrlWebUsers.Attach(GetDlgItem(IDC_WEBSERVER_USERS));
	ctrlWebUsers.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT);

	CRect rc;
	ctrlWebUsers.GetClientRect(rc);
	ctrlWebUsers.InsertColumn(0, CTSTRING(USERNAME), LVCFMT_LEFT, rc.Width() / 2, 0);
	ctrlWebUsers.InsertColumn(1, CTSTRING(LAST_SEEN), LVCFMT_LEFT, rc.Width() / 2, 1);

	ctrlRemove.Attach(GetDlgItem(IDC_WEBSERVER_REMOVE_USER));
	ctrlAdd.Attach(GetDlgItem(IDC_WEBSERVER_ADD_USER));
	ctrlChange.Attach(GetDlgItem(IDC_WEBSERVER_CHANGE));
	ctrlStart.Attach(GetDlgItem(IDC_WEBSERVER_START));
	ctrlStatus.Attach(GetDlgItem(IDC_WEBSERVER_STATUS));

	updateState(webMgr->isRunning() ? STATE_STARTED : STATE_STOPPED);

	webUserList = webMgr->getUserManager().getUsers();
	for (const auto& u : webUserList) {
		if (!u->isAdmin()) {
			continue;
		}

		addListItem(u);
	}

	webMgr->addListener(this);
	return TRUE;
}
Exemplo n.º 3
0
LRESULT ProtocolPage::onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
    SettingTab::translate((HWND)(*this), texts);

    cAutoDetect.Attach(GetDlgItem(IDC_CONNECTION_DETECTION));
    SetDlgItemText(IDC_PROTOCOL_ENABLED, CTSTRING_F(ENABLE_CONNECTIVITY, (v6 ? "IPv6" : "IPv4")));

    auto mode = v6 ? SETTING(INCOMING_CONNECTIONS6) : SETTING(INCOMING_CONNECTIONS);
    if (mode == SettingsManager::INCOMING_DISABLED) {
        CheckDlgButton(IDC_PROTOCOL_ENABLED, BST_UNCHECKED);
        CheckDlgButton(IDC_ACTIVE, BST_CHECKED);
    } else {
        CheckDlgButton(IDC_PROTOCOL_ENABLED, BST_CHECKED);
        switch(mode) {
        case SettingsManager::INCOMING_ACTIVE:
            CheckDlgButton(IDC_ACTIVE, BST_CHECKED);
            break;
        case SettingsManager::INCOMING_ACTIVE_UPNP:
            CheckDlgButton(IDC_ACTIVE_UPNP, BST_CHECKED);
            break;
        case SettingsManager::INCOMING_PASSIVE:
            CheckDlgButton(IDC_PASSIVE, BST_CHECKED);
            break;
        default:
            CheckDlgButton(IDC_ACTIVE, BST_CHECKED);
            break;
        }
    }

    SettingTab::read((HWND)(*this), v6 ? items6 : items4);

    fixControls();

    // Bind address
    BindCombo.Attach(GetDlgItem(IDC_BIND_ADDRESS));
    getAddresses();

    return TRUE;
}