2004-09-21 01:30:29 +00:00
|
|
|
// $Id$
|
|
|
|
//
|
|
|
|
// The contents of this file are subject to the BOINC Public License
|
|
|
|
// Version 1.0 (the "License"); you may not use this file except in
|
|
|
|
// compliance with the License. You may obtain a copy of the License at
|
|
|
|
// http://boinc.berkeley.edu/license_1.0.txt
|
|
|
|
//
|
|
|
|
// Software distributed under the License is distributed on an "AS IS"
|
|
|
|
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
// License for the specific language governing rights and limitations
|
|
|
|
// under the License.
|
|
|
|
//
|
|
|
|
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
|
|
|
//
|
|
|
|
// The Initial Developer of the Original Code is the SETI@home project.
|
|
|
|
// Portions created by the SETI@home project are Copyright (C) 2002
|
|
|
|
// University of California at Berkeley. All Rights Reserved.
|
|
|
|
//
|
|
|
|
// Contributor(s):
|
|
|
|
//
|
|
|
|
// Revision History:
|
|
|
|
//
|
|
|
|
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma implementation "ViewProjects.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "stdwx.h"
|
|
|
|
#include "BOINCGUIApp.h"
|
|
|
|
#include "MainDocument.h"
|
2004-09-24 22:19:02 +00:00
|
|
|
#include "BOINCTaskCtrl.h"
|
|
|
|
#include "BOINCListCtrl.h"
|
2004-09-21 01:30:29 +00:00
|
|
|
#include "ViewProjects.h"
|
2004-09-22 21:53:07 +00:00
|
|
|
#include "DlgAttachProject.h"
|
2004-09-21 01:30:29 +00:00
|
|
|
#include "Events.h"
|
|
|
|
|
2004-09-24 02:01:53 +00:00
|
|
|
#include "res/boinc.xpm"
|
2004-09-21 01:30:29 +00:00
|
|
|
#include "res/proj.xpm"
|
|
|
|
#include "res/task.xpm"
|
|
|
|
#include "res/web.xpm"
|
|
|
|
#include "res/tips.xpm"
|
|
|
|
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
#define VIEW_HEADER wxT("proj")
|
2004-09-22 21:53:07 +00:00
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
#define SECTION_TASK wxT(VIEW_HEADER "task")
|
|
|
|
#define SECTION_WEB wxT(VIEW_HEADER "web")
|
|
|
|
#define SECTION_TIPS wxT(VIEW_HEADER "tips")
|
2004-09-22 21:53:07 +00:00
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
#define BITMAP_PROJECTS wxT(VIEW_HEADER ".xpm")
|
|
|
|
#define BITMAP_TASKHEADER wxT(SECTION_TASK ".xpm")
|
|
|
|
#define BITMAP_WEBHEADER wxT(SECTION_WEB ".xpm")
|
|
|
|
#define BITMAP_TIPSHEADER wxT(SECTION_TIPS ".xpm")
|
|
|
|
#define BITMAP_BOINC wxT("boinc.xpm")
|
2004-09-22 21:53:07 +00:00
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
#define COLUMN_PROJECT 0
|
|
|
|
#define COLUMN_ACCOUNTNAME 1
|
|
|
|
#define COLUMN_TEAMNAME 2
|
|
|
|
#define COLUMN_TOTALCREDIT 3
|
|
|
|
#define COLUMN_AVGCREDIT 4
|
|
|
|
#define COLUMN_RESOURCESHARE 5
|
2004-09-29 22:21:45 +00:00
|
|
|
#define COLUMN_STATUS 6
|
2004-09-21 01:30:29 +00:00
|
|
|
|
|
|
|
|
2004-10-19 19:41:29 +00:00
|
|
|
const wxString LINKDESC_DEFAULT =
|
|
|
|
_("Please click a project to see additional options.");
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
const wxString LINK_TASKATTACH = wxT(SECTION_TASK "attach");
|
|
|
|
const wxString LINKDESC_TASKATTACH =
|
|
|
|
_("<b>Attach to Project</b><br>"
|
2004-10-19 19:41:29 +00:00
|
|
|
"Clicking attach to project allows you to join other BOINC "
|
2004-10-05 02:55:26 +00:00
|
|
|
"projects. You will need a valid project URL and Authenticator.");
|
|
|
|
|
|
|
|
const wxString LINK_TASKDETACH = wxT(SECTION_TASK "detach");
|
|
|
|
const wxString LINKDESC_TASKDETACH =
|
|
|
|
_("<b>Detach from Project</b><br>"
|
2004-10-19 19:41:29 +00:00
|
|
|
"Clicking detach from project removes the computer from the currently "
|
2004-10-05 02:55:26 +00:00
|
|
|
"selected project. You may wish to update the project first to submit "
|
|
|
|
"any completed work.");
|
|
|
|
|
|
|
|
const wxString LINK_TASKRESET = wxT(SECTION_TASK "reset");
|
|
|
|
const wxString LINKDESC_TASKRESET =
|
|
|
|
_("<b>Reset Project</b><br>"
|
2004-10-19 19:41:29 +00:00
|
|
|
"Clicking reset project removes all workunits and applications from "
|
2004-10-05 02:55:26 +00:00
|
|
|
"the currently selected project. You may wish to update the project "
|
|
|
|
"first to submit any completed work.");
|
|
|
|
|
|
|
|
const wxString LINK_TASKSUSPEND = wxT(SECTION_TASK "suspend");
|
|
|
|
const wxString LINKDESC_TASKSUSPEND =
|
|
|
|
_("<b>Suspend Project</b><br>"
|
2004-10-19 19:41:29 +00:00
|
|
|
"Clicking suspend project will pause the project from any additional "
|
2004-10-05 02:55:26 +00:00
|
|
|
"computation for that project until the resume project option is selected.");
|
|
|
|
|
|
|
|
const wxString LINK_TASKRESUME = wxT(SECTION_TASK "resume");
|
|
|
|
const wxString LINKDESC_TASKRESUME =
|
|
|
|
_("<b>Resume Project</b><br>"
|
2004-10-19 19:41:29 +00:00
|
|
|
"Clicking resume project resumes computation for a project that has been"
|
2004-10-05 02:55:26 +00:00
|
|
|
"previously suspended.");
|
|
|
|
|
|
|
|
const wxString LINK_TASKUPDATE = wxT(SECTION_TASK "update");
|
|
|
|
const wxString LINKDESC_TASKUPDATE =
|
|
|
|
_("<b>Update Project</b><br>"
|
2004-10-19 19:41:29 +00:00
|
|
|
"Clicking update project submits any outstanding work and refreshes "
|
2004-10-05 02:55:26 +00:00
|
|
|
"your credit and preferences for the currently selected project.");
|
|
|
|
|
|
|
|
const wxString LINK_WEBBOINC = wxT(SECTION_WEB "boinc");
|
|
|
|
const wxString LINKDESC_WEBBOINC =
|
|
|
|
_("<b>BOINC Homepage</b><br>"
|
|
|
|
"This will open a browser window to the BOINC homepage.");
|
|
|
|
|
|
|
|
const wxString LINK_WEBPROJECT = wxT(SECTION_WEB "project");
|
|
|
|
const wxString LINKDESC_WEBPROJECT =
|
|
|
|
_("<b>Project Homepage</b><br>"
|
|
|
|
"This will open a browser window to the currently selected project "
|
|
|
|
"homepage.");
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
const wxString LINK_WEB = wxT(SECTION_WEB ":");
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CViewProjects, CBOINCBaseView)
|
|
|
|
|
|
|
|
|
|
|
|
CViewProjects::CViewProjects()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CViewProjects::CViewProjects(wxNotebook* pNotebook) :
|
|
|
|
CBOINCBaseView(pNotebook, ID_HTML_PROJECTSVIEW, ID_LIST_PROJECTSVIEW)
|
|
|
|
{
|
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
|
|
|
wxBitmap bmpProject(proj_xpm);
|
|
|
|
wxBitmap bmpTask(task_xpm);
|
|
|
|
wxBitmap bmpWeb(web_xpm);
|
|
|
|
wxBitmap bmpTips(tips_xpm);
|
2004-09-24 02:01:53 +00:00
|
|
|
wxBitmap bmpBOINC(boinc_xpm);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
|
|
|
bmpProject.SetMask(new wxMask(bmpProject, wxColour(255, 0, 255)));
|
2004-09-22 21:53:07 +00:00
|
|
|
bmpTask.SetMask(new wxMask(bmpTask, wxColour(255, 0, 255)));
|
|
|
|
bmpWeb.SetMask(new wxMask(bmpWeb, wxColour(255, 0, 255)));
|
|
|
|
bmpTips.SetMask(new wxMask(bmpTips, wxColour(255, 0, 255)));
|
2004-09-24 02:01:53 +00:00
|
|
|
bmpBOINC.SetMask(new wxMask(bmpBOINC, wxColour(255, 0, 255)));
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
m_pTaskPane->AddVirtualFile(BITMAP_PROJECTS, bmpProject, wxBITMAP_TYPE_XPM);
|
|
|
|
m_pTaskPane->AddVirtualFile(BITMAP_BOINC, bmpBOINC, wxBITMAP_TYPE_XPM);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
m_pTaskPane->CreateTaskHeader(BITMAP_TASKHEADER, bmpTask, _("Tasks"));
|
|
|
|
m_pTaskPane->CreateTaskHeader(BITMAP_WEBHEADER, bmpWeb, _("Websites"));
|
|
|
|
m_pTaskPane->CreateTaskHeader(BITMAP_TIPSHEADER, bmpTips, _("Quick Tips"));
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2004-10-19 19:41:29 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_PROJECT, _("Project"), wxLIST_FORMAT_LEFT, 150);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_ACCOUNTNAME, _("Account"), wxLIST_FORMAT_LEFT, 80);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_TEAMNAME, _("Team"), wxLIST_FORMAT_LEFT, 80);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_TOTALCREDIT, _("Total Credit"), wxLIST_FORMAT_RIGHT, 80);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_AVGCREDIT, _("Avg. Credit"), wxLIST_FORMAT_RIGHT, 80);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_RESOURCESHARE, _("Resource Share"), wxLIST_FORMAT_CENTRE, 85);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_STATUS, _("Status"), wxLIST_FORMAT_LEFT, 150);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2004-09-23 08:28:50 +00:00
|
|
|
m_bTipsHeaderHidden = false;
|
|
|
|
|
2004-09-24 02:01:53 +00:00
|
|
|
SetCurrentQuickTip(
|
2004-10-05 02:55:26 +00:00
|
|
|
LINK_DEFAULT,
|
2004-10-19 19:41:29 +00:00
|
|
|
LINKDESC_DEFAULT
|
2004-09-24 02:01:53 +00:00
|
|
|
);
|
2004-09-22 21:53:07 +00:00
|
|
|
|
2004-09-24 02:01:53 +00:00
|
|
|
UpdateSelection();
|
2004-09-21 01:30:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CViewProjects::~CViewProjects()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString CViewProjects::GetViewName()
|
|
|
|
{
|
|
|
|
return wxString(_("Projects"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char** CViewProjects::GetViewIcon()
|
|
|
|
{
|
|
|
|
return proj_xpm;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-26 08:41:02 +00:00
|
|
|
wxInt32 CViewProjects::GetListRowCount()
|
|
|
|
{
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
return pDoc->GetProjectCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
wxString CViewProjects::OnListGetItemText(long item, long column) const
|
|
|
|
{
|
2004-10-21 21:19:49 +00:00
|
|
|
wxString strBuffer = wxEmptyString;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
switch(column)
|
|
|
|
{
|
2004-09-21 01:30:29 +00:00
|
|
|
case COLUMN_PROJECT:
|
2004-10-21 21:19:49 +00:00
|
|
|
if (item == m_iCacheFrom) pDoc->CachedStateLock();
|
2004-10-22 00:41:18 +00:00
|
|
|
FormatProjectName( item, strBuffer );
|
2004-09-21 01:30:29 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_ACCOUNTNAME:
|
2004-10-22 00:41:18 +00:00
|
|
|
FormatAccountName( item, strBuffer );
|
2004-09-21 01:30:29 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_TEAMNAME:
|
2004-10-22 00:41:18 +00:00
|
|
|
FormatTeamName( item, strBuffer );
|
2004-09-21 01:30:29 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_TOTALCREDIT:
|
2004-10-22 00:41:18 +00:00
|
|
|
FormatTotalCredit( item, strBuffer );
|
2004-09-21 01:30:29 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_AVGCREDIT:
|
2004-10-22 00:41:18 +00:00
|
|
|
FormatAVGCredit( item, strBuffer );
|
2004-09-21 01:30:29 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_RESOURCESHARE:
|
2004-10-22 00:41:18 +00:00
|
|
|
FormatResourceShare( item, strBuffer );
|
2004-09-29 22:21:45 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_STATUS:
|
2004-10-22 00:41:18 +00:00
|
|
|
FormatStatus( item, strBuffer );
|
2004-10-21 21:19:49 +00:00
|
|
|
if (item == m_iCacheTo) pDoc->CachedStateUnlock();
|
2004-09-21 01:30:29 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
return strBuffer;
|
|
|
|
}
|
|
|
|
|
2004-09-22 21:53:07 +00:00
|
|
|
|
2004-09-24 02:01:53 +00:00
|
|
|
void CViewProjects::OnTaskLinkClicked( const wxHtmlLinkInfo& link )
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
wxInt32 iAnswer = 0;
|
|
|
|
wxInt32 iProjectIndex = 0;
|
|
|
|
wxInt32 iWebsiteIndex = 0;
|
|
|
|
wxString strProjectName = wxEmptyString;
|
|
|
|
wxString strURL = wxEmptyString;
|
|
|
|
wxString strMessage = wxEmptyString;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-09-24 02:01:53 +00:00
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
if ( link.GetHref() == SECTION_TASK )
|
2004-09-24 02:01:53 +00:00
|
|
|
m_bTaskHeaderHidden ? m_bTaskHeaderHidden = false : m_bTaskHeaderHidden = true;
|
2004-10-09 03:05:01 +00:00
|
|
|
else if ( link.GetHref() == LINK_TASKATTACH )
|
2004-09-24 02:01:53 +00:00
|
|
|
{
|
|
|
|
CDlgAttachProject* pDlg = new CDlgAttachProject(this);
|
|
|
|
wxASSERT(NULL != pDlg);
|
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
iAnswer = pDlg->ShowModal();
|
|
|
|
|
|
|
|
if ( wxOK == iAnswer )
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->ProjectAttach(
|
2004-09-25 21:33:24 +00:00
|
|
|
pDlg->m_strProjectAddress,
|
|
|
|
pDlg->m_strProjectAccountKey
|
|
|
|
);
|
|
|
|
}
|
2004-09-24 02:01:53 +00:00
|
|
|
|
|
|
|
if (pDlg)
|
|
|
|
pDlg->Destroy();
|
|
|
|
}
|
2004-10-09 03:05:01 +00:00
|
|
|
else if ( link.GetHref() == LINK_TASKDETACH )
|
2004-09-24 02:01:53 +00:00
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
|
|
|
pDoc->GetProjectProjectName(iProjectIndex, strProjectName);
|
2004-09-25 21:33:24 +00:00
|
|
|
|
2004-09-24 02:01:53 +00:00
|
|
|
strMessage.Printf(
|
|
|
|
_("Are you sure you wish to detach from project '%s'?"),
|
2004-09-25 21:33:24 +00:00
|
|
|
strProjectName.c_str());
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
iAnswer = wxMessageBox(
|
2004-09-24 02:01:53 +00:00
|
|
|
strMessage,
|
|
|
|
_("Detach from Project"),
|
|
|
|
wxYES_NO | wxICON_QUESTION,
|
|
|
|
this
|
|
|
|
);
|
|
|
|
|
|
|
|
if ( wxYES == iAnswer )
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->ProjectDetach(
|
2004-10-21 14:29:59 +00:00
|
|
|
iProjectIndex
|
2004-09-25 21:33:24 +00:00
|
|
|
);
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
|
|
|
}
|
2004-10-09 03:05:01 +00:00
|
|
|
else if ( link.GetHref() == LINK_TASKRESET )
|
2004-09-24 02:01:53 +00:00
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
|
|
|
pDoc->GetProjectProjectName(iProjectIndex, strProjectName);
|
2004-09-25 21:33:24 +00:00
|
|
|
|
2004-09-24 02:01:53 +00:00
|
|
|
strMessage.Printf(
|
|
|
|
_("Are you sure you wish to reset project '%s'?"),
|
2004-09-25 21:33:24 +00:00
|
|
|
strProjectName.c_str());
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
iAnswer = wxMessageBox(
|
2004-09-24 02:01:53 +00:00
|
|
|
strMessage,
|
|
|
|
_("Reset Project"),
|
|
|
|
wxYES_NO | wxICON_QUESTION,
|
|
|
|
this
|
|
|
|
);
|
|
|
|
|
|
|
|
if ( wxYES == iAnswer )
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->ProjectReset(
|
2004-10-21 14:29:59 +00:00
|
|
|
iProjectIndex
|
2004-09-25 21:33:24 +00:00
|
|
|
);
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
|
|
|
}
|
2004-10-09 03:05:01 +00:00
|
|
|
else if ( link.GetHref() == LINK_TASKUPDATE )
|
2004-09-28 01:19:46 +00:00
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
2004-09-28 01:19:46 +00:00
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->ProjectUpdate(
|
2004-10-21 14:29:59 +00:00
|
|
|
iProjectIndex
|
2004-09-28 01:19:46 +00:00
|
|
|
);
|
|
|
|
}
|
2004-10-09 03:05:01 +00:00
|
|
|
else if ( link.GetHref() == LINK_TASKSUSPEND )
|
2004-09-28 01:19:46 +00:00
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
2004-09-28 01:19:46 +00:00
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->ProjectSuspend(
|
2004-10-21 14:29:59 +00:00
|
|
|
iProjectIndex
|
2004-09-28 01:19:46 +00:00
|
|
|
);
|
|
|
|
}
|
2004-10-09 03:05:01 +00:00
|
|
|
else if ( link.GetHref() == LINK_TASKRESUME )
|
2004-09-28 01:19:46 +00:00
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
2004-09-28 01:19:46 +00:00
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->ProjectResume(
|
2004-10-21 14:29:59 +00:00
|
|
|
iProjectIndex
|
2004-09-28 01:19:46 +00:00
|
|
|
);
|
|
|
|
}
|
2004-10-09 03:05:01 +00:00
|
|
|
else if ( link.GetHref() == SECTION_WEB )
|
2004-09-24 02:01:53 +00:00
|
|
|
m_bWebsiteHeaderHidden ? m_bWebsiteHeaderHidden = false : m_bWebsiteHeaderHidden = true;
|
2004-10-09 03:05:01 +00:00
|
|
|
else if ( link.GetHref() == LINK_WEBBOINC )
|
|
|
|
{
|
|
|
|
ExecuteLink(wxT("http://boinc.berkeley.edu"));
|
|
|
|
}
|
|
|
|
else if ( link.GetHref() == LINK_WEBPROJECT )
|
|
|
|
{
|
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
|
|
|
pDoc->GetProjectProjectURL(iProjectIndex, strURL);
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
ExecuteLink(strURL);
|
|
|
|
}
|
|
|
|
else if ( link.GetHref().StartsWith( LINK_WEB ) )
|
|
|
|
{
|
|
|
|
ConvertLinkToWebsiteIndex( link.GetHref(), iProjectIndex, iWebsiteIndex );
|
|
|
|
pDoc->GetProjectWebsiteLink(iProjectIndex, iWebsiteIndex, strURL);
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
ExecuteLink(strURL);
|
|
|
|
}
|
|
|
|
else if ( link.GetHref() == SECTION_TIPS )
|
|
|
|
m_bTipsHeaderHidden ? m_bTipsHeaderHidden = false : m_bTipsHeaderHidden = true;
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2004-09-24 22:19:02 +00:00
|
|
|
UpdateSelection();
|
2004-10-21 14:29:59 +00:00
|
|
|
m_pListPane->Refresh();
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CViewProjects::OnTaskCellMouseHover( wxHtmlCell* cell, wxCoord x, wxCoord y )
|
|
|
|
{
|
|
|
|
if ( NULL != cell->GetLink() )
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
bool bUpdateSelection = false;
|
|
|
|
wxString strLink = wxEmptyString;
|
|
|
|
wxString strWebsiteLink = wxEmptyString;
|
|
|
|
wxString strWebsiteDescripton = wxEmptyString;
|
|
|
|
wxInt32 iProjectIndex = 0;
|
|
|
|
wxInt32 iWebsiteIndex = 0;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
2004-09-24 02:01:53 +00:00
|
|
|
|
|
|
|
strLink = cell->GetLink()->GetHref();
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
if ( UpdateQuickTip( strLink, LINK_TASKATTACH, LINKDESC_TASKATTACH ) )
|
|
|
|
bUpdateSelection = true;
|
|
|
|
else if ( UpdateQuickTip( strLink, LINK_TASKDETACH, LINKDESC_TASKDETACH ) )
|
|
|
|
bUpdateSelection = true;
|
|
|
|
else if ( UpdateQuickTip( strLink, LINK_TASKRESET, LINKDESC_TASKRESET ) )
|
|
|
|
bUpdateSelection = true;
|
|
|
|
else if ( UpdateQuickTip( strLink, LINK_TASKSUSPEND, LINKDESC_TASKSUSPEND ) )
|
|
|
|
bUpdateSelection = true;
|
|
|
|
else if ( UpdateQuickTip( strLink, LINK_TASKRESUME, LINKDESC_TASKRESUME ) )
|
|
|
|
bUpdateSelection = true;
|
|
|
|
else if ( UpdateQuickTip( strLink, LINK_TASKUPDATE, LINKDESC_TASKUPDATE ) )
|
|
|
|
bUpdateSelection = true;
|
|
|
|
else if ( UpdateQuickTip( strLink, LINK_WEBBOINC, LINKDESC_WEBBOINC ) )
|
|
|
|
bUpdateSelection = true;
|
|
|
|
else if ( UpdateQuickTip( strLink, LINK_WEBPROJECT, LINKDESC_WEBPROJECT ) )
|
|
|
|
bUpdateSelection = true;
|
2004-10-09 03:05:01 +00:00
|
|
|
else if ( IsWebsiteLink( strLink ) )
|
|
|
|
{
|
|
|
|
ConvertLinkToWebsiteIndex( strLink, iProjectIndex, iWebsiteIndex );
|
|
|
|
|
|
|
|
pDoc->GetProjectWebsiteDescription( iProjectIndex, iWebsiteIndex, strWebsiteDescripton );
|
|
|
|
|
|
|
|
UpdateQuickTip( strLink, strLink, strWebsiteDescripton );
|
|
|
|
|
|
|
|
bUpdateSelection = true;
|
|
|
|
}
|
2004-09-24 02:01:53 +00:00
|
|
|
else
|
|
|
|
{
|
2004-10-05 02:55:26 +00:00
|
|
|
if ( 0 == m_pListPane->GetSelectedItemCount() )
|
2004-09-24 02:01:53 +00:00
|
|
|
{
|
2004-10-05 03:40:28 +00:00
|
|
|
if ( LINK_DEFAULT != GetCurrentQuickTip() )
|
2004-09-24 02:01:53 +00:00
|
|
|
{
|
|
|
|
SetCurrentQuickTip(
|
2004-10-05 03:40:28 +00:00
|
|
|
LINK_DEFAULT,
|
2004-10-19 19:41:29 +00:00
|
|
|
LINKDESC_DEFAULT
|
2004-09-24 02:01:53 +00:00
|
|
|
);
|
|
|
|
|
2004-09-24 22:19:02 +00:00
|
|
|
bUpdateSelection = true;
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-24 22:19:02 +00:00
|
|
|
if ( bUpdateSelection )
|
2004-09-24 02:01:53 +00:00
|
|
|
{
|
2004-09-24 22:19:02 +00:00
|
|
|
UpdateSelection();
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CViewProjects::UpdateSelection()
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-09-24 02:01:53 +00:00
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
if ( 0 == m_pListPane->GetSelectedItemCount() )
|
2004-09-24 02:01:53 +00:00
|
|
|
{
|
|
|
|
m_bTaskHeaderHidden = false;
|
2004-10-09 03:05:01 +00:00
|
|
|
m_bTaskAttachHidden = false;
|
|
|
|
m_bTaskDetachHidden = true;
|
|
|
|
m_bTaskResetHidden = true;
|
|
|
|
m_bTaskSuspendHidden = true;
|
|
|
|
m_bTaskResumeHidden = true;
|
|
|
|
m_bTaskUpdateHidden = true;
|
2004-09-24 02:01:53 +00:00
|
|
|
|
|
|
|
m_bWebsiteHeaderHidden = false;
|
|
|
|
m_bWebsiteBOINCHidden = false;
|
|
|
|
m_bWebsiteProjectHidden = true;
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
if ( m_bItemSelected )
|
|
|
|
{
|
|
|
|
SetCurrentQuickTip(
|
|
|
|
LINK_DEFAULT,
|
|
|
|
wxT("")
|
|
|
|
);
|
|
|
|
}
|
2004-09-24 02:01:53 +00:00
|
|
|
m_bItemSelected = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_bTaskHeaderHidden = false;
|
2004-10-09 03:05:01 +00:00
|
|
|
m_bTaskAttachHidden = false;
|
|
|
|
m_bTaskDetachHidden = false;
|
|
|
|
m_bTaskResetHidden = false;
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
if ( pDoc->IsProjectSuspended(m_pListPane->GetFirstSelected()) )
|
2004-09-29 22:21:45 +00:00
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
m_bTaskSuspendHidden = true;
|
|
|
|
m_bTaskResumeHidden = false;
|
2004-09-29 22:21:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
m_bTaskSuspendHidden = false;
|
|
|
|
m_bTaskResumeHidden = true;
|
2004-09-29 22:21:45 +00:00
|
|
|
}
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
m_bTaskUpdateHidden = false;
|
2004-09-24 02:01:53 +00:00
|
|
|
|
|
|
|
m_bWebsiteHeaderHidden = false;
|
|
|
|
m_bWebsiteBOINCHidden = false;
|
|
|
|
m_bWebsiteProjectHidden = false;
|
|
|
|
|
|
|
|
m_bItemSelected = true;
|
|
|
|
}
|
|
|
|
UpdateTaskPane();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-22 21:53:07 +00:00
|
|
|
void CViewProjects::UpdateTaskPane()
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
wxInt32 iProjectIndex = 0;
|
|
|
|
wxInt32 iWebsiteIndex = 0;
|
|
|
|
wxInt32 iWebsiteCount = 0;
|
|
|
|
wxString strWebsiteName = wxEmptyString;
|
|
|
|
wxString strWebsiteLink = wxEmptyString;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-09-22 21:53:07 +00:00
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
|
|
|
|
m_pTaskPane->BeginTaskPage();
|
|
|
|
|
2004-10-05 03:40:28 +00:00
|
|
|
m_pTaskPane->BeginTaskSection( SECTION_TASK, BITMAP_TASKHEADER, m_bTaskHeaderHidden );
|
2004-09-23 08:28:50 +00:00
|
|
|
if (!m_bTaskHeaderHidden)
|
2004-09-22 21:53:07 +00:00
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
m_pTaskPane->CreateTask( LINK_TASKATTACH, BITMAP_PROJECTS, _("Attach to Project"), m_bTaskAttachHidden );
|
|
|
|
m_pTaskPane->CreateTask( LINK_TASKDETACH, BITMAP_PROJECTS, _("Detach from Project"), m_bTaskDetachHidden );
|
|
|
|
m_pTaskPane->CreateTask( LINK_TASKRESET, BITMAP_PROJECTS, _("Reset Project"), m_bTaskResetHidden );
|
|
|
|
m_pTaskPane->CreateTask( LINK_TASKSUSPEND, BITMAP_PROJECTS, _("Suspend Project"), m_bTaskSuspendHidden );
|
|
|
|
m_pTaskPane->CreateTask( LINK_TASKRESUME, BITMAP_PROJECTS, _("Resume Project"), m_bTaskResumeHidden );
|
|
|
|
m_pTaskPane->CreateTask( LINK_TASKUPDATE, BITMAP_PROJECTS, _("Update Project"), m_bTaskUpdateHidden );
|
2004-09-22 21:53:07 +00:00
|
|
|
}
|
2004-09-23 08:28:50 +00:00
|
|
|
m_pTaskPane->EndTaskSection( m_bTaskHeaderHidden );
|
2004-09-22 21:53:07 +00:00
|
|
|
|
|
|
|
|
2004-09-23 08:28:50 +00:00
|
|
|
m_pTaskPane->BeginTaskSection( wxT(SECTION_WEB), wxT(BITMAP_WEBHEADER), m_bWebsiteHeaderHidden );
|
|
|
|
if (!m_bWebsiteHeaderHidden)
|
2004-09-22 21:53:07 +00:00
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
m_pTaskPane->CreateTask( LINK_WEBBOINC, BITMAP_BOINC, _("BOINC"), m_bWebsiteBOINCHidden );
|
|
|
|
m_pTaskPane->CreateTask( LINK_WEBPROJECT, BITMAP_PROJECTS, _("Project"), m_bWebsiteProjectHidden );
|
|
|
|
|
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
|
|
|
if ( -1 != iProjectIndex )
|
|
|
|
{
|
|
|
|
iWebsiteCount = pDoc->GetProjectWebsiteCount(iProjectIndex);
|
|
|
|
for ( iWebsiteIndex = 0; iWebsiteIndex < iWebsiteCount; iWebsiteIndex++ )
|
|
|
|
{
|
|
|
|
ConvertWebsiteIndexToLink( iProjectIndex, iWebsiteIndex, strWebsiteLink );
|
|
|
|
pDoc->GetProjectWebsiteName(iProjectIndex, iWebsiteIndex, strWebsiteName);
|
|
|
|
|
|
|
|
m_pTaskPane->CreateTask( strWebsiteLink, BITMAP_PROJECTS, strWebsiteName, false );
|
|
|
|
}
|
|
|
|
}
|
2004-09-22 21:53:07 +00:00
|
|
|
}
|
2004-09-23 08:28:50 +00:00
|
|
|
m_pTaskPane->EndTaskSection(m_bWebsiteHeaderHidden);
|
2004-09-22 21:53:07 +00:00
|
|
|
|
2004-10-05 03:40:28 +00:00
|
|
|
m_pTaskPane->UpdateQuickTip( SECTION_TIPS, BITMAP_TIPSHEADER, GetCurrentQuickTipText(), m_bTipsHeaderHidden );
|
2004-09-22 21:53:07 +00:00
|
|
|
|
|
|
|
m_pTaskPane->EndTaskPage();
|
|
|
|
}
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
wxInt32 CViewProjects::FormatProjectName( wxInt32 item, wxString& strBuffer ) const
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
strBuffer.Clear();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectProjectName(item, strBuffer);
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::FormatAccountName( wxInt32 item, wxString& strBuffer ) const
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
strBuffer.Clear();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectAccountName(item, strBuffer);
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::FormatTeamName( wxInt32 item, wxString& strBuffer ) const
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
strBuffer.Clear();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectTeamName(item, strBuffer);
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::FormatTotalCredit( wxInt32 item, wxString& strBuffer ) const
|
|
|
|
{
|
|
|
|
float fBuffer;
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectTotalCredit(item, fBuffer);
|
2004-10-05 02:55:26 +00:00
|
|
|
strBuffer.Printf(wxT("%0.2f"), fBuffer);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::FormatAVGCredit( wxInt32 item, wxString& strBuffer ) const
|
|
|
|
{
|
|
|
|
float fBuffer;
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectAvgCredit(item, fBuffer);
|
2004-10-05 02:55:26 +00:00
|
|
|
strBuffer.Printf(wxT("%0.2f"), fBuffer);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::FormatResourceShare( wxInt32 item, wxString& strBuffer ) const
|
|
|
|
{
|
|
|
|
float fResourceShareBuffer;
|
|
|
|
float fTotalResourceShareBuffer;
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectResourceShare(item, fResourceShareBuffer);
|
|
|
|
pDoc->GetProjectTotalResourceShare(item, fTotalResourceShareBuffer);
|
2004-10-05 02:55:26 +00:00
|
|
|
strBuffer.Printf(wxT("%0.0f ( %0.2f%% )"), fResourceShareBuffer, ((fResourceShareBuffer / fTotalResourceShareBuffer) * 100));
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::FormatStatus( wxInt32 item, wxString& strBuffer ) const
|
|
|
|
{
|
|
|
|
wxInt32 iNextRPC;
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
if (pDoc->IsProjectSuspended(item))
|
2004-10-05 02:55:26 +00:00
|
|
|
{
|
|
|
|
strBuffer = _("Project Suspended");
|
|
|
|
}
|
2004-10-09 03:05:01 +00:00
|
|
|
else if (pDoc->IsProjectRPCPending(item))
|
2004-10-05 02:55:26 +00:00
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectMinRPCTime(item, iNextRPC);
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
wxDateTime dtNextRPC((time_t)iNextRPC);
|
|
|
|
wxDateTime dtNow(wxDateTime::Now());
|
|
|
|
|
|
|
|
if (dtNextRPC > dtNow)
|
|
|
|
{
|
|
|
|
wxTimeSpan tsNextRPC(dtNextRPC - dtNow);
|
|
|
|
strBuffer = _("Retry in ") + tsNextRPC.Format();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
|
|
|
|
bool CViewProjects::IsWebsiteLink( const wxString& strLink )
|
|
|
|
{
|
|
|
|
bool bReturnValue = false;
|
|
|
|
|
|
|
|
if ( strLink.StartsWith( LINK_WEB + wxT(":") ) )
|
|
|
|
bReturnValue = true;
|
|
|
|
|
|
|
|
return bReturnValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::ConvertWebsiteIndexToLink( wxInt32 iProjectIndex, wxInt32 iWebsiteIndex, wxString& strLink )
|
|
|
|
{
|
2004-10-21 22:52:56 +00:00
|
|
|
strLink.Printf(wxT("%s:%d:%d"), LINK_WEB.c_str(), iProjectIndex, iWebsiteIndex);
|
2004-10-09 03:05:01 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::ConvertLinkToWebsiteIndex( const wxString& strLink, wxInt32& iProjectIndex, wxInt32& iWebsiteIndex )
|
|
|
|
{
|
|
|
|
wxString strTemplate = strLink;
|
|
|
|
wxString strBuffer = wxEmptyString;
|
|
|
|
|
|
|
|
strTemplate.Replace( LINK_WEB + wxT(":"), wxEmptyString );
|
|
|
|
|
|
|
|
strBuffer = strTemplate;
|
|
|
|
strBuffer.Remove( strBuffer.Find( wxT(":") ) );
|
|
|
|
strBuffer.ToLong( (long*) &iProjectIndex );
|
|
|
|
|
|
|
|
strBuffer = strTemplate;
|
|
|
|
strBuffer = strBuffer.Mid( strBuffer.Find( wxT(":") ) + 1 );
|
|
|
|
strBuffer.ToLong( (long*) &iWebsiteIndex );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CViewProjects::ExecuteLink( const wxString &strLink )
|
|
|
|
{
|
|
|
|
wxString strMimeType = wxEmptyString;
|
|
|
|
|
|
|
|
if ( strLink.StartsWith(wxT("http://")) )
|
|
|
|
strMimeType = wxT("text/html");
|
|
|
|
else if ( strLink.StartsWith(wxT("ftp://")) )
|
|
|
|
strMimeType = wxT("text/html");
|
|
|
|
else if ( strLink.StartsWith(wxT("mailto:")) )
|
|
|
|
strMimeType = wxT("message/rfc822");
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
|
|
|
|
wxFileType* ft = wxTheMimeTypesManager->GetFileTypeFromMimeType(strMimeType);
|
|
|
|
if ( ft )
|
|
|
|
{
|
|
|
|
wxString cmd;
|
|
|
|
if ( ft->GetOpenCommand( &cmd, wxFileType::MessageParameters(strLink) ) )
|
|
|
|
{
|
|
|
|
cmd.Replace(wxT("file://"), wxEmptyString);
|
|
|
|
::wxExecute(cmd);
|
|
|
|
}
|
|
|
|
|
|
|
|
delete ft;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|