3 /// Class for the fixed-size frame that holds the main app
7 Copyright (C) 2009-2012, 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(R) 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 "EvoSources.h"
364 //#include "EvoCfgDlg.h"
365 //#include "EvoDefaultDlg.h"
366 //void DumpItems(const EvoSources::List &list)
368 // EvoSources::List::const_iterator i;
369 // for( i = list.begin(); i != list.end(); ++i ) {
370 // cout << i->m_GroupName << ", "
371 // << i->m_SourceName << ", "
372 // << i->m_SourcePath << endl;
375 //#include "ConflictDlg.h"
376 void BaseFrame::OnModem(wxCommandEvent
&event
)
379 EvoDefaultDlg dlg(this);
385 cout << "Addressbook:\n";
386 DumpItems(es.GetAddressBook());
388 DumpItems(es.GetEvents());
390 DumpItems(es.GetTasks());
392 DumpItems(es.GetMemos());
394 OpenSync::Config::Evolution ecfg;
396 EvoCfgDlg dlg(this, ecfg, es);
399 cout << "Resulting paths:\n"
400 << ecfg.GetAddressPath() << endl
401 << ecfg.GetCalendarPath() << endl
402 << ecfg.GetTasksPath() << endl
403 << ecfg.GetMemosPath() << endl;
407 OpenSync::SyncChange change;
409 change.member_id = 1;
410 change.plugin_name = "barry-sync";
411 change.uid = "12341524235234";
412 change.printable_data =
415 " <NodeName>PRODID</NodeName>\n"
416 " <Content>-//OpenSync//NONSGML Barry Contact Record//EN</Content>\n"
419 " <Content>Adame Brandee</Content>\n"
420 " </FormattedName>\n"
422 " <LastName>Brandee</LastName>\n"
423 " <FirstName>Adame</FirstName>\n"
426 " <Content>71 Long St.\n"
427 "Toronto ON Canada\n"
428 "N0N 0N0</Content>\n"
429 " <Type>home</Type>\n"
432 " <Street>71 Long St.</Street>\n"
433 " <City>Toronto</City>\n"
434 " <Region>ON</Region>\n"
435 " <PostalCode>N0N 0N0</PostalCode>\n"
436 " <Country>Canada</Country>\n"
437 " <Type>home</Type>\n"
440 " <Content>+1 (416) 555-7711</Content>\n"
441 " <Type>voice</Type>\n"
442 " <Type>home</Type>\n"
445 " <Content>+1 (416) 955-7117</Content>\n"
446 " <Type>msg</Type>\n"
447 " <Type>cell</Type>\n"
450 " <Content>abrandee@sympatico.ca</Content>\n"
451 " <Type>internet</Type>\n"
452 " <Type>pref</Type>\n"
455 " <Category>Personal</Category>\n"
458 " <Content>Interweb salesman... 24/7</Content>\n"
462 std::vector<OpenSync::SyncChange> changes;
463 changes.push_back(change);
466 change.member_id = 2;
467 change.plugin_name = "evo2-sync";
468 change.uid = "asdfioausdf_1235234as_asdf12341524235234";
469 change.printable_data =
472 " <Content>+1 (416) 955-7117</Content>\n"
473 " <Type>CELL</Type>\n"
477 " <Content>+1 (416) 555-7711</Content>\n"
478 " <Type>HOME</Type>\n"
479 " <Type>VOICE</Type>\n"
483 " <Content>abrandee@sympatico.ca</Content>\n"
484 " <Type>OTHER</Type>\n"
488 " <Content>FALSE</Content>\n"
491 " <Content>20100322T225303Z</Content>\n"
494 " <NodeName>PRODID</NodeName>\n"
495 " <Content>-//OpenSync//NONSGML Barry Contact Record//EN</Content>\n"
498 " <Content>Adam Brandeee</Content>\n"
499 " </FormattedName>\n"
501 " <LastName>Brandeee</LastName>\n"
502 " <FirstName>Adam</FirstName>\n"
505 " <Content>71 Long St.\n"
509 " <Type>home</Type>\n"
512 " <Street>71 Long St.</Street>\n"
513 " <City>Toronto</City>\n"
514 " <Region>ON</Region>\n"
515 " <PostalCode>N0N 0N1</PostalCode>\n"
516 " <Country>Canada</Country>\n"
517 " <Type>home</Type>\n"
520 " <Category>Personal</Category>\n"
523 " <Content>Brandeee, Adam</Content>\n"
527 changes.push_back(change);
530 ConflictDlg::AlwaysMemoryBlock always;
531 ConflictDlg dlg(this, *wxGetApp().GetOpenSync().os22(),
532 "SDAIN", changes, always);
534 wxString msg(dlg.GetCommand().c_str(), wxConvUTF8);
536 msg += always.m_always ? _T("always") : _T("not always");
542 void BaseFrame::OnAppLoader(wxCommandEvent
&event
)
545 OpenSync::SyncChange change;
547 change.member_id = 1;
548 change.plugin_name = "barry-sync";
549 change.uid = "12341524235234";
550 change.printable_data =
554 " <Content>0</Content>\n"
557 " <Content>Subject</Content>\n"
560 " <Content>Bring burnt offering</Content>\n"
563 " <Content>Tent</Content>\n"
566 " <Content>20100506T040000Z</Content>\n"
569 " <Content>20100507T040000Z</Content>\n"
572 " <AlarmAction>AUDIO</AlarmAction>\n"
574 " <Content>20100506T034500Z</Content>\n"
575 " <Value>DATE-TIME</Value>\n"
581 std::vector<OpenSync::SyncChange> changes;
582 changes.push_back(change);
585 change.member_id = 2;
586 change.plugin_name = "evo2-sync";
587 change.uid = "asdfioausdf_1235234as_asdf12341524235234";
588 change.printable_data =
591 " <Content>PUBLISH</Content>\n"
594 " <TimezoneID>/softwarestudio.org/Tzfile/America/Thunder_Bay</TimezoneID>\n"
595 " <Location>America/Thunder_Bay</Location>\n"
597 " <TimezoneName>EST</TimezoneName>\n"
598 " <DateStarted>19701107T010000</DateStarted>\n"
599 " <RecurrenceRule>\n"
600 " <Rule>FREQ=YEARLY</Rule>\n"
601 " <Rule>INTERVAL=1</Rule>\n"
602 " <Rule>BYDAY=2SU</Rule>\n"
603 " <Rule>BYMONTH=11</Rule>\n"
604 " </RecurrenceRule>\n"
605 " <TZOffsetFrom>-0400</TZOffsetFrom>\n"
606 " <TZOffsetTo>-0500</TZOffsetTo>\n"
608 " <DaylightSavings>\n"
609 " <TimezoneName>EDT</TimezoneName>\n"
610 " <DateStarted>19700313T030000</DateStarted>\n"
611 " <RecurrenceRule>\n"
612 " <Rule>FREQ=YEARLY</Rule>\n"
613 " <Rule>INTERVAL=1</Rule>\n"
614 " <Rule>BYDAY=2SU</Rule>\n"
615 " <Rule>BYMONTH=3</Rule>\n"
616 " </RecurrenceRule>\n"
617 " <TZOffsetFrom>-0500</TZOffsetFrom>\n"
618 " <TZOffsetTo>-0400</TZOffsetTo>\n"
619 " </DaylightSavings>\n"
623 " <Content>1</Content>\n"
626 " <Content>Celebration day</Content>\n"
629 " <Content>Tent of</Content>\n"
632 " <Content>20100506T000000</Content>\n"
633 " <TimezoneID>/softwarestudio.org/Tzfile/America/Thunder_Bay</TimezoneID>\n"
636 " <Content>20100507T000000</Content>\n"
637 " <TimezoneID>/softwarestudio.org/Tzfile/America/Thunder_Bay</TimezoneID>\n"
639 " <DateCalendarCreated>\n"
640 " <Content>20100430T214736Z</Content>\n"
641 " </DateCalendarCreated>\n"
643 " <Content>20100430T214736</Content>\n"
646 " <Content>20100430T214927</Content>\n"
649 " <Content>Bring burnt offering</Content>\n"
652 " <Content>PUBLIC</Content>\n"
655 " <Content>OPAQUE</Content>\n"
658 " <AlarmAction>AUDIO</AlarmAction>\n"
660 " <Content>20100506T034500Z</Content>\n"
661 " <Value>DATE-TIME</Value>\n"
668 changes.push_back(change);
671 ConflictDlg::AlwaysMemoryBlock always;
672 ConflictDlg dlg(this, *wxGetApp().GetOpenSync().os22(),
673 "SDAIN", changes, always);
675 wxString msg(dlg.GetCommand().c_str(), wxConvUTF8);
677 msg += always.m_always ? _T("always") : _T("not always");
683 void BaseFrame::OnDeviceSwitch(wxCommandEvent
&event
)
687 void BaseFrame::OnBrowseDatabases(wxCommandEvent
&event
)
689 int i
= Barry::Probe::Find(wxGetApp().GetResults(), GetCurrentComboPin());
691 wxMessageBox(_T("There is no device selected in the device list. Please select a device to browse."),
692 _T("Database Browser Mode"), wxOK
| wxICON_ERROR
);
697 m_browse_mode
.reset( new BrowseMode(this,
698 wxGetApp().GetResults()[i
]) );
700 catch( std::exception
&e
) {
702 "An error occurred that prevented the loading of Database\n"
703 "Browse mode. This could be due to a low level USB\n"
704 "issue. Please make sure your device is plugged in\n"
705 "and not in Desktop Mode. If it is, try replugging\n"
706 "the device, and rescanning the USB bus from the menu.\n"
709 msg
+= wxString(e
.what(), wxConvUTF8
);
710 wxMessageBox(msg
, _T("Database Browser Mode"), wxOK
| wxICON_ERROR
);
714 EnableBackButton(m_browse_mode
.get());
717 void BaseFrame::OnMediaManagement(wxCommandEvent
&event
)
721 void BaseFrame::OnMisc(wxCommandEvent
&event
)
725 void BaseFrame::OnBackButton(wxCommandEvent
&event
)
730 void BaseFrame::OnTermBackupAndRestore(wxProcessEvent
&event
)
732 barryverbose("OnTermBackupAndRestore(): done = "
733 << (!m_backup_process
.IsAppRunning() ? "true" : "false")
734 << ", status = " << m_backup_process
.GetAppStatus());
735 if( !m_backup_process
.IsAppRunning() &&
736 m_backup_process
.GetAppStatus() )
738 wxMessageBox(_T("Unable to run barrybackup, or it returned an error. Please make sure it is installed and in your PATH."),
739 _T("Backup and Restore"), wxOK
| wxICON_ERROR
);
743 void BaseFrame::OnBarryLogoClicked(wxCommandEvent
&event
)
745 PopupMenu(m_sysmenu
.get(), 20, 20);
748 void BaseFrame::OnNetDirectLogoClicked(wxCommandEvent
&event
)
750 // fire up a browser to point to the Barry documentation
752 ::wxLaunchDefaultBrowser(_T("http://netdirect.ca/barry"));
755 void BaseFrame::OnDeviceComboChange(wxCommandEvent
&event
)
757 Barry::Pin pin
= GetCurrentComboPin();
760 if( pin
== wxGetApp().GetGlobalConfig().GetLastDevice() )
764 wxGetApp().GetGlobalConfig().SetLastDevice(pin
);
767 m_sysmenu
->Enable(SysMenu_RenameDevice
, false);
769 // update the main mode's screenshot
770 m_main_menu_mode
->UpdateScreenshot(pin
);
771 if( m_current_mode
== m_main_menu_mode
.get() )
774 // FIXME - if inside a sub menu mode, we need to destroy the mode
775 // class and start fresh
778 void BaseFrame::OnVerboseLogging(wxCommandEvent
&event
)
780 Barry::Verbose( !Barry::IsVerbose() );
781 wxGetApp().GetGlobalConfig().SetVerboseLogging( Barry::IsVerbose() );
785 void BaseFrame::OnRenameDevice(wxCommandEvent
&event
)
787 Barry::Pin pin
= GetCurrentComboPin();
791 // grab the current known name of the device
792 const Barry::Probe::Results
&results
= wxGetApp().GetResults();
793 int index
= Barry::Probe::Find(results
, pin
);
797 wxString
current_name(results
[index
].m_cfgDeviceName
.c_str(), wxConvUTF8
);
798 wxTextEntryDialog
dlg(this,
799 _T("Please enter a name for the current device:"),
801 current_name
, wxTextEntryDialogStyle
);
803 if( dlg
.ShowModal() != wxID_OK
)
804 return; // nothing to do
805 wxString name
= dlg
.GetValue();
806 if( name
== current_name
)
807 return; // nothing to do
809 wxGetApp().SetDeviceName(pin
, string(name
.utf8_str()));
812 CreateDeviceCombo(wxGetApp().GetGlobalConfig().GetLastDevice());
815 void BaseFrame::OnResetDevice(wxCommandEvent
&event
)
817 int i
= Barry::Probe::Find(wxGetApp().GetResults(), GetCurrentComboPin());
819 Usb::Device
dev(wxGetApp().GetResults()[i
].m_dev
);
827 void BaseFrame::OnRescanUsb(wxCommandEvent
&event
)
829 if( m_current_mode
== m_main_menu_mode
.get() ) {
830 std::auto_ptr
<UsbScanSplash
> splash( new UsbScanSplash
);
832 CreateDeviceCombo(wxGetApp().GetGlobalConfig().GetLastDevice());
835 // FIXME - tell the user we didn't do anything?
836 // or perhaps just disable rescan while in a mode
840 void BaseFrame::OnAbout(wxCommandEvent
&event
)
842 wxAboutDialogInfo info
;
843 info
.SetName(_T("Barry Desktop Control Panel"));
844 info
.SetVersion(_T("0.18.0"));
845 info
.SetDescription(_T("A Free Software graphical user interface for working with the BlackBerry® smartphone."));
846 info
.SetCopyright(_T("Copyright © 2009-2012, Net Direct Inc."));
847 info
.SetWebSite(_T("http://netdirect.ca/barry"));
849 " This program is free software; you can redistribute it and/or modify\n"
850 " it under the terms of the GNU General Public License as published by\n"
851 " the Free Software Foundation; either version 2 of the License, or\n"
852 " (at your option) any later version.\n"
854 " This program is distributed in the hope that it will be useful,\n"
855 " but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
856 " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
858 " See the GNU General Public License in the COPYING file at the\n"
859 " root directory of this project for more details.\n"));
861 info
.AddDeveloper(_T("Net Direct Inc."));
862 // info.AddDeveloper(_T("Chris Frey <cdfrey@foursquare.net>"));
863 // info.AddDeveloper(_T("See AUTHORS file for detailed"));
864 // info.AddDeveloper(_T("contribution information."));
866 info
.AddArtist(_T("Chris Frey - GUI interface"));
867 info
.AddArtist(_T("Martin Owens - Barry logo"));
868 info
.AddArtist(_T("Tango Desktop Project - Public domain icons"));
873 void BaseFrame::OnExit(wxCommandEvent
&event
)