~ubuntu-branches/ubuntu/trusty/ginkgocadx/trusty

« back to all changes in this revision

Viewing changes to src/cadxcore/main/gui/ginkgocloud/openginkgoclouddialog.cpp

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2013-07-21 11:58:53 UTC
  • mfrom: (7.2.1 sid)
  • Revision ID: package-import@ubuntu.com-20130721115853-44e7n1xujqglu78e
Tags: 3.4.0.928.29+dfsg-1
* New upstream release [July 2013]
  + new B-D: "libjsoncpp-dev".
  + new patch "unbundle-libjsoncpp.patch" to avoid building bundled
    "libjsoncpp-dev".
  + new patch "fix-wx.patch" to avoid FTBFS due to missing
    "-lwx_gtk2u_html-2.8".
* Removed unnecessary versioned Build-Depends.
* Removed obsolete lintian override.
* Reference get-orig-source implementation for orig.tar clean-up and
  DFSG-repackaging.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
*  
 
3
*  $Id: selectexternalfiles.cpp $
 
4
*  Ginkgo CADx Project
 
5
*
 
6
*  Copyright 2008-12 MetaEmotion S.L. All rights reserved.
 
7
*  http://ginkgo-cadx.com
 
8
*
 
9
*  This file is licensed under LGPL v3 license.
 
10
*  See License.txt for details
 
11
*
 
12
*
 
13
*/
 
14
 
 
15
#include "openginkgoclouddialog.h"
 
16
#include <commands/cloudcommand.h>
 
17
#include <main/controllers/commandcontroller.h>
 
18
#include <resources/ginkgoresourcesmanager.h>
 
19
 
 
20
#include <wx/msgdlg.h>
 
21
 
 
22
GNC::GUI::OpenGinkgoCloudDialog::OpenGinkgoCloudDialog(wxWindow* pParent): GNC::GUI::OpenGinkgoCloudDialogBase(pParent)
 
23
{
 
24
        wxIcon icono;
 
25
        icono.CopyFromBitmap(GinkgoResourcesManager::Logos::GetLogoGinkgo32x32());
 
26
        this->SetIcon(icono);
 
27
 
 
28
        m_pFileLink->SetFocus();
 
29
}
 
30
 
 
31
GNC::GUI::OpenGinkgoCloudDialog::~OpenGinkgoCloudDialog()
 
32
{
 
33
}
 
34
 
 
35
void GNC::GUI::OpenGinkgoCloudDialog::OnAccept(wxCommandEvent &)
 
36
{
 
37
        wxString link = m_pFileLink->GetValue().Trim(true).Trim(false);
 
38
        if (!link.StartsWith(wxT("ginkgocadx://cloud:"))) {
 
39
                wxMessageBox(_("Invalid link"), wxT("Ginkgo Cloud"), wxICON_WARNING|wxOK);
 
40
                return;
 
41
        } else {
 
42
                std::string stdLink(link.SubString(19, link.size()-1).ToUTF8());
 
43
                //call to command
 
44
                GNC::GCS::CloudGetCommandParams* pParams = new GNC::GCS::CloudGetCommandParams(stdLink, true);
 
45
                GNC::GCS::CloudCommand* pCmd = new GNC::GCS::CloudCommand(pParams);
 
46
                GNC::CommandController::Instance()->ProcessAsync("Downloading...", pCmd, NULL);
 
47
                //
 
48
                Close();
 
49
        }
 
50
}
 
51
 
 
52
void GNC::GUI::OpenGinkgoCloudDialog::OnCancel(wxCommandEvent& )
 
53
{
 
54
        Close();
 
55
}
 
56
 
 
57
void GNC::GUI::OpenGinkgoCloudDialog::OnKeyUp(wxKeyEvent &evt)
 
58
{
 
59
        if (evt.GetKeyCode() == WXK_ESCAPE) {
 
60
                Close();
 
61
        } else if (evt.GetKeyCode() == WXK_NUMPAD_ENTER || evt.GetKeyCode() == WXK_RETURN) {
 
62
                wxCommandEvent evt;
 
63
                OnAccept(evt);
 
64
        }
 
65
        evt.Skip();
 
66
}