@@ -47,8 +47,11 @@ int COperateWakeOnLan::Initial()
4747 if (!m_pModel)
4848 return -1 ;
4949 m_pView = new CFrmWakeOnLan (m_pModel);
50- if (!m_pView) return -2 ;
50+ if (!m_pView) return -1 ;
51+ QToolBar* pToolBar = m_pView->GetToolBar ();
52+ if (!pToolBar) return -1 ;
5153 m_pView->setWindowTitle (plugin->Name ());
54+
5255 check = connect (m_pView, SIGNAL (sigViewerFocusIn (QWidget*)),
5356 this , SIGNAL (sigViewerFocusIn (QWidget*)));
5457 Q_ASSERT (check);
@@ -72,12 +75,13 @@ int COperateWakeOnLan::Initial()
7275 });
7376 m_Menu.addSeparator ();
7477
75- m_Menu.addAction (QIcon::fromTheme (" view-refresh" ), tr (" Refresh" ),
78+ QAction* pRefresh = m_Menu.addAction (QIcon::fromTheme (" view-refresh" ), tr (" Refresh" ),
7679 this , [&](){
7780 foreach (auto p, m_pModel->m_Data )
7881 m_Arp.GetMac (p);
7982 });
80- m_Menu.addAction (
83+ pToolBar->addAction (pRefresh);
84+ QAction* pMac = m_Menu.addAction (
8185 QIcon::fromTheme (" mac" ), tr (" Get mac address" ),
8286 this , [&](){
8387 if (!m_pModel || !m_pView)
@@ -89,7 +93,8 @@ int COperateWakeOnLan::Initial()
8993 p->SetHostState (CParameterWakeOnLan::HostState::GetMac);
9094 }
9195 });
92- m_Menu.addAction (
96+ pToolBar->addAction (pMac);
97+ QAction* pWal = m_Menu.addAction (
9398 QIcon::fromTheme (" lan" ), tr (" Wake on lan" ),
9499 this , [&](){
95100 if (!m_pModel || !m_pView)
@@ -101,11 +106,14 @@ int COperateWakeOnLan::Initial()
101106 p->SetHostState (CParameterWakeOnLan::HostState::WakeOnLan);
102107 }
103108 });
109+ pToolBar->addAction (pWal);
110+ pToolBar->addSeparator ();
104111 m_Menu.addSeparator ();
105112
106- m_Menu.addAction (QIcon::fromTheme (" list-add" ), tr (" Add" ),
113+ QAction* pAdd = m_Menu.addAction (QIcon::fromTheme (" list-add" ), tr (" Add" ),
107114 this , SLOT (slotAdd ()));
108- m_Menu.addAction (QIcon::fromTheme (" document-edit" ), tr (" Edit" ),
115+ pToolBar->addAction (pAdd);
116+ QAction* pEdit = m_Menu.addAction (QIcon::fromTheme (" document-edit" ), tr (" Edit" ),
109117 this , [&](){
110118 QSharedPointer<CParameterWakeOnLan> para
111119 = m_pModel->GetData (m_pView->GetCurrentIndex ());
@@ -120,8 +128,10 @@ int COperateWakeOnLan::Initial()
120128 dlg.SetParameter (para.data ());
121129 RC_SHOW_WINDOW (&dlg);
122130 });
123- m_Menu.addAction (QIcon::fromTheme (" list-remove" ), tr (" Remove" ),
131+ pToolBar->addAction (pEdit);
132+ QAction* pRemove = m_Menu.addAction (QIcon::fromTheme (" list-remove" ), tr (" Remove" ),
124133 m_pView, SLOT (slotRemoveRow ()));
134+ pToolBar->addAction (pRemove);
125135
126136 return 0 ;
127137}
0 commit comments