3 /// Class for the fixed-size frame that holds the main app
7 Copyright (C) 2009-2011, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #include "BaseFrame.h"
23 #include "Mode_MainMenu.h"
24 #include "Mode_Sync.h"
25 #include "Mode_Browse.h"
26 #include "ClickImage.h"
27 #include "barrydesktop.h"
28 #include "windowids.h"
29 #include <wx/aboutdlg.h>
33 // include icons and logos
34 #include "../images/barry_logo_icon.xpm"
35 #include "../images/logo_NetDirect.xpm"
39 BEGIN_EVENT_TABLE(BaseFrame
, wxFrame
)
40 EVT_SIZE (BaseFrame::OnSize
)
41 EVT_PAINT (BaseFrame::OnPaint
)
42 EVT_MOTION (BaseFrame::OnMouseMotion
)
43 EVT_LEFT_DOWN (BaseFrame::OnLeftDown
)
44 EVT_LEFT_UP (BaseFrame::OnLeftUp
)
45 EVT_BUTTON (MainMenu_BackupAndRestore
, BaseFrame::OnBackupRestore
)
46 EVT_BUTTON (MainMenu_Sync
, BaseFrame::OnSync
)
47 EVT_BUTTON (MainMenu_Modem
, BaseFrame::OnModem
)
48 EVT_BUTTON (MainMenu_AppLoader
, BaseFrame::OnAppLoader
)
49 EVT_BUTTON (MainMenu_DeviceSwitch
, BaseFrame::OnDeviceSwitch
)
50 EVT_BUTTON (MainMenu_BrowseDatabases
, BaseFrame::OnBrowseDatabases
)
51 EVT_BUTTON (MainMenu_MediaManagement
, BaseFrame::OnMediaManagement
)
52 EVT_BUTTON (MainMenu_Misc
, BaseFrame::OnMisc
)
53 EVT_BUTTON (MainMenu_BackButton
, BaseFrame::OnBackButton
)
54 EVT_BUTTON (HotImage_BarryLogo
, BaseFrame::OnBarryLogoClicked
)
55 EVT_BUTTON (HotImage_NetDirectLogo
, BaseFrame::OnNetDirectLogoClicked
)
56 EVT_TEXT (Ctrl_DeviceCombo
, BaseFrame::OnDeviceComboChange
)
57 EVT_MENU (SysMenu_VerboseLogging
, BaseFrame::OnVerboseLogging
)
58 EVT_MENU (SysMenu_RenameDevice
, BaseFrame::OnRenameDevice
)
59 EVT_MENU (SysMenu_ResetDevice
, BaseFrame::OnResetDevice
)
60 EVT_MENU (SysMenu_RescanUsb
, BaseFrame::OnRescanUsb
)
61 EVT_MENU (SysMenu_About
, BaseFrame::OnAbout
)
62 EVT_MENU (SysMenu_Exit
, BaseFrame::OnExit
)
63 EVT_END_PROCESS (Process_BackupAndRestore
, BaseFrame::OnTermBackupAndRestore
)
66 //////////////////////////////////////////////////////////////////////////////
69 BaseFrame::BaseFrame(const wxImage
&background
)
70 : wxFrame(NULL
, wxID_ANY
, _T("Barry Desktop Control Panel"),
72 wxSize(background
.GetWidth(), background
.GetHeight()),
73 wxMINIMIZE_BOX
| wxCAPTION
| wxCLOSE_BOX
| wxSYSTEM_MENU
|
75 , TermCatcher(this, Process_BackupAndRestore
)
76 , m_width(background
.GetWidth())
77 , m_height(background
.GetHeight())
79 , m_backup_process(this)
81 // This is a workaround for different size behaviour
82 // in the GTK version of wxWidgets 2.9
83 SetClientSize(wxSize(background
.GetWidth(), background
.GetHeight()));
86 m_background
.reset( new wxBitmap(background
) );
88 // the main menu mode always exists, but may not always be current
89 m_main_menu_mode
.reset( new MainMenuMode(this) );
90 m_current_mode
= m_main_menu_mode
.get();
92 m_barry_logo
.reset( new ClickableImage(this,
93 wxBitmap(barry_logo_icon_xpm
), HotImage_BarryLogo
,
95 wxBitmap
nd_logo(logo_NetDirect_xpm
);
96 m_netdirect_logo
.reset( new ClickableImage(this,
97 nd_logo
, HotImage_NetDirectLogo
,
98 m_width
- 3 - nd_logo
.GetWidth(),
99 (MAIN_HEADER_OFFSET
- nd_logo
.GetHeight()) / 2, true,
102 // Create the Barry Logo popup system menu
103 m_sysmenu
.reset( new wxMenu
);
104 m_sysmenu
->Append( new wxMenuItem(m_sysmenu
.get(),
105 SysMenu_VerboseLogging
, _T("&Verbose Logging"),
106 _T("Enable low level USB debug output"), wxITEM_CHECK
, NULL
) );
107 m_sysmenu
->Append(SysMenu_RenameDevice
, _T("Re&name Device..."));
108 m_sysmenu
->Append(SysMenu_ResetDevice
, _T("Re&set Device"));
109 m_sysmenu
->Append(SysMenu_RescanUsb
, _T("&Rescan USB"));
110 m_sysmenu
->AppendSeparator();
111 m_sysmenu
->Append(SysMenu_About
, _T("&About..."));
112 m_sysmenu
->AppendSeparator();
113 m_sysmenu
->Append(wxID_EXIT
, _T("E&xit"));
116 CreateDeviceCombo(wxGetApp().GetGlobalConfig().GetLastDevice());
119 void BaseFrame::UpdateMenuState()
121 if( !m_sysmenu
.get() )
124 wxMenuItemList
&list
= m_sysmenu
->GetMenuItems();
125 wxMenuItemList::iterator b
= list
.begin();
126 for( ; b
!= list
.end(); ++b
) {
127 wxMenuItem
*item
= *b
;
129 switch( item
->GetId() )
131 case SysMenu_VerboseLogging
:
132 item
->Check(Barry::IsVerbose());
138 void BaseFrame::CreateDeviceCombo(Barry::Pin pin
)
140 const Barry::Probe::Results
&results
= wxGetApp().GetResults();
143 // no device selected, if multiple available and no default given
144 // no devices available, if nothing there
145 // the first device, if only one exists
148 // create a list of selections
149 wxArrayString devices
;
151 // if there's more than one device, let the user pick "none"
152 if( results
.size() > 1 ) {
153 devices
.Add(_T("No device selected"));
156 // add one entry for each device
157 for( Barry::Probe::Results::const_iterator i
= results
.begin();
158 i
!= results
.end(); ++i
) {
159 std::ostringstream oss
;
160 oss
<< i
->m_pin
.Str();
161 if( i
->m_cfgDeviceName
.size() ) {
162 oss
<< " (" << i
->m_cfgDeviceName
<< ")";
165 // if this is the desired item, remember this selection
166 if( pin
.Valid() && i
->m_pin
== pin
) {
167 selected
= devices
.GetCount();
170 devices
.Add(wxString(oss
.str().c_str(), wxConvUTF8
));
173 // if nothing is there, be descriptive
174 if( devices
.GetCount() == 0 ) {
175 devices
.Add(_T("No devices available"));
178 // create the combobox
179 int x
= m_width
- 300;
180 int y
= m_height
- (MAIN_HEADER_OFFSET
- 5);
181 m_device_combo
.reset( new wxComboBox(this, Ctrl_DeviceCombo
, _T(""),
182 wxPoint(x
, y
), wxSize(290, -1), devices
, wxCB_READONLY
) );
184 // select the desired entry
185 m_device_combo
->SetValue(devices
[selected
]);
187 // update the screenshot
188 m_main_menu_mode
->UpdateScreenshot(GetCurrentComboPin());
191 Barry::Pin
BaseFrame::GetCurrentComboPin()
193 // fetch newly selected device
194 wxString value
= m_device_combo
->GetValue();
195 istringstream
iss(string(value
.utf8_str()).substr(0,8));
201 void BaseFrame::EnableBackButton(Mode
*new_mode
)
203 // create the button - this goes in the bottom FOOTER area
204 // so the height must be fixed to MAIN_HEADER_OFFSET
205 // minus a border of 5px top and bottom
206 wxPoint
pos(10, m_height
- (MAIN_HEADER_OFFSET
- 5));
207 wxSize
size(-1, MAIN_HEADER_OFFSET
- 5 - 5);
209 m_back_button
.reset( new wxButton(this, MainMenu_BackButton
,
210 _T("Main Menu"), pos
, size
) );
213 m_current_mode
= new_mode
;
215 // destroy the device switcher combo box
216 m_device_combo
.reset();
218 // without the device combo, there is no concept of a
219 // "current device" so temporarily disable the USB options
220 m_sysmenu
->Enable(SysMenu_RenameDevice
, false);
221 m_sysmenu
->Enable(SysMenu_ResetDevice
, false);
222 m_sysmenu
->Enable(SysMenu_RescanUsb
, false);
228 void BaseFrame::DisableBackButton()
230 // destroy the back button
231 m_back_button
.reset();
235 m_browse_mode
.reset();
237 // create the device switcher combo again
238 CreateDeviceCombo(wxGetApp().GetGlobalConfig().GetLastDevice());
240 // enable the USB menu options
241 Barry::Pin pin
= GetCurrentComboPin();
242 m_sysmenu
->Enable(SysMenu_RenameDevice
, pin
.Valid());
243 m_sysmenu
->Enable(SysMenu_ResetDevice
, true);
244 m_sysmenu
->Enable(SysMenu_RescanUsb
, true);
246 // reset the current mode to main menu and repaint
247 m_current_mode
= m_main_menu_mode
.get();
251 void BaseFrame::OnSize(wxSizeEvent
&event
)
255 void BaseFrame::OnPaint(wxPaintEvent
&event
)
258 dc
.SetMapMode(wxMM_TEXT
);
260 // paint the background image
261 dc
.DrawBitmap(*m_background
, 0, 0);
263 // paint the header: Barry logo
264 m_barry_logo
->Draw(dc
);
266 // paint the header: NetDirect logo
267 // m_netdirect_logo->Draw(dc);
269 // paint the header: text
270 auto_ptr
<wxFont
> font( wxFont::New(14,
271 wxFONTFAMILY_SWISS
, wxFONTFLAG_ANTIALIASED
,
274 dc
.SetTextForeground( wxColour(0xd2, 0xaf, 0x0b) );
275 dc
.SetTextBackground( wxColour(0, 0, 0, wxALPHA_TRANSPARENT
) );
277 long width
, height
, descent
;
278 wxString header
= _T("Barry Desktop Control Panel");
280 header
= m_current_mode
->GetTitleText();
281 dc
.GetTextExtent(header
, &width
, &height
, &descent
);
282 int x
= (m_width
- width
) / 2;
283 int y
= (MAIN_HEADER_OFFSET
- height
) / 2;
284 dc
.DrawText(header
, x
, y
);
286 // let the mode do its thing
288 m_current_mode
->OnPaint(dc
);
291 void BaseFrame::OnMouseMotion(wxMouseEvent
&event
)
294 m_barry_logo
->HandleMotion(dc
, event
.m_x
, event
.m_y
);
295 // m_netdirect_logo->HandleMotion(dc, event.m_x, event.m_y);
299 m_current_mode
->OnMouseMotion(dc
, event
.m_x
, event
.m_y
);
302 void BaseFrame::OnLeftDown(wxMouseEvent
&event
)
305 m_barry_logo
->HandleDown(dc
, event
.m_x
, event
.m_y
);
306 // m_netdirect_logo->HandleDown(dc, event.m_x, event.m_y);
311 m_current_mode
->OnLeftDown(dc
, event
.m_x
, event
.m_y
);
314 void BaseFrame::OnLeftUp(wxMouseEvent
&event
)
317 m_barry_logo
->HandleUp(dc
, event
.m_x
, event
.m_y
);
318 // m_netdirect_logo->HandleUp(dc, event.m_x, event.m_y);
322 m_current_mode
->OnLeftUp(dc
, event
.m_x
, event
.m_y
);
325 void BaseFrame::OnBackupRestore(wxCommandEvent
&event
)
327 if( m_backup_process
.IsAppRunning() ) {
328 wxMessageBox(_T("The Backup program is already running!"),
329 _T("Backup and Restore"), wxOK
| wxICON_INFORMATION
);
333 if( !m_backup_process
.Run(this, "Backup and Restore", _T("barrybackup")) )
337 void BaseFrame::OnSync(wxCommandEvent
&event
)
339 if( wxGetApp().GetOpenSync().GetAvailable() == 0 ) {
340 wxGetApp().ShowMissingOpenSyncMessage();
345 m_sync_mode
.reset( new SyncMode(this) );
347 catch( std::exception
&e
) {
349 "An error occurred that prevented the loading of Sync\n"
350 "mode. This is most likely because a critical piece\n"
351 "of OpenSync is missing. Check that all required\n"
352 "plugins are installed, and that tools like 'bidentify'\n"
353 "can find your BlackBerry successfully.\n\n"
355 msg
+= wxString(e
.what(), wxConvUTF8
);
356 wxMessageBox(msg
, _T("Sync Mode"), wxOK
| wxICON_ERROR
);
360 EnableBackButton(m_sync_mode
.get());
363 //#include "ConflictDlg.h"
364 void BaseFrame::OnModem(wxCommandEvent
&event
)
367 OpenSync::SyncChange change;
369 change.member_id = 1;
370 change.plugin_name = "barry-sync";
371 change.uid = "12341524235234";
372 change.printable_data =
375 " <NodeName>PRODID</NodeName>\n"
376 " <Content>-//OpenSync//NONSGML Barry Contact Record//EN</Content>\n"
379 " <Content>Adame Brandee</Content>\n"
380 " </FormattedName>\n"
382 " <LastName>Brandee</LastName>\n"
383 " <FirstName>Adame</FirstName>\n"
386 " <Content>71 Long St.\n"
387 "Toronto ON Canada\n"
388 "N0N 0N0</Content>\n"
389 " <Type>home</Type>\n"
392 " <Street>71 Long St.</Street>\n"
393 " <City>Toronto</City>\n"
394 " <Region>ON</Region>\n"
395 " <PostalCode>N0N 0N0</PostalCode>\n"
396 " <Country>Canada</Country>\n"
397 " <Type>home</Type>\n"
400 " <Content>+1 (416) 555-7711</Content>\n"
401 " <Type>voice</Type>\n"
402 " <Type>home</Type>\n"
405 " <Content>+1 (416) 955-7117</Content>\n"
406 " <Type>msg</Type>\n"
407 " <Type>cell</Type>\n"
410 " <Content>abrandee@sympatico.ca</Content>\n"
411 " <Type>internet</Type>\n"
412 " <Type>pref</Type>\n"
415 " <Category>Personal</Category>\n"
418 " <Content>Interweb salesman... 24/7</Content>\n"
422 std::vector<OpenSync::SyncChange> changes;
423 changes.push_back(change);
426 change.member_id = 2;
427 change.plugin_name = "evo2-sync";
428 change.uid = "asdfioausdf_1235234as_asdf12341524235234";
429 change.printable_data =
432 " <Content>+1 (416) 955-7117</Content>\n"
433 " <Type>CELL</Type>\n"
437 " <Content>+1 (416) 555-7711</Content>\n"
438 " <Type>HOME</Type>\n"
439 " <Type>VOICE</Type>\n"
443 " <Content>abrandee@sympatico.ca</Content>\n"
444 " <Type>OTHER</Type>\n"
448 " <Content>FALSE</Content>\n"
451 " <Content>20100322T225303Z</Content>\n"
454 " <NodeName>PRODID</NodeName>\n"
455 " <Content>-//OpenSync//NONSGML Barry Contact Record//EN</Content>\n"
458 " <Content>Adam Brandeee</Content>\n"
459 " </FormattedName>\n"
461 " <LastName>Brandeee</LastName>\n"
462 " <FirstName>Adam</FirstName>\n"
465 " <Content>71 Long St.\n"
469 " <Type>home</Type>\n"
472 " <Street>71 Long St.</Street>\n"
473 " <City>Toronto</City>\n"
474 " <Region>ON</Region>\n"
475 " <PostalCode>N0N 0N1</PostalCode>\n"
476 " <Country>Canada</Country>\n"
477 " <Type>home</Type>\n"
480 " <Category>Personal</Category>\n"
483 " <Content>Brandeee, Adam</Content>\n"
487 changes.push_back(change);
490 ConflictDlg::AlwaysMemoryBlock always;
491 ConflictDlg dlg(this, *wxGetApp().GetOpenSync().os22(),
492 "SDAIN", changes, always);
494 wxString msg(dlg.GetCommand().c_str(), wxConvUTF8);
496 msg += always.m_always ? _T("always") : _T("not always");
502 void BaseFrame::OnAppLoader(wxCommandEvent
&event
)
505 OpenSync::SyncChange change;
507 change.member_id = 1;
508 change.plugin_name = "barry-sync";
509 change.uid = "12341524235234";
510 change.printable_data =
514 " <Content>0</Content>\n"
517 " <Content>Subject</Content>\n"
520 " <Content>Bring burnt offering</Content>\n"
523 " <Content>Tent</Content>\n"
526 " <Content>20100506T040000Z</Content>\n"
529 " <Content>20100507T040000Z</Content>\n"
532 " <AlarmAction>AUDIO</AlarmAction>\n"
534 " <Content>20100506T034500Z</Content>\n"
535 " <Value>DATE-TIME</Value>\n"
541 std::vector<OpenSync::SyncChange> changes;
542 changes.push_back(change);
545 change.member_id = 2;
546 change.plugin_name = "evo2-sync";
547 change.uid = "asdfioausdf_1235234as_asdf12341524235234";
548 change.printable_data =
551 " <Content>PUBLISH</Content>\n"
554 " <TimezoneID>/softwarestudio.org/Tzfile/America/Thunder_Bay</TimezoneID>\n"
555 " <Location>America/Thunder_Bay</Location>\n"
557 " <TimezoneName>EST</TimezoneName>\n"
558 " <DateStarted>19701107T010000</DateStarted>\n"
559 " <RecurrenceRule>\n"
560 " <Rule>FREQ=YEARLY</Rule>\n"
561 " <Rule>INTERVAL=1</Rule>\n"
562 " <Rule>BYDAY=2SU</Rule>\n"
563 " <Rule>BYMONTH=11</Rule>\n"
564 " </RecurrenceRule>\n"
565 " <TZOffsetFrom>-0400</TZOffsetFrom>\n"
566 " <TZOffsetTo>-0500</TZOffsetTo>\n"
568 " <DaylightSavings>\n"
569 " <TimezoneName>EDT</TimezoneName>\n"
570 " <DateStarted>19700313T030000</DateStarted>\n"
571 " <RecurrenceRule>\n"
572 " <Rule>FREQ=YEARLY</Rule>\n"
573 " <Rule>INTERVAL=1</Rule>\n"
574 " <Rule>BYDAY=2SU</Rule>\n"
575 " <Rule>BYMONTH=3</Rule>\n"
576 " </RecurrenceRule>\n"
577 " <TZOffsetFrom>-0500</TZOffsetFrom>\n"
578 " <TZOffsetTo>-0400</TZOffsetTo>\n"
579 " </DaylightSavings>\n"
583 " <Content>1</Content>\n"
586 " <Content>Celebration day</Content>\n"
589 " <Content>Tent of</Content>\n"
592 " <Content>20100506T000000</Content>\n"
593 " <TimezoneID>/softwarestudio.org/Tzfile/America/Thunder_Bay</TimezoneID>\n"
596 " <Content>20100507T000000</Content>\n"
597 " <TimezoneID>/softwarestudio.org/Tzfile/America/Thunder_Bay</TimezoneID>\n"
599 " <DateCalendarCreated>\n"
600 " <Content>20100430T214736Z</Content>\n"
601 " </DateCalendarCreated>\n"
603 " <Content>20100430T214736</Content>\n"
606 " <Content>20100430T214927</Content>\n"
609 " <Content>Bring burnt offering</Content>\n"
612 " <Content>PUBLIC</Content>\n"
615 " <Content>OPAQUE</Content>\n"
618 " <AlarmAction>AUDIO</AlarmAction>\n"
620 " <Content>20100506T034500Z</Content>\n"
621 " <Value>DATE-TIME</Value>\n"
628 changes.push_back(change);
631 ConflictDlg::AlwaysMemoryBlock always;
632 ConflictDlg dlg(this, *wxGetApp().GetOpenSync().os22(),
633 "SDAIN", changes, always);
635 wxString msg(dlg.GetCommand().c_str(), wxConvUTF8);
637 msg += always.m_always ? _T("always") : _T("not always");
643 void BaseFrame::OnDeviceSwitch(wxCommandEvent
&event
)
647 void BaseFrame::OnBrowseDatabases(wxCommandEvent
&event
)
649 int i
= Barry::Probe::Find(wxGetApp().GetResults(), GetCurrentComboPin());
651 wxMessageBox(_T("There is no device selected in the device list. Please select a device to browse."),
652 _T("Database Browser Mode"), wxOK
| wxICON_ERROR
);
657 m_browse_mode
.reset( new BrowseMode(this,
658 wxGetApp().GetResults()[i
]) );
660 catch( std::exception
&e
) {
662 "An error occurred that prevented the loading of Database\n"
663 "Browse mode. This could be due to a low level USB\n"
664 "issue. Please make sure your device is plugged in\n"
665 "and not in Desktop Mode. If it is, try replugging\n"
666 "the device, and rescanning the USB bus from the menu.\n"
669 msg
+= wxString(e
.what(), wxConvUTF8
);
670 wxMessageBox(msg
, _T("Database Browser Mode"), wxOK
| wxICON_ERROR
);
674 EnableBackButton(m_browse_mode
.get());
677 void BaseFrame::OnMediaManagement(wxCommandEvent
&event
)
681 void BaseFrame::OnMisc(wxCommandEvent
&event
)
685 void BaseFrame::OnBackButton(wxCommandEvent
&event
)
690 void BaseFrame::OnTermBackupAndRestore(wxProcessEvent
&event
)
692 barryverbose("OnTermBackupAndRestore(): done = "
693 << (!m_backup_process
.IsAppRunning() ? "true" : "false")
694 << ", status = " << m_backup_process
.GetAppStatus());
695 if( !m_backup_process
.IsAppRunning() &&
696 m_backup_process
.GetAppStatus() )
698 wxMessageBox(_T("Unable to run barrybackup, or it returned an error. Please make sure it is installed and in your PATH."),
699 _T("Backup and Restore"), wxOK
| wxICON_ERROR
);
703 void BaseFrame::OnBarryLogoClicked(wxCommandEvent
&event
)
705 PopupMenu(m_sysmenu
.get(), 20, 20);
708 void BaseFrame::OnNetDirectLogoClicked(wxCommandEvent
&event
)
710 // fire up a browser to point to the Barry documentation
712 ::wxLaunchDefaultBrowser(_T("http://netdirect.ca/barry"));
715 void BaseFrame::OnDeviceComboChange(wxCommandEvent
&event
)
717 Barry::Pin pin
= GetCurrentComboPin();
720 if( pin
== wxGetApp().GetGlobalConfig().GetLastDevice() )
724 wxGetApp().GetGlobalConfig().SetLastDevice(pin
);
727 m_sysmenu
->Enable(SysMenu_RenameDevice
, false);
729 // update the main mode's screenshot
730 m_main_menu_mode
->UpdateScreenshot(pin
);
731 if( m_current_mode
== m_main_menu_mode
.get() )
734 // FIXME - if inside a sub menu mode, we need to destroy the mode
735 // class and start fresh
738 void BaseFrame::OnVerboseLogging(wxCommandEvent
&event
)
740 Barry::Verbose( !Barry::IsVerbose() );
741 wxGetApp().GetGlobalConfig().SetVerboseLogging( Barry::IsVerbose() );
745 void BaseFrame::OnRenameDevice(wxCommandEvent
&event
)
747 Barry::Pin pin
= GetCurrentComboPin();
751 // grab the current known name of the device
752 const Barry::Probe::Results
&results
= wxGetApp().GetResults();
753 int index
= Barry::Probe::Find(results
, pin
);
757 wxString
current_name(results
[index
].m_cfgDeviceName
.c_str(), wxConvUTF8
);
758 wxTextEntryDialog
dlg(this,
759 _T("Please enter a name for the current device:"),
761 current_name
, wxTextEntryDialogStyle
);
763 if( dlg
.ShowModal() != wxID_OK
)
764 return; // nothing to do
765 wxString name
= dlg
.GetValue();
766 if( name
== current_name
)
767 return; // nothing to do
769 wxGetApp().SetDeviceName(pin
, string(name
.utf8_str()));
772 CreateDeviceCombo(wxGetApp().GetGlobalConfig().GetLastDevice());
775 void BaseFrame::OnResetDevice(wxCommandEvent
&event
)
777 int i
= Barry::Probe::Find(wxGetApp().GetResults(), GetCurrentComboPin());
779 Usb::Device
dev(wxGetApp().GetResults()[i
].m_dev
);
787 void BaseFrame::OnRescanUsb(wxCommandEvent
&event
)
789 if( m_current_mode
== m_main_menu_mode
.get() ) {
790 std::auto_ptr
<UsbScanSplash
> splash( new UsbScanSplash
);
792 CreateDeviceCombo(wxGetApp().GetGlobalConfig().GetLastDevice());
795 // FIXME - tell the user we didn't do anything?
796 // or perhaps just disable rescan while in a mode
800 void BaseFrame::OnAbout(wxCommandEvent
&event
)
802 wxAboutDialogInfo info
;
803 info
.SetName(_T("Barry Desktop Control Panel"));
804 info
.SetVersion(_T("0.17"));
805 info
.SetDescription(_T("A Free Software graphical user interface for working with the BlackBerry(TM) handheld."));
806 info
.SetCopyright(_T("Copyright (C) 2009-2011, Net Direct Inc."));
807 info
.SetWebSite(_T("http://netdirect.ca/barry"));
809 " This program is free software; you can redistribute it and/or modify\n"
810 " it under the terms of the GNU General Public License as published by\n"
811 " the Free Software Foundation; either version 2 of the License, or\n"
812 " (at your option) any later version.\n"
814 " This program is distributed in the hope that it will be useful,\n"
815 " but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
816 " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
818 " See the GNU General Public License in the COPYING file at the\n"
819 " root directory of this project for more details.\n"));
821 info
.AddDeveloper(_T("Net Direct Inc."));
822 // info.AddDeveloper(_T("Chris Frey <cdfrey@foursquare.net>"));
823 // info.AddDeveloper(_T("See AUTHORS file for detailed"));
824 // info.AddDeveloper(_T("contribution information."));
826 info
.AddArtist(_T("Chris Frey - GUI interface"));
827 info
.AddArtist(_T("Martin Owens - Barry logo"));
828 info
.AddArtist(_T("Tango Desktop Project - Public domain icons"));
833 void BaseFrame::OnExit(wxCommandEvent
&event
)