Exemple #1
0
void CManagePasswordPolicies::OnSelectCell( wxGridEvent& evt )
{
  if (evt.GetEventObject() == m_PolicyNames) {
    m_curPolRow = evt.GetRow();
    UpdateDetails();
  }
}
void TransfersPanel::OnChange(OpWidget *widget,
							  BOOL changed_by_mouse)
{
	if (widget == m_transfers_view)
	{
		TransferItemContainer* item = (TransferItemContainer*)((OpTreeView*)widget)->GetSelectedItem();
		UpdateDetails(item ? item->GetAssociatedItem() : NULL);
	}
}
Exemple #3
0
void CCdlTemplatesDialog::OnSelchangeCdlTemplateVersion()
{
  CString strVersion;
  CConfigToolDoc * pDoc = CConfigTool::GetConfigToolDoc ();
  m_cboCdlTemplateVersion.GetLBText (m_cboCdlTemplateVersion.GetCurSel (), strVersion);
  TRACE (_T("Version '%s' selected\n"), strVersion);
  m_template_version = CUtils::UnicodeToStdStr (strVersion);
  m_strCdlTemplateDescription = pDoc->GetCdlPkgData ()->get_template_description (m_template, m_template_version).c_str ();
  m_strCdlTemplateDescription = CUtils::StripExtraWhitespace (m_strCdlTemplateDescription);

  UpdateDetails (); // display new template packages in details box
  UpdateData (FALSE); // display new template description
}
Exemple #4
0
void CCdlTemplatesDialog::OnSelchangeCdlHardware() 
{
	CConfigToolDoc * pDoc = CConfigTool::GetConfigToolDoc ();

	// the target has changed so retrieve the new target description
	const int nIndex = m_cboCdlHardware.GetCurSel ();
	m_hardware = * (std::vector<std::string>::const_iterator) m_cboCdlHardware.GetItemData (nIndex);
	m_strCdlHardwareDescription = pDoc->GetCdlPkgData ()->get_target_description (m_hardware).c_str ();
	m_strCdlHardwareDescription = CUtils::StripExtraWhitespace (m_strCdlHardwareDescription);

    UpdateDetails (); // display new hardware packages in details box
    UpdateData (FALSE); // display new target description
}
Exemple #5
0
void ecTemplatesDialog::OnSelPackageVersion(wxCommandEvent& event)
{
	wxString strVersion;
    ecConfigToolDoc* doc = wxGetApp().GetConfigToolDoc();
    wxChoice* cdlVersionCtrl = (wxChoice*)  FindWindow( ecID_TEMPLATES_DIALOG_VERSION ) ;

	strVersion = cdlVersionCtrl->GetStringSelection ();

	//TRACE (_T("Version '%s' selected\n"), strVersion);
	m_template_version = ecUtils::UnicodeToStdStr (strVersion).c_str();
	m_strCdlTemplateDescription = doc->GetCdlPkgData ()->get_template_description (m_template.c_str(), m_template_version.c_str()).c_str ();
	m_strCdlTemplateDescription = ecUtils::StripExtraWhitespace (m_strCdlTemplateDescription);
	
	UpdateDetails (); // display new template packages in details box
    TransferDataToWindow (); // display new template description
}
Exemple #6
0
void ecTemplatesDialog::OnSelHardwareTemplates(wxCommandEvent& event)
{
    wxComboBox* cdlHardwareCtrl = (wxComboBox*)  FindWindow( ecID_TEMPLATES_DIALOG_HARDWARE_TEMPLATES ) ;
    wxChoice* cdlPackageCtrl = (wxChoice*)  FindWindow( ecID_TEMPLATES_DIALOG_PACKAGE_TEMPLATES ) ;

    ecConfigToolDoc* doc = wxGetApp().GetConfigToolDoc();

	// the target has changed so retrieve the new target description
	const int nIndex = cdlHardwareCtrl->GetSelection ();
	//std::vector<std::string>::const_iterator template_i = (std::vector<std::string>::const_iterator) cdlHardwareCtrl->GetClientData (nIndex);
    std::string* template_i =  (std::string*) cdlHardwareCtrl->GetClientData (nIndex);
	m_hardware = template_i->c_str();

	m_strCdlHardwareDescription = doc->GetCdlPkgData ()->get_target_description ((const wxChar*) m_hardware).c_str ();
	m_strCdlHardwareDescription = ecUtils::StripExtraWhitespace (m_strCdlHardwareDescription);

    UpdateDetails (); // display new hardware packages in details box

    TransferDataToWindow (); // display new target description
}
void TransfersPanel::OnTransferProgress(TransferItemContainer* transferItem,
										OpTransferListener::TransferStatus status)
{
	PanelChanged();

	TransferItemContainer* item = (TransferItemContainer*)m_transfers_view->GetSelectedItem();
	if(!item)
	{
		m_item_details_from_info_label->SetText(UNI_L(""));
		m_item_details_to_info_label->SetText(UNI_L(""));
		m_item_details_size_info_label->SetText(UNI_L(""));
		m_item_details_transferred_info_label->SetText(UNI_L(""));
		m_item_details_connections_info_label->SetText(UNI_L(""));
		m_item_details_activetransfers_info_label->SetText(UNI_L(""));
		return;
	}

	if(item == transferItem)
		UpdateDetails(transferItem->GetAssociatedItem(), TRUE);
}
Exemple #8
0
void CManagePasswordPolicies::UpdatePolicy(const wxString &polname, const PWPolicy &pol,
                                           CPP_FLAGS mode)
{
  if (polname == _("Default Policy"))
    m_st_default_pp = pol;
  else
    m_MapPSWDPLC[tostringx(polname)] = pol;
#ifdef NOTYET
    // Save changes for Undo/Redo
    PWPolicyChange st_change;
    st_change.flags = mode;
    st_change.name = policyname;
    st_change.st_pp_save = m_iSelectedItem != 0 ? m_mapIter->second : m_st_default_pp;
    switch (mode) {
    case CPP_ADD:
      break;
    case CPP_MODIFIED:
      break;
    case CPP_DELETE:
      break;
    default:
      ASSERT(0);
    }

    if (m_iSelectedItem != 0) {
      // Changed a named password policy
      PSWDPolicyMapIter iter_new = m_MapPSWDPLC.find(StringX(policyname.c_str()));
      if (iter_new == m_MapPSWDPLC.end())
        ASSERT(0);
      st_change.st_pp_new = iter_new->second;
    } else {
      // Changed the database default policy
      st_change.st_pp_new = m_st_default_pp;
    }
  if (m_iundo_pos != (int)m_vchanges.size() - 1) {
    // We did have changes that could have been redone
    // But not anymore - delete all these to add new change on the end
    m_vchanges.resize(m_iundo_pos + 1);
  }

  // Add new change
  m_vchanges.push_back(st_change);
  // Update pointer to the one that is next to be undone
  m_iundo_pos++;
  // Update buttons appropriately
  FindWindow(wxID_UNDO)->Enable(true);
  FindWindow(wxID_REDO)->Enable(false);
#else
  UNREFERENCED_PARAMETER(mode);
#endif
  // Update lists
  UpdateNames();
  int N = m_PolicyNames->GetNumberRows();
  for (int row = 0; row < N; row++)
    if (m_PolicyNames->GetCellValue(row, 0) == polname) {
      m_PolicyNames->SelectRow(row);
      break;
    }

  UpdateDetails();
}
Exemple #9
0
void CManagePasswordPolicies::CreateControls()
{
////@begin CManagePasswordPolicies content construction
  CManagePasswordPolicies* itemDialog1 = this;

  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
  itemDialog1->SetSizer(itemBoxSizer2);

  wxStaticText* itemStaticText3 = new wxStaticText( itemDialog1, wxID_STATIC, _("Available Password Policies:"), wxDefaultPosition, wxDefaultSize, 0 );
  itemBoxSizer2->Add(itemStaticText3, 0, wxALIGN_LEFT|wxALL, 5);

  wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
  itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);

  m_PolicyNames = new wxGrid( itemDialog1, ID_POLICYLIST, wxDefaultPosition, wxSize(269, 150), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
  m_PolicyNames->SetDefaultColSize(100);
  m_PolicyNames->SetDefaultRowSize(25);
  m_PolicyNames->SetColLabelSize(25);
  m_PolicyNames->SetRowLabelSize(50);
  m_PolicyNames->CreateGrid(10, 2, wxGrid::wxGridSelectRows);
  itemBoxSizer4->Add(m_PolicyNames, 3, wxGROW|wxALL, 5);

  wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxVERTICAL);
  itemBoxSizer4->Add(itemBoxSizer6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);

  wxGridSizer* itemGridSizer7 = new wxGridSizer(0, 2, 0, 0);
  itemBoxSizer6->Add(itemGridSizer7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);

  wxButton* itemButton8 = new wxButton( itemDialog1, wxID_NEW, _("&New"), wxDefaultPosition, wxDefaultSize, 0 );
  itemGridSizer7->Add(itemButton8, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);

  wxButton* itemButton9 = new wxButton( itemDialog1, ID_EDIT_PP, _("Edit"), wxDefaultPosition, wxDefaultSize, 0 );
  itemGridSizer7->Add(itemButton9, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);

  wxButton* itemButton10 = new wxButton( itemDialog1, wxID_DELETE, _("&Delete"), wxDefaultPosition, wxDefaultSize, 0 );
  itemGridSizer7->Add(itemButton10, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);

  wxButton* itemButton11 = new wxButton( itemDialog1, ID_LIST, _("List"), wxDefaultPosition, wxDefaultSize, 0 );
  itemGridSizer7->Add(itemButton11, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);

  wxButton* itemButton12 = new wxButton( itemDialog1, wxID_UNDO, _("&Undo"), wxDefaultPosition, wxDefaultSize, 0 );
  itemGridSizer7->Add(itemButton12, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);

  wxButton* itemButton13 = new wxButton( itemDialog1, wxID_REDO, _("&Redo"), wxDefaultPosition, wxDefaultSize, 0 );
  itemGridSizer7->Add(itemButton13, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);

  wxStaticBox* itemStaticBoxSizer14Static = new wxStaticBox(itemDialog1, wxID_STATIC, _("Test Selected Policy"));
  wxStaticBoxSizer* itemStaticBoxSizer14 = new wxStaticBoxSizer(itemStaticBoxSizer14Static, wxVERTICAL);
  itemBoxSizer6->Add(itemStaticBoxSizer14, 0, wxGROW|wxALL, 5);

  wxButton* itemButton15 = new wxButton( itemDialog1, ID_GENERATE_PASSWORD, _("Generate"), wxDefaultPosition, wxDefaultSize, 0 );
  itemStaticBoxSizer14->Add(itemButton15, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);

  wxBoxSizer* itemBoxSizer16 = new wxBoxSizer(wxHORIZONTAL);
  itemStaticBoxSizer14->Add(itemBoxSizer16, 0, wxGROW|wxALL, 5);

  m_passwordCtrl = new wxTextCtrl( itemDialog1, ID_PASSWORD_TXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
  itemBoxSizer16->Add(m_passwordCtrl, 5, wxALIGN_CENTER_VERTICAL|wxALL, 5);

  wxBitmapButton* itemBitmapButton18 = new wxBitmapButton( itemDialog1, ID_BITMAPBUTTON, itemDialog1->GetBitmapResource(wxT("graphics/toolbar/new/copypassword.xpm")), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
  wxBitmap itemBitmapButton18BitmapDisabled(itemDialog1->GetBitmapResource(wxT("graphics/toolbar/new/copypassword_disabled.xpm")));
  itemBitmapButton18->SetBitmapDisabled(itemBitmapButton18BitmapDisabled);
  if (CManagePasswordPolicies::ShowToolTips())
    itemBitmapButton18->SetToolTip(_("Copy Password to clipboard"));
  itemBoxSizer16->Add(itemBitmapButton18, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);

  m_lowerTableDesc = new wxStaticText( itemDialog1, wxID_STATIC, _("Selected policy details:"), wxDefaultPosition, wxDefaultSize, 0 );
  itemBoxSizer2->Add(m_lowerTableDesc, 0, wxALIGN_LEFT|wxALL, 5);

  wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL);
  itemBoxSizer2->Add(itemBoxSizer20, 0, wxGROW|wxALL, 5);

  m_PolicyDetails = new wxGrid( itemDialog1, ID_POLICYPROPERTIES, wxDefaultPosition, wxSize(-1, 150), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
  m_PolicyDetails->SetDefaultColSize(210);
  m_PolicyDetails->SetDefaultRowSize(25);
  m_PolicyDetails->SetColLabelSize(25);
  m_PolicyDetails->SetRowLabelSize(50);
  m_PolicyDetails->CreateGrid(5, 2, wxGrid::wxGridSelectRows);
  itemBoxSizer20->Add(m_PolicyDetails, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);

  m_PolicyEntries = new wxGrid( itemDialog1, ID_POLICYENTRIES, wxDefaultPosition, wxSize(-1, 150), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
  m_PolicyEntries->SetDefaultColSize(140);
  m_PolicyEntries->SetDefaultRowSize(25);
  m_PolicyEntries->SetColLabelSize(25);
  m_PolicyEntries->SetRowLabelSize(50);
  m_PolicyEntries->CreateGrid(5, 3, wxGrid::wxGridSelectRows);
  itemBoxSizer20->Add(m_PolicyEntries, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);

  wxStdDialogButtonSizer* itemStdDialogButtonSizer23 = new wxStdDialogButtonSizer;

  itemBoxSizer2->Add(itemStdDialogButtonSizer23, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
  wxButton* itemButton24 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
  itemStdDialogButtonSizer23->AddButton(itemButton24);

  wxButton* itemButton25 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
  itemStdDialogButtonSizer23->AddButton(itemButton25);

  wxButton* itemButton26 = new wxButton( itemDialog1, wxID_HELP, _("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
  itemStdDialogButtonSizer23->AddButton(itemButton26);

  itemStdDialogButtonSizer23->Realize();

////@end CManagePasswordPolicies content construction

  if (m_core.IsReadOnly()) {
    FindWindow(wxID_NEW)->Enable(false);
    FindWindow(wxID_DELETE)->Enable(false);

    // Hide cancel button & change OK button text
    FindWindow(wxID_CANCEL)->Enable(false);
    FindWindow(wxID_CANCEL)->Show(false);

    FindWindow(wxID_OK)->SetLabel(_("Close"));
    FindWindow(wxID_EDIT)->SetLabel(_("View"));
  }

  // We have 2 grids, but we show only one at a time,
  // toggle when user clicks on ID_LIST button.
  // Setting these up:
  m_PolicyNames->SetRowLabelSize(0);
  int col0Width = m_PolicyNames->GetColSize(0);
  col0Width += 45;
  m_PolicyNames->SetColSize(0, col0Width);
  m_PolicyNames->SetColLabelValue(0, _("Policy Name"));
  m_PolicyNames->SetColLabelValue(1, _("Use count"));
  UpdateNames();
  m_PolicyNames->SelectRow(0);

  // Since we select the default policy, disable List & Delete
  FindWindow(ID_LIST)->Enable(false);
  FindWindow(wxID_DELETE)->Enable(false);

  m_PolicyDetails->SetRowLabelSize(0);
  m_PolicyDetails->SetColLabelValue(0, _("Policy Field"));
  m_PolicyDetails->SetColLabelValue(1, _("Value"));
  UpdateDetails();

  m_PolicyEntries->SetRowLabelSize(0);
  m_PolicyEntries->SetColLabelValue(0, _("Group"));
  m_PolicyEntries->SetColLabelValue(1, _("Title"));
  m_PolicyEntries->SetColLabelValue(2, _("User Name"));

  ShowPolicyDetails();

  // Max. of 255 policy names allowed - only 2 hex digits used for number
  if (m_MapPSWDPLC.size() >= 255)
    FindWindow(wxID_NEW)->Enable(false);

  // No changes yet
  FindWindow(wxID_UNDO)->Enable(false);
  FindWindow(wxID_REDO)->Enable(false);

  m_PolicyNames->SetFocus();
}
Exemple #10
0
	virtual void			HandleResponse(const QVariantMap& Response) 
	{
		if(m_pView)
		{
			m_pView->m_bLockDown = true;

			
			QStringList Info;
			if(Response.contains("Error"))
				Info.append(tr("Error: %2").arg(Response["Error"].toString()));
			if(theGUI->Cfg()->GetInt("Gui/AdvancedControls") == 1)
				Info.append(tr("FileID: %1").arg(Response["ID"].toULongLong()));
			m_pView->m_pInfo->setText(Info.join(", "));

			m_pView->m_pFileName->setText(Response["FileName"].toString());

			QVariantList HashMap = Response["HashMap"].toList();
			m_pView->m_pHashes->setColumnCount(1);
#if QT_VERSION < 0x050000
			m_pView->m_pHashes->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
#else
			m_pView->m_pHashes->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
#endif
			m_pView->m_pHashes->setRowCount(HashMap.count());
			QStringList Hashes;
			StrPair MasterHash = Split2(Response["MasterHash"].toString(), ":");
			foreach(const QVariant& vHash, HashMap)
			{
				QVariantMap Hash = vHash.toMap();

				QTableWidgetItem* pItem = new QTableWidgetItem(Hash["Value"].toString());

				QFont Font = pItem->font();

				if(Hash["Value"].toString() == MasterHash.second)
				{
					Font.setBold(true);
					pItem->setData(Qt::UserRole, "Master");
				}
				else
					pItem->setData(Qt::UserRole, Hash["State"]);

				if(!MasterHash.first.isEmpty()) // file complate all hashes just black
				{
					if(Hash["State"] == "Parent")
						Font.setItalic(true);
					else if(Hash["State"] == "Empty")
						pItem->setForeground(Qt::gray);
					else if(Hash["State"] == "Aux")
						pItem->setForeground(Qt::darkYellow);
					else if(Hash["State"] == "Bad")
						pItem->setForeground(Qt::darkRed);
					else if(Hash["Value"].toString() != MasterHash.second)
						pItem->setForeground(Qt::darkGreen);
				}

				pItem->setFont(Font);

				m_pView->m_pHashes->setItem(Hashes.count(), 0, pItem);
				m_pView->m_pHashes->resizeRowToContents(Hashes.count());
				Hashes.append(Hash["Type"].toString());
			}

			m_pView->m_pHashes->setVerticalHeaderLabels(Hashes);
			
			if(int Count = m_pView->m_pHashes->rowCount())
				m_pView->m_pHashes->setMaximumHeight(((m_pView->m_pHashes->rowHeight(0)) * Count) + 2);
			else
				m_pView->m_pHashes->setMaximumHeight(30);

			m_pView->m_IsComplete = Response["FileStatus"] == "Complete";

			QVariantMap Properties = Response["Properties"].toMap();
			m_pView->m_pRating->setCurrentIndex(Properties["Rating"].toInt());
			m_pView->m_pDescription->setPlainText(Properties["Description"].toString());
			m_pView->m_pCoverView->ShowCover(m_pView->m_ID, Properties["CoverUrl"].toString());
			m_pView->m_pSubmit->setEnabled(false);

			bool Searching = Response["FileJobs"].toStringList().contains("Searching");
			if(m_pView->m_Mode == CFileListView::eFilesSearch || m_pView->m_Mode == CFileListView::eFilesGrabber)
			{
				if(!Searching && Properties["Description"].toString().isEmpty())
				{
					Searching = true;
					CSetRatingJob* pSetRatingJob = new CSetRatingJob(m_pView->m_ID);
					theGUI->ScheduleJob(pSetRatingJob);
				}

				if(Searching)
					QTimer::singleShot(1000, m_pView, SLOT(UpdateDetails()));
			}

			m_pView->m_bLockDown = false;
		}
Exemple #11
0
void CDetailsView::ShowDetails(uint64 ID)
{
	m_ID = ID;
	m_pProgress->SetID(ID);
	UpdateDetails();
}